@arbol-ai/maximus 8.0.1 → 8.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/analytics/analytics.d.ts +16 -16
  2. package/dist/analytics/analytics.js +4 -4
  3. package/dist/body.d.ts +2 -2
  4. package/dist/body.js +2 -2
  5. package/dist/capture/index.d.ts +37 -0
  6. package/dist/capture/index.js +181 -0
  7. package/dist/chunks/{define-app-x7uY70_1.js → define-app-CQpWqqqE.js} +44 -14
  8. package/dist/chunks/delay-BsKQP_lF.js +12 -0
  9. package/dist/chunks/{json-B14evE6-.js → destination-DIkn8W6K.js} +65 -1
  10. package/dist/chunks/digest-C51F1bhA.js +12 -0
  11. package/dist/chunks/{errors-C5w9WY1l.js → errors-BoutSmiy.js} +2 -3
  12. package/dist/chunks/execution-Bpq6s4nA.js +265 -0
  13. package/dist/chunks/{generate-C-9FKW0o.js → generate-Dg88LzLU.js} +1 -1
  14. package/dist/chunks/{handler-iebR-urt.js → handler-DSpyrWc-.js} +6 -2
  15. package/dist/chunks/{http-layout-DS8DnPyu.js → http-layout-BcYH4I2w.js} +1 -1
  16. package/dist/chunks/{http-paths-DMBxwpp6.js → http-paths-D043DkJv.js} +50 -81
  17. package/dist/chunks/http-routes-B6tCsnxB.js +29 -0
  18. package/dist/chunks/{openapi-CeolxIqa.js → openapi-D2rds7vy.js} +32 -130
  19. package/dist/chunks/{openapi-file-Bz9FRaE6.js → openapi-file-BK8zET5U.js} +24 -6
  20. package/dist/chunks/{pages-iZTvFs5a.js → pages-B7ysoFAM.js} +1 -1
  21. package/dist/chunks/result-CF4OzG9O.js +29 -0
  22. package/dist/chunks/{runtime-D94vx21X.js → runtime-CGtS2rOb.js} +165 -11
  23. package/dist/chunks/schemas-_UJcx_uY.js +813 -0
  24. package/dist/chunks/{server-Bzf1Q1_4.js → server-CVhTLNj2.js} +38 -101
  25. package/dist/chunks/{src-CPrJpbOM.js → src-D67OfW9B.js} +94 -27
  26. package/dist/chunks/tasks-C873C3le.js +100 -0
  27. package/dist/chunks/tasks-DYdY-dBI.js +267 -0
  28. package/dist/chunks/{telemetry-C3LfZcOB.js → telemetry-BtxJh69Q.js} +4 -4
  29. package/dist/chunks/{types-DTIuIEJ-.d.ts → types-BfGa2aJT.d.ts} +537 -124
  30. package/dist/chunks/validation-CpzAxj2_.js +201 -0
  31. package/dist/chunks/{workers-types-BRk_Xa_5.d.ts → workers-types-Cxf-5cH7.d.ts} +6 -1
  32. package/dist/diagnostics.d.ts +1 -1
  33. package/dist/diagnostics.js +1 -1
  34. package/dist/errors.d.ts +1 -1
  35. package/dist/errors.js +1 -1
  36. package/dist/http-paths.d.ts +1 -1
  37. package/dist/http-paths.js +1 -1
  38. package/dist/index.d.ts +2 -2
  39. package/dist/index.js +12 -11
  40. package/dist/internals.d.ts +2 -2
  41. package/dist/internals.js +6 -6
  42. package/dist/mcp/index.d.ts +1 -1
  43. package/dist/mcp/index.js +1 -1
  44. package/dist/mcp/tasks.d.ts +33 -0
  45. package/dist/mcp/tasks.js +3 -0
  46. package/dist/project/config.d.ts +2 -2
  47. package/dist/project/config.js +3 -2
  48. package/dist/project/index.d.ts +2 -2
  49. package/dist/project/index.js +3 -3
  50. package/dist/schemas.d.ts +2 -2
  51. package/dist/schemas.js +3 -3
  52. package/dist/standard-failures.d.ts +1 -1
  53. package/dist/tooling/cli.js +2 -2
  54. package/dist/vite/index.d.ts +2 -2
  55. package/dist/vite/index.js +15 -9
  56. package/dist/webhooks.d.ts +13 -2
  57. package/dist/webhooks.js +38 -1
  58. package/dist/workers/runtime.d.ts +1 -1
  59. package/dist/workers/runtime.js +1 -1
  60. package/package.json +15 -3
  61. package/skills/maximus/SKILL.md +14 -4
  62. package/skills/maximus/references/project.md +4 -0
  63. package/skills/maximus/references/routes-and-tools.md +11 -1
  64. package/templates/project/CLAUDE.md.template +3 -3
  65. package/templates/project/README.md.template +1 -0
  66. package/templates/project/tsconfig.json.template +1 -0
  67. package/dist/chunks/execution-rOiLo8VG.js +0 -84
  68. package/dist/chunks/result-CKgZHrnj.js +0 -56
  69. package/dist/chunks/schemas-p_aRcMC1.js +0 -227
  70. package/dist/chunks/validation-fTohBT6R.js +0 -420
