@arbol-ai/maximus 8.1.0 → 8.5.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 +16 -16
- package/dist/analytics/analytics.js +3 -3
- package/dist/body.d.ts +2 -2
- package/dist/body.js +2 -1
- package/dist/capture/index.d.ts +1 -1
- package/dist/capture/index.js +3 -4
- package/dist/chunks/{define-app-BxGZdNmS.js → define-app-CQpWqqqE.js} +33 -14
- package/dist/chunks/destination-5xTX0b7E.js +65 -0
- package/dist/chunks/{digest-C7UGt760.js → digest-C51F1bhA.js} +1 -2
- package/dist/chunks/{errors-CWgE9uvM.js → errors-BoutSmiy.js} +2 -3
- package/dist/chunks/{execution-BTiAWA4n.js → execution-Bpq6s4nA.js} +9 -8
- package/dist/chunks/{generate-C-9FKW0o.js → generate-Dg88LzLU.js} +1 -1
- package/dist/chunks/{handler-iebR-urt.js → handler-DSpyrWc-.js} +6 -2
- package/dist/chunks/{http-layout-BvlbD__1.js → http-layout-BcYH4I2w.js} +1 -1
- package/dist/chunks/{http-paths-DMBxwpp6.js → http-paths-D043DkJv.js} +50 -81
- package/dist/chunks/http-routes-B6tCsnxB.js +29 -0
- package/dist/chunks/{openapi-BF3eCpux.js → openapi-D2rds7vy.js} +27 -116
- package/dist/chunks/{openapi-file-RcXoq0AF.js → openapi-file-BK8zET5U.js} +24 -6
- package/dist/chunks/{pages-BCksUeRf.js → pages-B7ysoFAM.js} +1 -1
- package/dist/chunks/result-CF4OzG9O.js +29 -0
- package/dist/chunks/{runtime-D5eR9-Es.js → runtime-8OpxAvsI.js} +132 -7
- package/dist/chunks/schemas-_UJcx_uY.js +813 -0
- package/dist/chunks/{server-B9C8KPwa.js → server-CVhTLNj2.js} +37 -101
- package/dist/chunks/{src-C-4z443M.js → src-B_LthUVU.js} +39 -18
- package/dist/chunks/tasks-C873C3le.js +100 -0
- package/dist/chunks/tasks-DYdY-dBI.js +267 -0
- package/dist/chunks/{types-Dqo3oGig.d.ts → types-BfGa2aJT.d.ts} +346 -138
- package/dist/chunks/validation-CpzAxj2_.js +201 -0
- package/dist/chunks/{workers-types-BgjyDtGd.d.ts → workers-types-Cxf-5cH7.d.ts} +6 -1
- package/dist/client.d.ts +92 -0
- package/dist/client.js +300 -0
- package/dist/diagnostics.d.ts +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/http-paths.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +11 -9
- package/dist/internals.d.ts +1 -1
- package/dist/internals.js +4 -4
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/tasks.d.ts +33 -0
- package/dist/mcp/tasks.js +3 -0
- package/dist/project/config.d.ts +2 -2
- package/dist/project/config.js +3 -2
- 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 +2 -2
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +6 -5
- package/dist/webhooks.d.ts +13 -2
- package/dist/webhooks.js +38 -1
- package/dist/workers/runtime.d.ts +1 -1
- package/dist/workers/runtime.js +1 -1
- package/package.json +15 -3
- package/skills/maximus/SKILL.md +7 -4
- package/skills/maximus/references/routes-and-tools.md +9 -1
- package/dist/chunks/result-CKgZHrnj.js +0 -56
- package/dist/chunks/schemas-BOFxZP1c.js +0 -227
- package/dist/chunks/validation-DMu0rkMQ.js +0 -670
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
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 PageQuery, PageQueryFields, PhoneNumberSchema, type PostalAddress, PostalAddressSchema, type PreparedContext, type Principal, PrincipalSchema, type Result, type RouteBody, type RouteContext, 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, defineAuth, defineContext, defineErrors, defineHandler, defineTelemetry, defineTool, err, isJsonMediaType, isPublicOperation, isResult, matchesScopes, maximus, ok, operationMatchesScopes, operationScopes, pageLimit, parseInput, parseSchema, projectAccessToken, projectToken, protectedResourceMetadata, readBodyBytes, readBodyText, readJsonBody, readJsonResponse, reportUnexpected, resultSchema, retryAfterSeconds, standardErrors, t };
|
|
1
|
+
import { $ as PageInfo, $n as TokenPolicy, $t as defineContext, A as TransportContext, Ar as ErrorFactory, B as DeletedObject, Bn as BackgroundContext, Bt as HandlerArguments, Cn as isPublicOperation, Cr as ok, D as HttpRoute, Dn as SchemaKeywords, Dr as DefinedErrors, E as HttpOptions, En as operationScopes, Fr as resultSchema, Ft as ContextDeclaration, G as NamedReference, Gt as PreparedContext, H as EmailAddressSchema, Hn as Observer, Ht as HandlerHttp, Ir as standardErrors, It as DomainCode, J as PostalAddress, Jt as SchemaOf, K as NamedReferenceSchema, Kn as reportUnexpected, Lt as Fail, M as projectAccessToken, Mr as FailureData, Mt as parseSchema, N as EmptyInputSchema, Nr as FailureSchema, Nt as AuthOptions, O as HttpTransport, Or as ErrorCatalog, P as OrganizationIdSchema, Pr as defineErrors, Pt as ContextArguments, Q as Page, Qn as TokenDevelopment, Qt as defineAuth, R as UuidSchema, Rt as Failed, Sr as isResult, T as HttpMiddleware, Tn as operationMatchesScopes, Tr as AttachmentOutputSchema, U as HexColorSchema, Un as TelemetryConfig, Ut as HandlerMcp, V as DeletedObjectSchema, Vn as ExecutionObservation, Vt as HandlerDeclaration, W as HttpsUrlSchema, Wt as HandlerOptions, X as SignedUrl, Xn as TokenAlgorithm, Xt as ToolDeclaration, Y as PostalAddressSchema, Yn as TokenAccess, Yt as SchemaOrFields, Z as SignedUrlSchema, Zn as TokenClaims, Zt as ToolOptions, _ as readBodyText, _n as McpSkill, _r as BodyFailure, a as t, an as ApplicationBuilder, ar as projectToken, at as cursorKey, b as createHttpRouteResolver, bn as OperationScope, br as Success, c as isJsonMediaType, cr as Principal, d as retryAfterSeconds, dn as AppManifest, dr as TokenPrincipal, en as defineHandler, er as TokenResolutionContext, et as PageInfoSchema, f as publicDestination, fn as Exposure, fr as OAuthResource, g as readBodyBytes, gn as McpGuide, gr as BinaryBody, h as HttpBodyFailureReason, hn as McpConfiguration, i as Type, ir as createTokenVerifier, it as TPage, j as createHttpHandler, jr as Failure, jt as parseInput, k as RouteContext, kr as ErrorDefinition, l as readJsonBody, lr as PrincipalSchema, m as HttpBodyFailure, mn as InvocationAuthority, n as Static, nn as defineTool, nr as TokenSource, nt as PageQuery, o as createOpenApi, on as ApplicationConfiguration, or as ScopeMatch, ot as cutPage, p as BodyReadOptions, pn as Invocation, pr as protectedResourceMetadata, q as PhoneNumberSchema, qt as RouteBody, r as TSchema, rr as createTokenAuthorization, rt as PageQueryFields, s as createRpcOpenApi, sn as maximus, sr as matchesScopes, st as pageLimit, tn as defineTelemetry, tr as TokenScheme, tt as PageOrder, u as readJsonResponse, ur as TokenClient, v as HttpRouteDefinition, vr as FailureResult, wr as Attachment, xn as OperationShape, xr as err, y as HttpRouteMatch, yn as OperationMiddleware, yr as Result, zn as AdmissionObservation, zt as HandlerAnswer } from "./chunks/types-BfGa2aJT.js";
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { a as parseSchema, i as parseInput } from "./chunks/validation-
|
|
2
|
-
import { i as
|
|
1
|
+
import { a as parseSchema, i as parseInput } from "./chunks/validation-CpzAxj2_.js";
|
|
2
|
+
import { _ as cursorKey, b as AttachmentOutputSchema, c as HexColorSchema, d as PhoneNumberSchema, f as PostalAddressSchema, g as PageQueryFields, h as PageInfoSchema, i as UuidSchema, l as HttpsUrlSchema, m as Page, n as OrganizationIdSchema, o as DeletedObjectSchema, p as SignedUrlSchema, s as EmailAddressSchema, t as EmptyInputSchema, u as NamedReferenceSchema, v as cutPage, y as pageLimit } from "./chunks/schemas-_UJcx_uY.js";
|
|
3
|
+
import { i as standardErrors, n as defineErrors, r as resultSchema, t as FailureSchema } from "./chunks/errors-BoutSmiy.js";
|
|
3
4
|
import { n as readBodyBytes, r as readBodyText } from "./chunks/body-DOIHwIIl.js";
|
|
4
|
-
import { t as createHttpRouteResolver } from "./chunks/http-paths-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { a as maximus, i as protectedResourceMetadata, n as t, r as createHttpHandler, t as Type } from "./chunks/src-
|
|
9
|
-
import { a as defineTelemetry, i as defineHandler, n as defineAuth, o as defineTool, r as defineContext } from "./chunks/handler-
|
|
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-DYdY-dBI.js";
|
|
7
|
+
import { _ as projectAccessToken, a as createTokenVerifier, i as createTokenAuthorization, n as createRpcOpenApi, s as projectToken, t as createOpenApi, y as PrincipalSchema } from "./chunks/openapi-D2rds7vy.js";
|
|
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-B_LthUVU.js";
|
|
10
|
+
import { a as defineTelemetry, i as defineHandler, n as defineAuth, o as defineTool, r as defineContext } from "./chunks/handler-DSpyrWc-.js";
|
|
10
11
|
import { o as reportUnexpected } from "./chunks/telemetry-BtxJh69Q.js";
|
|
11
12
|
import { a as retryAfterSeconds, i as readJsonResponse, r as readJsonBody, t as isJsonMediaType } from "./chunks/json-B14evE6-.js";
|
|
13
|
+
import { t as publicDestination } from "./chunks/destination-5xTX0b7E.js";
|
|
12
14
|
|
|
13
|
-
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, defineAuth, defineContext, defineErrors, defineHandler, defineTelemetry, defineTool, err, isJsonMediaType, isPublicOperation, isResult, matchesScopes, maximus, ok, operationMatchesScopes, operationScopes, pageLimit, parseInput, parseSchema, projectAccessToken, projectToken, protectedResourceMetadata, readBodyBytes, readBodyText, readJsonBody, readJsonResponse, reportUnexpected, resultSchema, retryAfterSeconds, standardErrors, t };
|
|
15
|
+
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 };
|
package/dist/internals.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as TransportContext, An as CaptureConfig, Bn as BackgroundContext, E as HttpOptions, En as operationScopes, Fn as VerifiedCaller, Gn as recordExecution, In as recordCapture, Jn as withDiagnostics, Ln as ExecutionCall, O as HttpTransport, Pn as CapturedCall, Rn as executeOperation, Sn as composeOperations, Un as TelemetryConfig, b as createHttpRouteResolver, dn as AppManifest, mn as InvocationAuthority, pn as Invocation, qn as telemetryEnabled, t as defineApp, v as HttpRouteDefinition, wn as operation, xn as OperationShape, y as HttpRouteMatch, yn as OperationMiddleware } from "./chunks/types-BfGa2aJT.js";
|
|
2
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 };
|
package/dist/internals.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as defineApp } from "./chunks/define-app-
|
|
2
|
-
import { t as createHttpRouteResolver } from "./chunks/http-paths-
|
|
3
|
-
import {
|
|
1
|
+
import { n as defineApp } from "./chunks/define-app-CQpWqqqE.js";
|
|
2
|
+
import { t as createHttpRouteResolver } from "./chunks/http-paths-D043DkJv.js";
|
|
3
|
+
import { b as operationScopes, g as operation, p as composeOperations } from "./chunks/tasks-DYdY-dBI.js";
|
|
4
4
|
import { a as recordExecution, c as withDiagnostics, s as telemetryEnabled } from "./chunks/telemetry-BtxJh69Q.js";
|
|
5
|
-
import { n as recordCapture, t as executeOperation } from "./chunks/execution-
|
|
5
|
+
import { n as recordCapture, t as executeOperation } from "./chunks/execution-Bpq6s4nA.js";
|
|
6
6
|
|
|
7
7
|
export { composeOperations, createHttpRouteResolver, defineApp, executeOperation, operation, operationScopes, recordCapture, recordExecution, telemetryEnabled, withDiagnostics };
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { O as HttpTransport } from "../chunks/types-BfGa2aJT.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-CVhTLNj2.js");
|
|
17
17
|
return handleMcp(context);
|
|
18
18
|
}
|
|
19
19
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { cn as TaskAccess, jr as Failure, ln as TaskRecord, yr as Result } from "../chunks/types-BfGa2aJT.js";
|
|
2
|
+
import { CallToolResult, McpServer } from "@modelcontextprotocol/server";
|
|
3
|
+
/** The Tasks extension's id, which a client declares on each request and a server among its capabilities. */
|
|
4
|
+
export declare const TASKS_EXTENSION = "io.modelcontextprotocol/tasks";
|
|
5
|
+
/** A task as an MCP client reads it, a JSON-RPC result. A failed operation completes the task with a tool error. */
|
|
6
|
+
export type McpTask = {
|
|
7
|
+
taskId: string;
|
|
8
|
+
status: 'working' | 'completed' | 'cancelled';
|
|
9
|
+
createdAt: string;
|
|
10
|
+
lastUpdatedAt: string;
|
|
11
|
+
ttlMs: number;
|
|
12
|
+
pollIntervalMs: number;
|
|
13
|
+
/** The tool call's result, once completed. */
|
|
14
|
+
result?: CallToolResult;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Whether a request's `_meta` declares the Tasks extension: an empty object at
|
|
18
|
+
* `io.modelcontextprotocol/clientCapabilities` › `extensions` › `io.modelcontextprotocol/tasks`, as
|
|
19
|
+
* `@modelcontextprotocol/ext-tasks` reads it.
|
|
20
|
+
*/
|
|
21
|
+
export declare function declaresTasks(meta: unknown): boolean;
|
|
22
|
+
/** Whether a `tools/call` result is a task the server created, `resultType: "task"`, rather than the call's result. */
|
|
23
|
+
export declare function isTaskResult(result: unknown): boolean;
|
|
24
|
+
/** A Result as a tool call answers it: the value, or the failure as a tool error the model can read. */
|
|
25
|
+
export declare function toolResult(result: Result<unknown, Failure>): CallToolResult;
|
|
26
|
+
/** A task as an MCP client reads it. A failed operation completes its tool call with a tool error. */
|
|
27
|
+
export declare function mcpTask(task: TaskRecord): McpTask;
|
|
28
|
+
/**
|
|
29
|
+
* Declares the Tasks extension on `server` and serves `tasks/get` and `tasks/cancel` for the caller's tasks. A
|
|
30
|
+
* task id the caller did not start, or one that expired, is invalid params (-32602).
|
|
31
|
+
*/
|
|
32
|
+
export declare function attachTasks(server: McpServer, tasks: TaskAccess): void;
|
|
33
|
+
export type { TaskAccess, TaskRecord };
|
package/dist/project/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TSchema } from "
|
|
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-BfGa2aJT.js";
|
|
2
|
+
import { TSchema } from "typebox";
|
|
3
3
|
/** A route's HTTP method. */
|
|
4
4
|
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
5
5
|
/**
|
package/dist/project/config.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
+
import { c as isHandlerDeclaration, l as isToolDeclaration, s as isContextDeclaration, t as Failed } from "../chunks/handler-DSpyrWc-.js";
|
|
3
4
|
import { n as routeTitle, t as routeName } from "../chunks/names-ncD7A3DV.js";
|
|
4
5
|
|
|
5
6
|
// src/project/bind.ts
|
package/dist/project/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
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-BfGa2aJT.js";
|
|
2
|
+
import { n as WorkerOptions, r as WorkerRuntime } from "../chunks/workers-types-Cxf-5cH7.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
|
-
import { i as standardErrors } from "../chunks/errors-
|
|
2
|
-
import { r as createAssetHandler, t as createWorker } from "../chunks/runtime-
|
|
3
|
-
import { t as checkPagePaths } from "../chunks/pages-
|
|
1
|
+
import { i as standardErrors } from "../chunks/errors-BoutSmiy.js";
|
|
2
|
+
import { r as createAssetHandler, t as createWorker } from "../chunks/runtime-8OpxAvsI.js";
|
|
3
|
+
import { t as checkPagePaths } from "../chunks/pages-B7ysoFAM.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
|
|
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 PageQuery, PageQueryFields, PhoneNumberSchema, type PostalAddress, PostalAddressSchema, type SchemaInput, type SchemaIssue, SchemaValidationError, type SignedUrl, SignedUrlSchema, type Static, type StaticDecode, type TPage, type TSchema, Type, UuidSchema, checkSchema, decodeInput, decodeSchema, defaultSchema, extendObject, inputSchema, inspectSchema, literalUnion, looseObject, normalizeSchema, pageLimit, parseInput, parseSchema, pipeSchema, readSchema, refineSchema, strictObject, stripObject, t, transformSchema, urlSchema, withoutSecrets };
|
|
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, Tr as AttachmentOutputSchema, 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, wr as Attachment, wt as transformSchema, xt as refineSchema, yt as normalizeSchema, z as t } from "./chunks/types-BfGa2aJT.js";
|
|
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 };
|
package/dist/schemas.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as
|
|
1
|
+
import { a as parseSchema, i as parseInput, n as decodeInput, o as SchemaValidationError, r as decodeSchema } from "./chunks/validation-CpzAxj2_.js";
|
|
2
|
+
import { A as normalizeSchema, B as withoutSecrets, C as defaultSchema, D as inspectSchema, E as inputSchema, F as transformSchema, I as urlSchema, M as refineSchema, N as strictObject, O as literalUnion, P as stripObject, S as readSchema, _ as cursorKey, a as t, b as AttachmentOutputSchema, c as HexColorSchema, d as PhoneNumberSchema, f as PostalAddressSchema, g as PageQueryFields, h as PageInfoSchema, i as UuidSchema, j as pipeSchema, k as looseObject, l as HttpsUrlSchema, m as Page, n as OrganizationIdSchema, o as DeletedObjectSchema, p as SignedUrlSchema, r as Type, s as EmailAddressSchema, t as EmptyInputSchema, u as NamedReferenceSchema, v as cutPage, w as extendObject, x as checkSchema, y as pageLimit } from "./chunks/schemas-_UJcx_uY.js";
|
|
3
3
|
|
|
4
|
-
export { AttachmentOutputSchema, DeletedObjectSchema, EmailAddressSchema, EmptyInputSchema, HexColorSchema, HttpsUrlSchema, NamedReferenceSchema, OrganizationIdSchema, Page, PageInfoSchema, PageQueryFields, PhoneNumberSchema, PostalAddressSchema, SchemaValidationError, SignedUrlSchema, Type, UuidSchema, checkSchema, decodeInput, decodeSchema, defaultSchema, extendObject, inputSchema, inspectSchema, literalUnion, looseObject, normalizeSchema, pageLimit, parseInput, parseSchema, pipeSchema, readSchema, refineSchema, strictObject, stripObject, t, transformSchema, urlSchema, withoutSecrets };
|
|
4
|
+
export { AttachmentOutputSchema, DeletedObjectSchema, EmailAddressSchema, EmptyInputSchema, HexColorSchema, HttpsUrlSchema, NamedReferenceSchema, OrganizationIdSchema, Page, PageInfoSchema, PageQueryFields, PhoneNumberSchema, PostalAddressSchema, SchemaValidationError, SignedUrlSchema, 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 {
|
|
1
|
+
import { in as StandardFailure, rn as STANDARD_FAILURES } from "./chunks/types-BfGa2aJT.js";
|
|
2
2
|
export { STANDARD_FAILURES, StandardFailure };
|
package/dist/tooling/cli.js
CHANGED
|
@@ -109,7 +109,7 @@ async function run() {
|
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
111
|
case "gen": {
|
|
112
|
-
const { generateRoute, generateTool } = await import("../chunks/generate-
|
|
112
|
+
const { generateRoute, generateTool } = await import("../chunks/generate-Dg88LzLU.js");
|
|
113
113
|
const [kind, ...args] = rest;
|
|
114
114
|
if (kind === "route" && args.length === 2) {
|
|
115
115
|
const [method = "", path = ""] = args;
|
|
@@ -139,7 +139,7 @@ async function run() {
|
|
|
139
139
|
return;
|
|
140
140
|
}
|
|
141
141
|
case "openapi": {
|
|
142
|
-
const { writeOpenApi } = await import("../chunks/openapi-file-
|
|
142
|
+
const { writeOpenApi } = await import("../chunks/openapi-file-BK8zET5U.js");
|
|
143
143
|
const written = await writeOpenApi(rest[0] ?? ".", {
|
|
144
144
|
...values.out === void 0 ? {} : { out: values.out },
|
|
145
145
|
check: values.check
|
package/dist/vite/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $n as TokenPolicy, Qn as TokenDevelopment, Xn as TokenAlgorithm } from "../chunks/types-BfGa2aJT.js";
|
|
2
2
|
import { WorkerConfig } from "cf/config";
|
|
3
3
|
import { Plugin } from "vite";
|
|
4
4
|
/** Where the Worker runs: `development` under `vp dev`, `production` in every build. */
|
package/dist/vite/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as checkMcpResourceNames } from "../chunks/define-app-
|
|
2
|
-
import { a as operationPathParameters } from "../chunks/http-paths-
|
|
3
|
-
import { a as ownsPrefix, t as VERSIONED_PATH } from "../chunks/http-layout-
|
|
4
|
-
import { t as checkPagePaths } from "../chunks/pages-
|
|
1
|
+
import { t as checkMcpResourceNames } from "../chunks/define-app-CQpWqqqE.js";
|
|
2
|
+
import { a as operationPathParameters } from "../chunks/http-paths-D043DkJv.js";
|
|
3
|
+
import { a as ownsPrefix, t as VERSIONED_PATH } from "../chunks/http-layout-BcYH4I2w.js";
|
|
4
|
+
import { t as checkPagePaths } from "../chunks/pages-B7ysoFAM.js";
|
|
5
5
|
import { t as routeName } from "../chunks/names-ncD7A3DV.js";
|
|
6
6
|
import { a as projectPath, i as projectFiles, o as publicFiles, r as compareNames, s as routeShape, t as PROJECT_DIRECTORIES } from "../chunks/project-files-C0OX7MQQ.js";
|
|
7
7
|
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
@@ -1227,7 +1227,8 @@ function prepareProject(directory, mode, project) {
|
|
|
1227
1227
|
"",
|
|
1228
1228
|
"export default worker.handler;",
|
|
1229
1229
|
"export const Service = worker.entrypoint;",
|
|
1230
|
-
...durableObjects
|
|
1230
|
+
...durableObjects,
|
|
1231
|
+
...Object.hasOwn(project.env.production, "MAXIMUS_TASKS") ? ["export const MaximusTasks = worker.tasks;"] : []
|
|
1231
1232
|
]),
|
|
1232
1233
|
"http.ts": generatedModule(mode, [
|
|
1233
1234
|
"import { createHttpHandler } from '@arbol-ai/maximus';",
|
package/dist/webhooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jr as Failure, yr as Result } from "./chunks/types-BfGa2aJT.js";
|
|
2
2
|
/** Why a webhook signature was refused: absent, malformed, outside the time tolerance, or not matching. */
|
|
3
3
|
export declare const WEBHOOK_SIGNATURE_FAILURES: readonly ['missing', 'malformed', 'expired', 'mismatch'];
|
|
4
4
|
/** Why a webhook signature was refused. */
|
|
@@ -66,4 +66,15 @@ export declare function verifyStandardWebhook(options: {
|
|
|
66
66
|
}): Promise<Result<{
|
|
67
67
|
id: string;
|
|
68
68
|
timestamp: number;
|
|
69
|
-
}, WebhookSignatureFailure>>;
|
|
69
|
+
}, WebhookSignatureFailure>>;
|
|
70
|
+
/**
|
|
71
|
+
* Signs a Standard Webhooks delivery with the specification's own `standardwebhooks` package: the headers to
|
|
72
|
+
* send with `payload`, exactly as given. The secret is the `whsec_<base64>` value the receiver verifies with,
|
|
73
|
+
* and `id` names the delivery, which the receiver keeps as its idempotency key.
|
|
74
|
+
*/
|
|
75
|
+
export declare function signStandardWebhook(options: {
|
|
76
|
+
id: string;
|
|
77
|
+
now?: () => number;
|
|
78
|
+
payload: string;
|
|
79
|
+
secret: string;
|
|
80
|
+
}): Record<'webhook-id' | 'webhook-signature' | 'webhook-timestamp', string>;
|
package/dist/webhooks.js
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
|
+
import { Webhook } from "standardwebhooks";
|
|
2
|
+
|
|
1
3
|
// src/webhooks.ts
|
|
4
|
+
/**
|
|
5
|
+
* `@arbol-ai/maximus/webhooks`: webhook signature verification for the three schemes providers use, and
|
|
6
|
+
* {@link signStandardWebhook}, which signs a delivery as the Standard Webhooks specification does.
|
|
7
|
+
*
|
|
8
|
+
* - {@link verifyHmacSignature}: an HMAC-SHA256 of the raw body, hex or base64,
|
|
9
|
+
* in one header (the common `X-…-Signature` / `X-Hub-Signature-256` scheme).
|
|
10
|
+
* - {@link verifyTimestampedSignature}: `t=<unix>,v1=<hex>` headers signing
|
|
11
|
+
* `<t>.<body>` (the Stripe-style scheme; some providers label it `v0`).
|
|
12
|
+
* - {@link verifyStandardWebhook}: the Standard Webhooks specification
|
|
13
|
+
* (`webhook-id`, `webhook-timestamp`, `webhook-signature: v1,<base64> …`),
|
|
14
|
+
* used by many webhook platforms; `svix-*` header names are accepted too.
|
|
15
|
+
*
|
|
16
|
+
* Every comparison runs through `crypto.subtle.verify`, so there is no userland
|
|
17
|
+
* timing leak. Timestamps are checked in both directions (a signed request
|
|
18
|
+
* from the future is as suspicious as a replayed one). Call these on the raw
|
|
19
|
+
* body, before parsing it; a failure carries only a closed reason, never the
|
|
20
|
+
* body, a header value or the secret. A missing or empty secret throws a
|
|
21
|
+
* TypeError: it is the deployment's mistake, not the sender's.
|
|
22
|
+
*
|
|
23
|
+
* Sources: https://github.com/standard-webhooks/standard-webhooks/blob/main/spec/standard-webhooks.md,
|
|
24
|
+
* https://docs.stripe.com/webhooks#verify-manually.
|
|
25
|
+
*/
|
|
2
26
|
/** Why a webhook signature was refused: absent, malformed, outside the time tolerance, or not matching. */
|
|
3
27
|
const WEBHOOK_SIGNATURE_FAILURES = [
|
|
4
28
|
"missing",
|
|
@@ -171,5 +195,18 @@ async function verifyStandardWebhook(options) {
|
|
|
171
195
|
};
|
|
172
196
|
return failure("mismatch");
|
|
173
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* Signs a Standard Webhooks delivery with the specification's own `standardwebhooks` package: the headers to
|
|
200
|
+
* send with `payload`, exactly as given. The secret is the `whsec_<base64>` value the receiver verifies with,
|
|
201
|
+
* and `id` names the delivery, which the receiver keeps as its idempotency key.
|
|
202
|
+
*/
|
|
203
|
+
function signStandardWebhook(options) {
|
|
204
|
+
const timestamp = new Date(options.now?.() ?? Date.now());
|
|
205
|
+
return {
|
|
206
|
+
"webhook-id": options.id,
|
|
207
|
+
"webhook-timestamp": String(Math.floor(timestamp.getTime() / 1e3)),
|
|
208
|
+
"webhook-signature": new Webhook(requireSecret(options.secret)).sign(options.id, timestamp, options.payload)
|
|
209
|
+
};
|
|
210
|
+
}
|
|
174
211
|
|
|
175
|
-
export { DEFAULT_TOLERANCE_SECONDS, MAX_SIGNATURES, WEBHOOK_SIGNATURE_FAILURES, verifyHmacSignature, verifyStandardWebhook, verifyTimestampedSignature, webhookSignatureFailure };
|
|
212
|
+
export { DEFAULT_TOLERANCE_SECONDS, MAX_SIGNATURES, WEBHOOK_SIGNATURE_FAILURES, signStandardWebhook, verifyHmacSignature, verifyStandardWebhook, verifyTimestampedSignature, webhookSignatureFailure };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as credentials, i as createWorker, n as WorkerOptions, o as WorkerAssetsOptions, r as WorkerRuntime, t as RpcMethods } from "../chunks/workers-types-
|
|
1
|
+
import { a as credentials, i as createWorker, n as WorkerOptions, o as WorkerAssetsOptions, r as WorkerRuntime, t as RpcMethods } from "../chunks/workers-types-Cxf-5cH7.js";
|
|
2
2
|
export { RpcMethods, type WorkerAssetsOptions, WorkerOptions, WorkerRuntime, createWorker, credentials };
|
package/dist/workers/runtime.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arbol-ai/maximus",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.5.0",
|
|
4
4
|
"description": "Maximus: define a service once and serve it over HTTP, MCP and Worker RPC on Cloudflare Workers, configured in vite.config.ts, with its OpenAPI and CLI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -63,6 +63,10 @@
|
|
|
63
63
|
"types": "./dist/body.d.ts",
|
|
64
64
|
"import": "./dist/body.js"
|
|
65
65
|
},
|
|
66
|
+
"./client": {
|
|
67
|
+
"types": "./dist/client.d.ts",
|
|
68
|
+
"import": "./dist/client.js"
|
|
69
|
+
},
|
|
66
70
|
"./webhooks": {
|
|
67
71
|
"types": "./dist/webhooks.d.ts",
|
|
68
72
|
"import": "./dist/webhooks.js"
|
|
@@ -91,6 +95,10 @@
|
|
|
91
95
|
"types": "./dist/mcp/index.d.ts",
|
|
92
96
|
"import": "./dist/mcp/index.js"
|
|
93
97
|
},
|
|
98
|
+
"./mcp/tasks": {
|
|
99
|
+
"types": "./dist/mcp/tasks.d.ts",
|
|
100
|
+
"import": "./dist/mcp/tasks.js"
|
|
101
|
+
},
|
|
94
102
|
"./analytics": {
|
|
95
103
|
"types": "./dist/analytics/analytics.d.ts",
|
|
96
104
|
"import": "./dist/analytics/analytics.js"
|
|
@@ -134,12 +142,16 @@
|
|
|
134
142
|
},
|
|
135
143
|
"dependencies": {
|
|
136
144
|
"@modelcontextprotocol/server": "2.4.0",
|
|
137
|
-
"@
|
|
145
|
+
"@scalar/openapi-parser": "0.29.20",
|
|
138
146
|
"ajv-formats": "3.0.1",
|
|
139
|
-
"jose": "6.2.13"
|
|
147
|
+
"jose": "6.2.13",
|
|
148
|
+
"rou3": "1.0.0",
|
|
149
|
+
"standardwebhooks": "1.1.1",
|
|
150
|
+
"typebox": "1.4.5"
|
|
140
151
|
},
|
|
141
152
|
"devDependencies": {
|
|
142
153
|
"@cloudflare/vite-plugin": "2.0.0-beta.v.5",
|
|
154
|
+
"@modelcontextprotocol/ext-tasks": "0.2.3",
|
|
143
155
|
"@types/pg": "8.23.1",
|
|
144
156
|
"ajv": "8.20.0",
|
|
145
157
|
"cf": "1.0.0-beta.23",
|
package/skills/maximus/SKILL.md
CHANGED
|
@@ -66,7 +66,7 @@ each one.
|
|
|
66
66
|
| `bunx maximus gen route get /v1/notes/{noteId} --tool get_note` | Writes `routes/v1/notes/[noteId].get.ts`, which is also the MCP tool `get_note`. |
|
|
67
67
|
| `bunx maximus gen tool summarize-notes` | Writes `mcp/tools/summarize-notes.ts`, the tool `summarize_notes`. |
|
|
68
68
|
| `bunx maximus prepare` | Writes `.maximus/` for production, or with `--mode development` as `vp dev` does. `vp dev`, `vp build` and `vp test` prepare by themselves. |
|
|
69
|
-
| `bunx maximus openapi` | Writes `openapi.json`, and `openapi.rpc.json` when a route declares `rpc`; `--check` fails
|
|
69
|
+
| `bunx maximus openapi` | Writes `openapi.json`, and `openapi.rpc.json` when a route declares `rpc`; `--check` fails on a stale or invalid file. |
|
|
70
70
|
| `bun run test` | `vp test run`: the tests, in Node. |
|
|
71
71
|
| `bun run typecheck` | `maximus prepare`, then `tsc`, which also checks type tests. |
|
|
72
72
|
| `bun run check`, `bun run fix` | Lint and format; with fixes. |
|
|
@@ -98,7 +98,8 @@ Every `maximus` command says what it did in a sentence; `--json` prints it as JS
|
|
|
98
98
|
| Data in Postgres | `withTenantTransaction` from `@arbol-ai/maximus/postgres`. |
|
|
99
99
|
| A record of every call, for audit or a lake | `capture.ts` with `defineCapture` from `@arbol-ai/maximus/capture`; mark credential fields `secret: true`. See [Capture](https://github.com/getarbol/maximus/blob/main/docs/guides/capture.md). |
|
|
100
100
|
| Guidance agents read over MCP | `mcp/instructions.md`, `mcp/guides/<name>.md`, `mcp/skills/<name>.md`: static text for every caller, never tenant data. |
|
|
101
|
-
| A
|
|
101
|
+
| A service on 8.2 or earlier | [Upgrading to 8.3](https://github.com/getarbol/maximus/blob/main/docs/upgrading-to-8.3.md): TypeBox 1.x. |
|
|
102
|
+
| A 7.x service | [Upgrading to 8.0](https://github.com/getarbol/maximus/blob/main/docs/upgrading-to-8.md), then to 8.3. |
|
|
102
103
|
|
|
103
104
|
## Rules that are never broken
|
|
104
105
|
|
|
@@ -106,7 +107,8 @@ Every `maximus` command says what it did in a sentence; `--json` prints it as JS
|
|
|
106
107
|
`principal.organizationId`. Never take an organization from input, a header or a path.
|
|
107
108
|
- **Schemas are strict.** Inputs and outputs are strict objects or unions of strict objects: fields given as
|
|
108
109
|
`input: { … }` make one; a `t.Object` needs `{ additionalProperties: false }`. A shared entity has a
|
|
109
|
-
PascalCase `$id`. Use the shared schemas (`UuidSchema`, `EmailAddressSchema`, …) rather than copies
|
|
110
|
+
PascalCase `$id`. Use the shared schemas (`UuidSchema`, `EmailAddressSchema`, …) rather than copies, and
|
|
111
|
+
describe a use with TypeBox's `t.With(schema, { description })`, never by spreading the schema.
|
|
110
112
|
- **Each value is checked once, where it enters.** Maximus checks an operation's input and output; a handler
|
|
111
113
|
never parses its input again. Data from outside the pipeline, such as a stored record, a provider's
|
|
112
114
|
answer or a model's output, goes through `readSchema` or `checkSchema`. No casts, trust flags or no-op
|
|
@@ -127,7 +129,8 @@ Every `maximus` command says what it did in a sentence; `--json` prints it as JS
|
|
|
127
129
|
- **Worker code reads `env`, never `process.env`.** A secret is `bindings.secret()`. The development token is
|
|
128
130
|
never declared in `env` and never set on a deployed Worker.
|
|
129
131
|
- **Outbound calls:** a Worker's `fetch(…, { redirect: 'error' })` throws before it sends anything. Send with
|
|
130
|
-
`redirect: 'manual'` and refuse a `3xx`.
|
|
132
|
+
`redirect: 'manual'` and refuse a `3xx`. A URL someone else gave you, such as a customer's server, passes
|
|
133
|
+
`publicDestination(url)` from `@arbol-ai/maximus/body` first.
|
|
131
134
|
- **Generated code stays generated.** Never edit `.maximus/`: change the source files or `vite.config.ts`.
|
|
132
135
|
- **Refusals are guidance.** `maximus prepare`, `maximus()` and the application's `.build()` refuse a broken
|
|
133
136
|
project with a message that names the rule and the file or operation. Fix the declaration; never loosen
|
|
@@ -101,6 +101,7 @@ object, and its handler may return nothing.
|
|
|
101
101
|
| `http` | `successStatus` (200, 201 or 202), `body: 'bytes'`, `headers`, `response: 'attachment'`. |
|
|
102
102
|
| `mcp` | `{ name, idempotent?, openWorld? }`: also an MCP tool. `openWorld` is `true` unless declared. |
|
|
103
103
|
| `rpc` | `true` for every caller in `rpc.callers`, or `{ callers }` for some of them. |
|
|
104
|
+
| `task` | `true` or `{ ttlMs }`: a call that outlasts one second answers a task (MCP Tasks, or `Prefer: respond-async`); needs `MAXIMUS_TASKS`. |
|
|
104
105
|
| `maxBodyBytes`, `maxOutputBytes` | Its own limits, up to 16 MiB; the application's (32 KiB and 256 KiB) otherwise. |
|
|
105
106
|
|
|
106
107
|
A field no operation has does not compile, and `.build()` refuses it. A contract kept in a `const` keeps
|
|
@@ -128,6 +129,11 @@ browsers can import):
|
|
|
128
129
|
`HttpsUrlSchema`, `HexColorSchema`, `PostalAddressSchema`, `NamedReferenceSchema`, `SignedUrlSchema`,
|
|
129
130
|
`DeletedObjectSchema`, `EmptyInputSchema`.
|
|
130
131
|
- Absent values in an output are `t.Union([X, t.Null()])`: answer every field.
|
|
132
|
+
- `t` is TypeBox 1.x, which keeps what makes a schema optional, a codec (`t.Codec`) or a refinement
|
|
133
|
+
(`t.Refine`) in properties a spread drops: give a schema a description with
|
|
134
|
+
`t.With(schema, { description })`, never `{ ...schema, description }`. Spreading a record of fields
|
|
135
|
+
(`{ ...PageQueryFields, done: t.Boolean() }`) is safe. A recursive schema is
|
|
136
|
+
`t.Cyclic({ Node: … t.Ref('Node') … }, 'Node')`.
|
|
131
137
|
- `secret: true` on a schema marks a value capture never records, such as `t.String({ secret: true })`. It
|
|
132
138
|
changes nothing a caller or a handler sees.
|
|
133
139
|
- Codecs from `@arbol-ai/maximus/schemas` (`normalizeSchema`, `transformSchema`, `refineSchema`,
|
|
@@ -172,7 +178,9 @@ export default defineHandler(
|
|
|
172
178
|
`PageQueryFields` are `cursor`, `direction` (`forward` or `backward`) and `limit` (25 by default, at most
|
|
173
179
|
100; `pageLimit({ maximum })` lowers it). The answer is `{ object: 'list', data, pageInfo }`, whose
|
|
174
180
|
`pageInfo` holds `hasNextPage`, `hasPreviousPage`, `nextCursor` and `previousCursor`. Spread the fields
|
|
175
|
-
beside a list's own filters: `{ ...PageQueryFields, text: t.String() }`.
|
|
181
|
+
beside a list's own filters: `{ ...PageQueryFields, text: t.String() }`. A list the service holds whole is
|
|
182
|
+
cut with `cutPage(items, { key: (item) => [item.createdAt, item.id], order: 'desc' }, input)`: never write
|
|
183
|
+
cursors or offsets by hand. It answers `undefined` for a cursor it did not make; answer your own failure.
|
|
176
184
|
|
|
177
185
|
## Byte bodies and attachments
|
|
178
186
|
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { t as isRecord } from "./record-DQUDTpEA.js";
|
|
2
|
-
|
|
3
|
-
// src/internal/http-routes.ts
|
|
4
|
-
/**
|
|
5
|
-
* The parameter's schema in an object input, or in each member of a union. Every one must declare the
|
|
6
|
-
* parameter as a required string field, or this throws a TypeError.
|
|
7
|
-
*/
|
|
8
|
-
function pathParameterSchemas(input, parameter) {
|
|
9
|
-
if (input.type === "object") {
|
|
10
|
-
const schema = input.properties?.[parameter];
|
|
11
|
-
if (!schema || schema.type !== "string" || !input.required?.includes(parameter)) throw new TypeError(`Path parameter "${parameter}" must be a required string input field.`);
|
|
12
|
-
return [schema];
|
|
13
|
-
}
|
|
14
|
-
if (Array.isArray(input.anyOf) && input.anyOf.length > 0) return input.anyOf.flatMap((schema) => pathParameterSchemas(schema, parameter));
|
|
15
|
-
throw new TypeError("Path parameters require object input contracts.");
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* The group a route's path names, which OpenAPI publishes as its tag: its first fixed segment after the
|
|
19
|
-
* version, in words, such as `Notes` for `/v1/notes/{noteId}` and `Task lists` for `/v1/task-lists`;
|
|
20
|
-
* undefined when only parameters follow the version.
|
|
21
|
-
*/
|
|
22
|
-
function routeGroup(path) {
|
|
23
|
-
const segments = path.split("/").filter(Boolean);
|
|
24
|
-
const segment = (/^v[1-9][0-9]*$/.test(segments[0] ?? "") ? segments.slice(1) : segments).find((part) => !part.startsWith("{"));
|
|
25
|
-
if (segment === void 0) return;
|
|
26
|
-
const words = segment.replaceAll(/([a-z0-9])([A-Z])/g, "$1 $2").split(/[\s_-]+/).filter(Boolean).join(" ").toLowerCase();
|
|
27
|
-
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// src/result.ts
|
|
31
|
-
/** A success carrying `value`. */
|
|
32
|
-
function ok(value) {
|
|
33
|
-
return {
|
|
34
|
-
ok: true,
|
|
35
|
-
value
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
/** A failure carrying `error`, usually `catalog.someFailure.create()`. */
|
|
39
|
-
function err(error) {
|
|
40
|
-
return {
|
|
41
|
-
ok: false,
|
|
42
|
-
error
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Whether an untrusted answer (a Service Binding's, a stored one) is a Maximus Result: a success with
|
|
47
|
-
* its value, or a failure with a well-formed error. Anything else is not an answer at all.
|
|
48
|
-
*/
|
|
49
|
-
function isResult(value) {
|
|
50
|
-
if (!isRecord(value)) return false;
|
|
51
|
-
if (value.ok === true) return "value" in value;
|
|
52
|
-
const { error } = value;
|
|
53
|
-
return value.ok === false && isRecord(error) && typeof error.code === "string" && typeof error.message === "string" && typeof error.retryable === "boolean" && isRecord(error.data);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export { routeGroup as a, pathParameterSchemas as i, isResult as n, ok as r, err as t };
|