@@ -0,0 +1,201 @@
1
+ import "ajv-formats/dist/formats.js";
2
+ import "typebox/format";
3
+ import "typebox/system";
4
+ import { AssertError, DecodeUnsafe, HasCodec, Value } from "typebox/value";
5
+
6
+ // src/internal/decode-issues.ts
7
+ /** Every issue of a refused value, as `readSchema` throws it and `checkSchema` returns it. */
8
+ var SchemaValidationError = class extends TypeError {
9
+ /** Every issue of the refused value; the error's message is the first one's. */
10
+ issues;
11
+ constructor(issues) {
12
+ super(issues[0]?.message ?? "The input does not match its schema.");
13
+ this.name = "SchemaValidationError";
14
+ this.issues = issues;
15
+ }
16
+ };
17
+ /**
18
+ * What an owner refinement's message starts with when it carries issues of its own, as JSON, or the errors of
19
+ * the schema a pipe reads its value into: TypeBox reports a refinement as one message at the refined value.
20
+ */
21
+ const CARRIED = "\0maximus:";
22
+ /** A refinement's message that carries issues at their paths below the refined value. */
23
+ function carriedIssues(issues) {
24
+ return `${CARRIED}${JSON.stringify(issues)}`;
25
+ }
26
+ /** A refinement's message that carries the errors of another schema, read below the refined value. */
27
+ function carriedErrors(errors) {
28
+ return carriedIssues(schemaIssues(errors));
29
+ }
30
+ /** The segments of a JSON Pointer, unescaped. */
31
+ function segments(path) {
32
+ return path.split("/").slice(1).map((part) => part.replaceAll("~1", "/").replaceAll("~0", "~"));
33
+ }
34
+ /** The issues of a refinement's error at its value's path: those it carries, or its own message. */
35
+ function refinementIssues(message, path) {
36
+ if (!message.startsWith(CARRIED)) return [{
37
+ code: "custom",
38
+ message,
39
+ path
40
+ }];
41
+ return JSON.parse(message.slice(9)).map((issue) => ({
42
+ ...issue,
43
+ path: [...path, ...issue.path]
44
+ }));
45
+ }
46
+ /**
47
+ * Field issues for TypeBox's errors, in their order. A missing or an unexpected property is an issue at its own
48
+ * path; a union that matched no member is one issue, its members' errors left out; a refinement is the issues
49
+ * it carries, or its message.
50
+ */
51
+ function schemaIssues(errors) {
52
+ const unions = errors.filter((error) => error.keyword === "anyOf").map(({ schemaPath }) => `${schemaPath}/anyOf/`);
53
+ const issues = [];
54
+ for (const error of errors) {
55
+ if (unions.some((union) => error.schemaPath.startsWith(union))) continue;
56
+ const path = segments(error.instancePath);
57
+ if (error.keyword === "required") for (const name of error.params.requiredProperties) issues.push({
58
+ code: "invalid_input",
59
+ message: "must be present",
60
+ path: [...path, name]
61
+ });
62
+ else if (error.keyword === "additionalProperties") for (const name of error.params.additionalProperties) issues.push({
63
+ code: "invalid_input",
64
+ message: "must not be present",
65
+ path: [...path, name]
66
+ });
67
+ else if (error.keyword === "~refine") issues.push(...refinementIssues(error.params.message, path));
68
+ else if (!(error.keyword === "boolean" && error.schemaPath.endsWith("/additionalProperties"))) issues.push({
69
+ code: "invalid_input",
70
+ message: error.message,
71
+ path
72
+ });
73
+ }
74
+ return issues;
75
+ }
76
+ /**
77
+ * The issues of a refused decode, at most `limit`, each with its path from the input's root, or null when
78
+ * nothing refused the input: an owner codec threw something other than a `SchemaValidationError`, which is the
79
+ * codec's fault for the caller to report. TypeBox builds at most as many errors as `internal/value.ts` allows,
80
+ * so an input with millions of them costs no more than a refusal carries.
81
+ */
82
+ function decodeIssues(error, limit = Number.POSITIVE_INFINITY) {
83
+ if (error instanceof SchemaValidationError) return error.issues.slice(0, limit);
84
+ if (error instanceof AssertError) return schemaIssues(error.cause.errors).slice(0, limit);
85
+ return null;
86
+ }
87
+ /** RFC 6901 JSON Pointer of an issue path; the empty string names the whole input. */
88
+ function jsonPointer(path) {
89
+ return path.map((part) => `/${String(part).replaceAll("~", "~0").replaceAll("/", "~1")}`).join("");
90
+ }
91
+
92
+ // src/validation.ts
93
+ /**
94
+ * Checks a value against a schema without decoding it: the value when it matches, else an `INVALID_INPUT`
95
+ * failure without issues. Use `decodeInput` for input with defaults and codecs.
96
+ */
97
+ function parseInput(schema, input) {
98
+ if (Value.Check(schema, input)) return {
99
+ ok: true,
100
+ value: input
101
+ };
102
+ return {
103
+ ok: false,
104
+ error: {
105
+ code: "INVALID_INPUT",
106
+ message: "The input does not match its schema.",
107
+ retryable: false,
108
+ data: {}
109
+ }
110
+ };
111
+ }
112
+ /** Checks a value against a schema and returns it typed, or throws a TypeError that names no value. */
113
+ function parseSchema(schema, input) {
114
+ if (!Value.Check(schema, input)) throw new TypeError("Value does not match its schema");
115
+ return input;
116
+ }
117
+ /**
118
+ * Whether a value is a bounded plain JSON tree, which TypeBox's traversals expect and every transport admits:
119
+ * no cycles, class instances, functions, non-finite numbers, nesting beyond 100 levels or own `__proto__` key.
120
+ */
121
+ function boundedInput(value, depth = 0, parents = /* @__PURE__ */ new Set()) {
122
+ if (depth > 100) return false;
123
+ if (value === void 0 || value === null || typeof value === "string" || typeof value === "boolean") return true;
124
+ if (typeof value === "number") return Number.isFinite(value);
125
+ if (typeof value !== "object" || parents.has(value)) return false;
126
+ if (!Array.isArray(value) && Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) return false;
127
+ if (Object.hasOwn(value, "__proto__")) return false;
128
+ parents.add(value);
129
+ const valid = Object.values(value).every((child) => boundedInput(child, depth + 1, parents));
130
+ parents.delete(value);
131
+ return valid;
132
+ }
133
+ /**
134
+ * Decodes input against its schema: admits only a bounded plain JSON tree, applies the declared defaults to a
135
+ * copy, checks it, refinements included, and runs its codecs. Throws a `SchemaValidationError` (or TypeBox's
136
+ * assertion error) when the input is refused, and whatever an owner codec throws otherwise. Output is checked,
137
+ * never decoded: what a handler returns must already be canonical.
138
+ */
139
+ function decodeSchema(schema, input) {
140
+ return admitSchema(schema, input).value;
141
+ }
142
+ /** Decodes input as `decodeSchema` does, and also answers what the schema checked, before any codec ran. */
143
+ function admitSchema(schema, input) {
144
+ if (!boundedInput(input)) throw new SchemaValidationError([{
145
+ code: "invalid_input",
146
+ message: "Input must be a bounded plain JSON tree.",
147
+ path: []
148
+ }]);
149
+ const checked = Value.Default(schema, Value.Clone(input));
150
+ Value.Assert(schema, checked);
151
+ return {
152
+ value: HasCodec(schema) ? DecodeUnsafe({}, schema, Value.Clone(checked)) : checked,
153
+ checked
154
+ };
155
+ }
156
+ /** The longest path or message one issue carries. */
157
+ const MAX_ISSUE_TEXT = 256;
158
+ /**
159
+ * Decodes input as `decodeSchema` does and answers a refusal as the `INVALID_INPUT` failure, with its first
160
+ * field issues: where the input failed and what was expected, never a value. A fault of an owner codec, an
161
+ * error that refuses nothing, is thrown for the caller to report: it is the server's failure, not the input's.
162
+ */
163
+ function decodeInput(schema, input) {
164
+ const admitted = admitInput(schema, input);
165
+ return admitted.ok ? {
166
+ ok: true,
167
+ value: admitted.value
168
+ } : admitted;
169
+ }
170
+ /**
171
+ * `decodeInput`, also answering, for an admitted input, `checked`: the plain JSON its schema checked before any
172
+ * codec ran, the one shape the schema's own keywords describe.
173
+ */
174
+ function admitInput(schema, input) {
175
+ let admitted;
176
+ try {
177
+ admitted = admitSchema(schema, input);
178
+ } catch (error) {
179
+ const refused = decodeIssues(error, 10);
180
+ if (!refused) throw error;
181
+ return {
182
+ ok: false,
183
+ error: {
184
+ code: "INVALID_INPUT",
185
+ message: "The input does not match its schema.",
186
+ retryable: false,
187
+ data: { issues: refused.map((issue) => ({
188
+ path: jsonPointer(issue.path).slice(0, MAX_ISSUE_TEXT),
189
+ message: issue.message.slice(0, MAX_ISSUE_TEXT)
190
+ })) }
191
+ }
192
+ };
193
+ }
194
+ return {
195
+ ok: true,
196
+ value: admitted.value,
197
+ checked: admitted.checked
198
+ };
199
+ }
200
+
201
+ export { parseSchema as a, carriedIssues as c, HasCodec as d, Value as f, parseInput as i, decodeIssues as l, decodeInput as n, SchemaValidationError as o, decodeSchema as r, carriedErrors as s, admitInput as t, DecodeUnsafe as u };
@@ -1,4 +1,4 @@
1
- import { Bn as Principal, D as HttpRoute, E as HttpOptions, Qn as Result, i as TSchema, pn as OperationShape, r as Static, rn as AppManifest, ur as Failure } from "./types-DTIuIEJ-.js";
1
+ import { D as HttpRoute, E as HttpOptions, cr as Principal, dn as AppManifest, jr as Failure, n as Static, r as TSchema, un as TaskStore, xn as OperationShape, yr as Result } from "./types-BfGa2aJT.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 {
@@ -101,6 +101,11 @@ interface WorkerRuntime<E, O extends Record<string, OperationShape>> {
101
101
  * methods and type.
102
102
  */
103
103
  durableObject: <T extends DurableObject<E>, D extends new (state: DurableObject['ctx'], env: E) => T>(implementation: D) => D;
104
+ /**
105
+ * The task store of the operations that declare `task: true`: export it by name, `MaximusTasks`, as the class
106
+ * of a SQLite Durable Object binding named `MAXIMUS_TASKS`.
107
+ */
108
+ tasks: new (state: DurableObject['ctx'], env: E) => DurableObject<E> & TaskStore;
104
109
  }
105
110
  /**
106
111
  * What `createWorker` takes besides the application: the Worker's other handlers, its transports, the HTTP
@@ -1,4 +1,4 @@
1
- import { Cn as TelemetryConfig, Dn as telemetryEnabled, En as reportUnexpected, On as withDiagnostics, Sn as Observer, Tn as recordExecution, _r as TraceParent, bn as BackgroundContext, br as isRequestId, gr as DurableCorrelation, vr as createRequestId, wn as diagnosticsEnabled, xn as ExecutionObservation, xr as parseTraceParent, yr as durableCorrelation } from "./chunks/types-DTIuIEJ-.js";
1
+ import { Bn as BackgroundContext, Br as durableCorrelation, Gn as recordExecution, Hn as Observer, Hr as parseTraceParent, Jn as withDiagnostics, Kn as reportUnexpected, Lr as DurableCorrelation, Rr as TraceParent, Un as TelemetryConfig, Vn as ExecutionObservation, Vr as isRequestId, Wn as diagnosticsEnabled, qn as telemetryEnabled, zr as createRequestId } from "./chunks/types-BfGa2aJT.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.
@@ -1,4 +1,4 @@
1
1
  import { i as parseTraceParent, n as durableCorrelation, r as isRequestId, t as createRequestId } from "./chunks/correlation-4b23a-a4.js";
2
- import { a as telemetryEnabled, c as createDiagnostics, i as reportUnexpected, o as withDiagnostics, r as recordExecution, t as diagnosticsEnabled } from "./chunks/telemetry-C3LfZcOB.js";
2
+ import { a as recordExecution, c as withDiagnostics, n as diagnosticsEnabled, o as reportUnexpected, s as telemetryEnabled, u as createDiagnostics } from "./chunks/telemetry-BtxJh69Q.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 { ar as CreateArguments, br as isRequestId, cr as ErrorDefinition, dr as FailureData, fr as FailureSchema, hr as standardErrors, lr as ErrorFactory, mr as resultSchema, or as DefinedErrors, pr as defineErrors, sr as ErrorCatalog, ur as Failure } from "./chunks/types-DTIuIEJ-.js";
1
+ import { Ar as ErrorFactory, Dr as DefinedErrors, Er as CreateArguments, Fr as resultSchema, Ir as standardErrors, Mr as FailureData, Nr as FailureSchema, Or as ErrorCatalog, Pr as defineErrors, Vr as isRequestId, jr as Failure, kr as ErrorDefinition } from "./chunks/types-BfGa2aJT.js";
2
2
  export { CreateArguments, DefinedErrors, ErrorCatalog, ErrorDefinition, ErrorFactory, Failure, FailureData, FailureSchema, defineErrors, isRequestId, resultSchema, standardErrors };
package/dist/errors.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { r as isRequestId } from "./chunks/correlation-4b23a-a4.js";
2
- import { i as standardErrors, n as defineErrors, r as resultSchema, t as FailureSchema } from "./chunks/errors-C5w9WY1l.js";
2
+ import { i as standardErrors, n as defineErrors, r as resultSchema, t as FailureSchema } from "./chunks/errors-BoutSmiy.js";
3
3
 
4
4
  export { FailureSchema, defineErrors, isRequestId, resultSchema, standardErrors };
@@ -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-DTIuIEJ-.js";
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-BfGa2aJT.js";
2
2
  export { HttpRouteDefinition, HttpRouteMatch, createHttpRouteResolver, decodePathParameter, isInputHeaderName, isPathParameterValue, operationPathParameters };
@@ -1,3 +1,3 @@
1
- import { a as operationPathParameters, i as isPathParameterValue, n as decodePathParameter, r as isInputHeaderName, t as createHttpRouteResolver } from "./chunks/http-paths-DMBxwpp6.js";
1
+ import { a as operationPathParameters, i as isPathParameterValue, n as decodePathParameter, r as isInputHeaderName, t as createHttpRouteResolver } from "./chunks/http-paths-D043DkJv.js";
2
2
 
3
3
  export { createHttpRouteResolver, decodePathParameter, isInputHeaderName, isPathParameterValue, operationPathParameters };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as PageInfo, $n as Success, A as TransportContext, An as TokenAlgorithm, At as ContextArguments, B as DeletedObject, Bn as Principal, Bt as HandlerOptions, Cn as TelemetryConfig, D as HttpRoute, Dt as parseInput, E as HttpOptions, En as reportUnexpected, Fn as TokenScheme, Ft as HandlerAnswer, G as NamedReference, Gn as protectedResourceMetadata, Gt as ToolDeclaration, H as EmailAddressSchema, Hn as TokenClient, Ht as RouteBody, In as TokenSource, It as HandlerArguments, J as PostalAddress, Jt as defineContext, K as NamedReferenceSchema, Kn as ScopeMatch, Kt as ToolOptions, Ln as createTokenAuthorization, Lt as HandlerDeclaration, M as projectAccessToken, Mn as TokenDevelopment, Mt as DomainCode, N as EmptyInputSchema, Nn as TokenPolicy, Nt as Fail, O as HttpTransport, Ot as parseSchema, P as OrganizationIdSchema, Pn as TokenResolutionContext, Pt as Failed, Q as Page, Qn as Result, R as UuidSchema, Rn as createTokenVerifier, Rt as HandlerHttp, Sn as Observer, T as HttpMiddleware, U as HexColorSchema, Un as TokenPrincipal, Ut as SchemaOf, V as DeletedObjectSchema, Vn as PrincipalSchema, Vt as PreparedContext, W as HttpsUrlSchema, Wn as OAuthResource, Wt as SchemaOrFields, X as SignedUrl, Xn as BodyFailure, Xt as defineTelemetry, Y as PostalAddressSchema, Yn as BinaryBody, Yt as defineHandler, Z as SignedUrlSchema, Zn as FailureResult, Zt as defineTool, _ as readBodyText, _n as operationMatchesScopes, a as Type, an as Invocation, b as createHttpRouteResolver, bn as BackgroundContext, c as createRpcOpenApi, cn as McpGuide, cr as ErrorDefinition, d as readJsonResponse, dn as OperationMiddleware, dr as FailureData, en as ApplicationBuilder, er as err, et as PageInfoSchema, f as retryAfterSeconds, fn as OperationScope, fr as FailureSchema, g as readBodyBytes, h as HttpBodyFailureReason, hn as isPublicOperation, hr as standardErrors, i as TSchema, in as Exposure, ir as AttachmentOutputSchema, it as pageLimit, j as createHttpHandler, jn as TokenClaims, jt as ContextDeclaration, k as RouteContext, kn as TokenAccess, kt as AuthOptions, l as isJsonMediaType, ln as McpSkill, lr as ErrorFactory, m as HttpBodyFailure, mr as resultSchema, nn as maximus, nr as ok, nt as PageQueryFields, o as t, on as InvocationAuthority, or as DefinedErrors, p as BodyReadOptions, pn as OperationShape, pr as defineErrors, q as PhoneNumberSchema, qn as matchesScopes, qt as defineAuth, r as Static, rn as AppManifest, rr as Attachment, rt as TPage, s as createOpenApi, sn as McpConfiguration, sr as ErrorCatalog, tn as ApplicationConfiguration, tr as isResult, tt as PageQuery, u as readJsonBody, ur as Failure, v as HttpRouteDefinition, vn as operationScopes, xn as ExecutionObservation, y as HttpRouteMatch, yn as AdmissionObservation, zn as projectToken, zt as HandlerMcp } from "./chunks/types-DTIuIEJ-.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 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,14 @@
1
- import { i as parseSchema, r as parseInput } from "./chunks/validation-fTohBT6R.js";
2
- import { i as standardErrors, n as defineErrors, r as resultSchema, t as FailureSchema } from "./chunks/errors-C5w9WY1l.js";
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-DMBxwpp6.js";
5
- import { n as isResult, r as ok, t as err } from "./chunks/result-CKgZHrnj.js";
6
- import { E as isPublicOperation, N as matchesScopes, _ as projectAccessToken, a as createTokenVerifier, i as createTokenAuthorization, j as operationScopes, k as operationMatchesScopes, n as createRpcOpenApi, o as projectToken, t as createOpenApi, y as PrincipalSchema } from "./chunks/openapi-CeolxIqa.js";
7
- import { _ as pageLimit, 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 AttachmentOutputSchema } from "./chunks/schemas-p_aRcMC1.js";
8
- import { a as maximus, i as protectedResourceMetadata, n as t, r as createHttpHandler, t as Type } from "./chunks/src-CPrJpbOM.js";
9
- import { a as defineTelemetry, i as defineHandler, n as defineAuth, o as defineTool, r as defineContext } from "./chunks/handler-iebR-urt.js";
10
- import { i as reportUnexpected } from "./chunks/telemetry-C3LfZcOB.js";
11
- import { a as retryAfterSeconds, i as readJsonResponse, r as readJsonBody, t as isJsonMediaType } from "./chunks/json-B14evE6-.js";
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-D67OfW9B.js";
10
+ import { a as defineTelemetry, i as defineHandler, n as defineAuth, o as defineTool, r as defineContext } from "./chunks/handler-DSpyrWc-.js";
11
+ import { o as reportUnexpected } from "./chunks/telemetry-BtxJh69Q.js";
12
+ import { a as readJsonResponse, i as readJsonBody, n as isJsonMediaType, o as retryAfterSeconds, t as publicDestination } from "./chunks/destination-DIkn8W6K.js";
12
13
 
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 };
14
+ 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 };
@@ -1,2 +1,2 @@
1
- import { A as TransportContext, Cn as TelemetryConfig, Dn as telemetryEnabled, E as HttpOptions, O as HttpTransport, On as withDiagnostics, Tn as recordExecution, an as Invocation, b as createHttpRouteResolver, bn as BackgroundContext, dn as OperationMiddleware, gn as operation, mn as composeOperations, n as executeOperation, on as InvocationAuthority, pn as OperationShape, rn as AppManifest, t as defineApp, v as HttpRouteDefinition, vn as operationScopes, y as HttpRouteMatch } from "./chunks/types-DTIuIEJ-.js";
2
- export { type AppManifest, type BackgroundContext, type HttpOptions, type HttpRouteDefinition, type HttpRouteMatch, type HttpTransport, type Invocation, type InvocationAuthority, type OperationMiddleware, type OperationShape, type TelemetryConfig, type TransportContext, composeOperations, createHttpRouteResolver, defineApp, executeOperation, operation, operationScopes, recordExecution, telemetryEnabled, withDiagnostics };
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
+ 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-x7uY70_1.js";
2
- import { t as createHttpRouteResolver } from "./chunks/http-paths-DMBxwpp6.js";
3
- import { O as operation, T as composeOperations, j as operationScopes } from "./chunks/openapi-CeolxIqa.js";
4
- import { a as telemetryEnabled, o as withDiagnostics, r as recordExecution } from "./chunks/telemetry-C3LfZcOB.js";
5
- import { t as executeOperation } from "./chunks/execution-rOiLo8VG.js";
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
+ 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-Bpq6s4nA.js";
6
6
 
7
- export { composeOperations, createHttpRouteResolver, defineApp, executeOperation, operation, operationScopes, recordExecution, telemetryEnabled, withDiagnostics };
7
+ export { composeOperations, createHttpRouteResolver, defineApp, executeOperation, operation, operationScopes, recordCapture, recordExecution, telemetryEnabled, withDiagnostics };
@@ -1,4 +1,4 @@
1
- import { O as HttpTransport } from "../chunks/types-DTIuIEJ-.js";
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-Bzf1Q1_4.js");
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 };
@@ -0,0 +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-C873C3le.js";
2
+
3
+ export { TASKS_EXTENSION, attachTasks, declaresTasks, isTaskResult, mcpTask, toolResult };
@@ -1,5 +1,5 @@
1
- import { Gt as ToolDeclaration, Lt as HandlerDeclaration, T as HttpMiddleware, an as Invocation, dn as OperationMiddleware, en as ApplicationBuilder, in as Exposure, jt as ContextDeclaration, pn as OperationShape, rn as AppManifest, un as OperationHandler } from "../chunks/types-DTIuIEJ-.js";
2
- import { TSchema } from "@sinclair/typebox";
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
  /**
@@ -1,5 +1,6 @@
1
- import { a as routeGroup, r as ok, t as err } from "../chunks/result-CKgZHrnj.js";
2
- import { c as isHandlerDeclaration, l as isToolDeclaration, s as isContextDeclaration, t as Failed } from "../chunks/handler-iebR-urt.js";
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
@@ -1,5 +1,5 @@
1
- import { D as HttpRoute, pn as OperationShape, rn as AppManifest } from "../chunks/types-DTIuIEJ-.js";
2
- import { n as WorkerOptions, r as WorkerRuntime } from "../chunks/workers-types-BRk_Xa_5.js";
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. */
@@ -1,6 +1,6 @@
1
- import { i as standardErrors } from "../chunks/errors-C5w9WY1l.js";
2
- import { r as createAssetHandler, t as createWorker } from "../chunks/runtime-D94vx21X.js";
3
- import { t as checkPagePaths } from "../chunks/pages-iZTvFs5a.js";
1
+ import { i as standardErrors } from "../chunks/errors-BoutSmiy.js";
2
+ import { r as createAssetHandler, t as createWorker } from "../chunks/runtime-CGtS2rOb.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 PageInfo, B as DeletedObject, Ct as urlSchema, Dt as parseInput, Et as decodeSchema, F as Static, G as NamedReference, H as EmailAddressSchema, I as TSchema, J as PostalAddress, Jn as StaticDecode, K as NamedReferenceSchema, L as Type, N as EmptyInputSchema, Ot as parseSchema, P as OrganizationIdSchema, Q as Page, R as UuidSchema, St as transformSchema, Tt as decodeInput, U as HexColorSchema, V as DeletedObjectSchema, W as HttpsUrlSchema, X as SignedUrl, Y as PostalAddressSchema, Z as SignedUrlSchema, _t as normalizeSchema, at as Checked, bt as strictObject, ct as SchemaInput, dt as defaultSchema, et as PageInfoSchema, ft as extendObject, gt as looseObject, ht as literalUnion, ir as AttachmentOutputSchema, it as pageLimit, lt as SchemaIssue, mt as inspectSchema, nt as PageQueryFields, ot as checkSchema, pt as inputSchema, q as PhoneNumberSchema, rr as Attachment, rt as TPage, st as readSchema, tt as PageQuery, ut as SchemaValidationError, vt as pipeSchema, wt as InputIssue, xt as stripObject, yt as refineSchema, z as t } from "./chunks/types-DTIuIEJ-.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 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 };
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 { _ as refineSchema, b as transformSchema, c as defaultSchema, d as inputSchema, f as inspectSchema, g as pipeSchema, h as normalizeSchema, i as parseSchema, l as extendObject, m as looseObject, n as decodeSchema, p as literalUnion, r as parseInput, s as SchemaValidationError, t as decodeInput, v as strictObject, x as urlSchema, y as stripObject } from "./chunks/validation-fTohBT6R.js";
2
- import { _ as pageLimit, a as t, b as readSchema, 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, r as Type, s as EmailAddressSchema, t as EmptyInputSchema, u as NamedReferenceSchema, v as AttachmentOutputSchema, y as checkSchema } from "./chunks/schemas-p_aRcMC1.js";
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 };
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 { $t as StandardFailure, Qt as STANDARD_FAILURES } from "./chunks/types-DTIuIEJ-.js";
1
+ import { in as StandardFailure, rn as STANDARD_FAILURES } from "./chunks/types-BfGa2aJT.js";
2
2
  export { STANDARD_FAILURES, StandardFailure };
@@ -109,7 +109,7 @@ async function run() {
109
109
  return;
110
110
  }
111
111
  case "gen": {
112
- const { generateRoute, generateTool } = await import("../chunks/generate-C-9FKW0o.js");
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-Bz9FRaE6.js");
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
@@ -1,4 +1,4 @@
1
- import { An as TokenAlgorithm, Mn as TokenDevelopment, Nn as TokenPolicy } from "../chunks/types-DTIuIEJ-.js";
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. */
@@ -35,7 +35,7 @@ interface WebAppOptions {
35
35
  * What `vite.config.ts` states: the application's configuration, and the Worker's settings as Cloudflare
36
36
  * names them. Maximus owns the Worker's entry and, for a web app, its assets; it adds `nodejs_compat` and,
37
37
  * under `vp dev`, the development token. The code that completes the application is `errors.ts`, `auth.ts`,
38
- * `context.ts` and `telemetry.ts`.
38
+ * `context.ts`, `telemetry.ts` and `capture.ts`.
39
39
  */
40
40
  interface MaximusOptions extends Omit<WorkerConfig, 'name' | 'entrypoint' | 'env' | 'assets'> {
41
41
  /**
@@ -1,7 +1,7 @@
1
- import { t as checkMcpResourceNames } from "../chunks/define-app-x7uY70_1.js";
2
- import { a as operationPathParameters } from "../chunks/http-paths-DMBxwpp6.js";
3
- import { a as ownsPrefix, t as VERSIONED_PATH } from "../chunks/http-layout-DS8DnPyu.js";
4
- import { t as checkPagePaths } from "../chunks/pages-iZTvFs5a.js";
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";
@@ -1078,11 +1078,13 @@ function prepareProject(directory, mode, project) {
1078
1078
  const auth = rootModule(root, "auth");
1079
1079
  const context = rootModule(root, "context");
1080
1080
  const telemetry = rootModule(root, "telemetry");
1081
+ const capture = rootModule(root, "capture");
1081
1082
  for (const module of [
1082
1083
  catalog,
1083
1084
  auth,
1084
1085
  context,
1085
- telemetry
1086
+ telemetry,
1087
+ capture
1086
1088
  ]) if (module) readProjectModule(root, join(root, module), "config");
1087
1089
  const files = Object.fromEntries(PROJECT_DIRECTORIES.map((name) => [name, projectFiles(root, name, mode)]));
1088
1090
  for (const { file } of files.middleware) readProjectModule(root, file, "middleware");
@@ -1160,6 +1162,7 @@ function prepareProject(directory, mode, project) {
1160
1162
  "maximus",
1161
1163
  ...catalog ? [] : ["standardErrors"]
1162
1164
  ].join(", ")} } from '@arbol-ai/maximus';`,
1165
+ ...capture ? ["import { defineCapture } from '@arbol-ai/maximus/capture';"] : [],
1163
1166
  `import { ${context ? "bindContext, " : ""}useProjectMiddleware } from '@arbol-ai/maximus/config';`,
1164
1167
  "import { application } from './config.ts';",
1165
1168
  "import { middleware } from './middleware.ts';",
@@ -1167,13 +1170,15 @@ function prepareProject(directory, mode, project) {
1167
1170
  ...catalog ? [`import errors from ${relativeModule(catalog)};`] : [],
1168
1171
  ...auth ? [`import auth from ${relativeModule(auth)};`] : [],
1169
1172
  ...context ? [`import context from ${relativeModule(context)};`] : [],
1170
- ...telemetry ? [`import telemetry from ${relativeModule(telemetry)};`] : []
1173
+ ...telemetry ? [`import telemetry from ${relativeModule(telemetry)};`] : [],
1174
+ ...capture ? [`import capture from ${relativeModule(capture)};`] : []
1171
1175
  ], [`const configured = maximus<Env>({ ${[
1172
1176
  "...application",
1173
1177
  ...auth ? ["tokens: { ...application.tokens, ...defineAuth(auth) }"] : [],
1174
1178
  catalog ? "errors" : "errors: standardErrors",
1175
1179
  ...described ? ["mcp"] : [],
1176
- ...telemetry ? ["telemetry: defineTelemetry(telemetry)"] : []
1180
+ ...telemetry ? ["telemetry: defineTelemetry(telemetry)"] : [],
1181
+ ...capture ? ["capture: defineCapture(capture)"] : []
1177
1182
  ].join(", ")} });`, `export const base = useProjectMiddleware(${context ? "bindContext(configured, context)" : "configured"}, middleware);`]),
1178
1183
  "register.d.ts": generatedModule(mode, ["import type { base } from './base.ts';", ...catalog ? [`import type errors from ${relativeModule(catalog)};`] : []], [
1179
1184
  "declare global {",
@@ -1222,7 +1227,8 @@ function prepareProject(directory, mode, project) {
1222
1227
  "",
1223
1228
  "export default worker.handler;",
1224
1229
  "export const Service = worker.entrypoint;",
1225
- ...durableObjects
1230
+ ...durableObjects,
1231
+ ...Object.hasOwn(project.env.production, "MAXIMUS_TASKS") ? ["export const MaximusTasks = worker.tasks;"] : []
1226
1232
  ]),
1227
1233
  "http.ts": generatedModule(mode, [
1228
1234
  "import { createHttpHandler } from '@arbol-ai/maximus';",
@@ -1265,7 +1271,7 @@ function prepareProject(directory, mode, project) {
1265
1271
  /** A web app's pages and layout, and the files its build serves by name. */
1266
1272
  const WEB_APP_DIRECTORIES = ["app", "public"];
1267
1273
  /** The root modules that complete the application, and the web app's HTML entry. */
1268
- const ROOT_MODULE = /^(?:(?:errors|auth|context|telemetry)\.(?:ts|mts|js|mjs)|index\.html)$/;
1274
+ const ROOT_MODULE = /^(?:(?:errors|auth|context|telemetry|capture)\.(?:ts|mts|js|mjs)|index\.html)$/;
1269
1275
  /**
1270
1276
  * What the Worker's configuration and exports follow from a prepared project: Cloudflare's plugin reads them as
1271
1277
  * the server starts, so only a restart applies a change to them.