@arbol-ai/maximus 7.4.0 → 8.0.1
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/README.md +36 -38
- package/bin/maximus.js +4 -0
- package/config/oxfmt.mjs +1 -0
- package/config/oxlint.mjs +10 -0
- package/dist/analytics/analytics.d.ts +21 -9
- package/dist/analytics/analytics.js +19 -5
- package/dist/body.d.ts +1 -1
- package/dist/body.js +2 -2
- package/dist/chunks/agent-skills-Ef65jTf_.js +49 -0
- package/dist/chunks/agent-skills-m7y1EUch.js +3 -0
- package/dist/chunks/{body-6LichrQm.js → body-DOIHwIIl.js} +14 -7
- package/dist/chunks/{correlation-BEkcFFGT.js → correlation-4b23a-a4.js} +8 -5
- package/dist/chunks/define-app-x7uY70_1.js +341 -0
- package/dist/chunks/{errors-D7zG9kx9.js → errors-C5w9WY1l.js} +10 -5
- package/dist/chunks/{execution-kVUJPy1A.js → execution-rOiLo8VG.js} +28 -15
- package/dist/chunks/generate-C-9FKW0o.js +197 -0
- package/dist/chunks/handler-iebR-urt.js +141 -0
- package/dist/chunks/http-layout-DS8DnPyu.js +128 -0
- package/dist/chunks/{http-paths-yKD6TSNJ.js → http-paths-DMBxwpp6.js} +50 -31
- package/dist/chunks/{json-Bu4BLT25.js → json-B14evE6-.js} +21 -5
- package/dist/chunks/names-ncD7A3DV.js +280 -0
- package/dist/chunks/openapi-CeolxIqa.js +1588 -0
- package/dist/chunks/openapi-file-Bz9FRaE6.js +83 -0
- package/dist/chunks/pages-iZTvFs5a.js +14 -0
- package/dist/chunks/prepare-configured-BmRJLg6J.js +3 -0
- package/dist/chunks/prepare-configured-Cithjf80.js +52 -0
- package/dist/chunks/project-files-C0OX7MQQ.js +130 -0
- package/dist/chunks/query-kind-CWKAXEME.js +40 -0
- package/dist/chunks/record-DQUDTpEA.js +10 -0
- package/dist/chunks/result-CKgZHrnj.js +56 -0
- package/dist/chunks/{runtime-DlqA7J38.js → runtime-D94vx21X.js} +50 -26
- package/dist/chunks/scaffold-DGrcjR3h.js +3 -0
- package/dist/chunks/scaffold-DZD6dfoZ.js +138 -0
- package/dist/chunks/{schemas-CzTvbXb6.js → schemas-p_aRcMC1.js} +30 -14
- package/dist/chunks/server-Bzf1Q1_4.js +410 -0
- package/dist/chunks/src-CPrJpbOM.js +573 -0
- package/dist/chunks/{standard-failures-CLjxS2ea.js → standard-failures-Lh4mSfwG.js} +1 -1
- package/dist/chunks/{telemetry-BTwB68m5.js → telemetry-C3LfZcOB.js} +32 -11
- package/dist/chunks/{types-DQdfRF3f.d.ts → types-DTIuIEJ-.d.ts} +1000 -342
- package/dist/chunks/{validation-r-sgmsqb.js → validation-fTohBT6R.js} +69 -28
- package/dist/chunks/workers-types-BRk_Xa_5.d.ts +143 -0
- package/dist/chunks/yaml-Dk2L24yQ.js +74 -0
- package/dist/diagnostics.d.ts +6 -4
- package/dist/diagnostics.js +2 -2
- package/dist/errors.d.ts +2 -2
- package/dist/errors.js +2 -2
- 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 +12 -11
- package/dist/internals.d.ts +1 -1
- package/dist/internals.js +5 -4
- package/dist/mcp/index.d.ts +3 -2
- package/dist/mcp/index.js +5 -387
- package/dist/postgres/index.d.ts +25 -8
- package/dist/postgres/index.js +17 -8
- package/dist/project/config.d.ts +110 -72
- package/dist/project/config.js +161 -45
- package/dist/project/index.d.ts +17 -4
- package/dist/project/index.js +44 -9
- package/dist/projection.d.ts +14 -13
- package/dist/projection.js +8 -32
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.js +2 -2
- package/dist/standard-failures.d.ts +2 -89
- package/dist/standard-failures.js +1 -1
- package/dist/tooling/cli.js +149 -105
- package/dist/tooling/testing.js +2 -2
- package/dist/vite/cloudflare-workers.js +25 -0
- package/dist/vite/index.d.ts +157 -0
- package/dist/vite/index.js +1477 -0
- package/dist/webhooks.d.ts +12 -10
- package/dist/webhooks.js +26 -12
- package/dist/workers/runtime.d.ts +1 -1
- package/dist/workers/runtime.js +1 -1
- package/package.json +26 -22
- package/skills/maximus/SKILL.md +165 -68
- package/skills/maximus/references/deploying.md +73 -0
- package/skills/maximus/references/errors-and-results.md +114 -55
- package/skills/maximus/references/project.md +202 -0
- package/skills/maximus/references/routes-and-tools.md +256 -0
- package/skills/maximus/references/testing.md +137 -50
- package/skills/maximus/references/transports.md +113 -100
- package/skills/maximus/references/writing-code.md +84 -0
- package/templates/mcp/mcp/instructions.md.template +2 -0
- package/templates/mcp/routes/v1/greeting.get.ts.template +12 -0
- package/templates/mcp/tests/mcp.test.ts.template +36 -0
- package/templates/project/.agents/skills/project/SKILL.md.template +21 -12
- package/templates/project/.github/workflows/ci.yml.template +4 -1
- package/templates/project/CLAUDE.md.template +41 -25
- package/templates/project/README.md.template +54 -48
- package/templates/project/middleware/10-response.ts.template +5 -2
- package/templates/project/package.json.template +13 -9
- package/templates/project/pages/index.ts.template +2 -4
- package/templates/project/routes/v1/greeting.get.ts.template +10 -0
- package/templates/project/routes/v1/greeting.post.ts.template +12 -0
- package/templates/project/tests/greeting.test.ts.template +45 -0
- package/templates/project/tsconfig.json.template +8 -6
- package/templates/project/vite.config.ts.template +15 -7
- package/templates/web/app/main.tsx.template +16 -0
- package/templates/web/app/root.tsx.template +17 -0
- package/templates/web/app/routes/index.tsx.template +9 -0
- package/templates/web/index.html.template +12 -0
- package/templates/web/package.json.template +12 -0
- package/templates/web/tsconfig.json.template +7 -0
- package/templates/web/vite.config.ts.template +22 -0
- package/dist/chunks/builder-BiXv7d2v.js +0 -100
- package/dist/chunks/define-app-DvD_1jUE.js +0 -625
- package/dist/chunks/prepare-project-CMyGSEtI.js +0 -236
- package/dist/chunks/prepare-project-MtS0-W_n.js +0 -3
- package/dist/chunks/record-DY-lX9w1.js +0 -34
- package/dist/chunks/src-N3oyx5QF.js +0 -1091
- package/dist/client/client.d.ts +0 -129
- package/dist/client/client.js +0 -321
- package/dist/tooling/vite.d.ts +0 -3
- package/dist/tooling/vite.js +0 -57
- package/skills/maximus/references/adding-an-operation.md +0 -179
- package/skills/maximus/references/building-a-service.md +0 -167
- package/skills/maximus/references/migration-from-v2.md +0 -62
- package/skills/maximus/references/migration-to-v5.md +0 -37
- package/skills/maximus/references/publishing-and-verification.md +0 -42
- package/templates/project/cloudflare.config.ts.template +0 -24
- package/templates/project/maximus.config.ts.template +0 -20
- package/templates/project/routes/v1/greeting.ts.template +0 -38
- package/templates/service/.agents/skills/project/SKILL.md.template +0 -10
- package/templates/service/.github/workflows/ci.yml.template +0 -21
- package/templates/service/.gitignore.template +0 -9
- package/templates/service/CLAUDE.md.template +0 -5
- package/templates/service/README.md.template +0 -45
- package/templates/service/cloudflare.config.ts.template +0 -30
- package/templates/service/package.json.template +0 -36
- package/templates/service/src/app.ts.template +0 -30
- package/templates/service/src/index.ts.template +0 -13
- package/templates/service/tests/contract.test.ts.template +0 -12
- package/templates/service/tsconfig.json.template +0 -16
- package/templates/service/vite.config.ts.template +0 -13
- package/templates/service/vitest.config.ts.template +0 -10
|
@@ -68,7 +68,12 @@ const extendObject = (schema, properties) => ({
|
|
|
68
68
|
}, { additionalProperties: schema.additionalProperties }),
|
|
69
69
|
[STRIP]: schema[STRIP]
|
|
70
70
|
});
|
|
71
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* Reads a field through `normalize`. For a string, or a string that may be null, the pattern, format and
|
|
73
|
+
* lengths apply to the normalized value, so the wire may send a raw spelling (another case, surrounding
|
|
74
|
+
* spaces); any other schema checks the raw value first. The wire type stays the schema's own. Runs inside
|
|
75
|
+
* `inputSchema()`.
|
|
76
|
+
*/
|
|
72
77
|
const normalizeSchema = (schema, normalize) => Type.Unsafe({
|
|
73
78
|
...schema,
|
|
74
79
|
[NORMALIZERS]: [...schema[NORMALIZERS] ?? [], normalize],
|
|
@@ -77,7 +82,10 @@ const normalizeSchema = (schema, normalize) => Type.Unsafe({
|
|
|
77
82
|
apply: normalize
|
|
78
83
|
}]
|
|
79
84
|
});
|
|
80
|
-
/**
|
|
85
|
+
/**
|
|
86
|
+
* Decodes a field with `transform` once its value passes `schema`: the wire sends what `schema` checks, and
|
|
87
|
+
* the handler receives what `transform` returns. Runs inside `inputSchema()`.
|
|
88
|
+
*/
|
|
81
89
|
const transformSchema = (schema, transform) => Type.Unsafe({
|
|
82
90
|
...schema,
|
|
83
91
|
[TRANSFORMERS]: [...schema[TRANSFORMERS] ?? [], transform],
|
|
@@ -107,8 +115,8 @@ const inspectSchema = (schema, inspect) => ({
|
|
|
107
115
|
}]
|
|
108
116
|
});
|
|
109
117
|
/**
|
|
110
|
-
* Refuses a value the schema admits when `predicate` rejects it, with `
|
|
111
|
-
*
|
|
118
|
+
* Refuses a value the schema admits when `predicate` rejects it, with a `custom` issue whose message and path
|
|
119
|
+
* `detail` gives (`Invalid value` at the field by default). Runs inside `inputSchema()`.
|
|
112
120
|
*/
|
|
113
121
|
const refineSchema = (schema, predicate, detail) => inspectSchema(schema, (value, context) => {
|
|
114
122
|
if (!predicate(value)) context.addIssue({
|
|
@@ -117,7 +125,10 @@ const refineSchema = (schema, predicate, detail) => inspectSchema(schema, (value
|
|
|
117
125
|
path: typeof detail === "object" ? detail.path ?? [] : []
|
|
118
126
|
});
|
|
119
127
|
});
|
|
120
|
-
/**
|
|
128
|
+
/**
|
|
129
|
+
* A URL, of at most `maxLength` characters when given, whose protocol (without its colon, such as `https`)
|
|
130
|
+
* and, optionally, hostname match the given patterns. Runs inside `inputSchema()`.
|
|
131
|
+
*/
|
|
121
132
|
const urlSchema = (options) => refineSchema(Type.String({
|
|
122
133
|
format: "uri",
|
|
123
134
|
...options.maxLength ? { maxLength: options.maxLength } : {}
|
|
@@ -194,6 +205,13 @@ const projectOwnerInput = (schema, stripUnknown) => {
|
|
|
194
205
|
}).Encode((value) => value);
|
|
195
206
|
};
|
|
196
207
|
/**
|
|
208
|
+
* An input schema as callers send it, for the documents that publish it: a field with a default is optional,
|
|
209
|
+
* since decoding fills it in. A schema `inputSchema()` compiled is its wire form already.
|
|
210
|
+
*/
|
|
211
|
+
function wireInput(schema) {
|
|
212
|
+
return TransformKind in schema ? schema : projectOwnerInput(schema, false);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
197
215
|
* Whether a schema carries owner codecs that only `inputSchema()` compiles: a normalizer, transform,
|
|
198
216
|
* inspector or refinement, a `pipeSchema` source, or a `stripObject`. A plain decode ignores their
|
|
199
217
|
* markers, so such a schema used directly as an operation input would admit raw, unnormalized and
|
|
@@ -242,15 +260,17 @@ function segments(path) {
|
|
|
242
260
|
return path.split("/").slice(1).filter(Boolean).map((part) => part.replaceAll("~1", "/").replaceAll("~0", "~"));
|
|
243
261
|
}
|
|
244
262
|
/**
|
|
245
|
-
* The issues of a
|
|
246
|
-
*
|
|
247
|
-
*
|
|
263
|
+
* The issues of a refused decode, at most `limit`, each with its path from the input's root, or null when
|
|
264
|
+
* nothing refused the input: an owner codec threw something other than a `SchemaValidationError`, which is
|
|
265
|
+
* the codec's fault for the caller to report. A codec nested in another reports its issues below the path
|
|
266
|
+
* the outer one decodes. TypeBox finds issues one at a time, so an input with millions of them costs no
|
|
267
|
+
* more than `limit`.
|
|
248
268
|
*/
|
|
249
269
|
function decodeIssues(error, limit = Number.POSITIVE_INFINITY) {
|
|
250
270
|
let cause = error;
|
|
251
|
-
|
|
271
|
+
const path = [];
|
|
252
272
|
while (cause instanceof TransformDecodeError) {
|
|
253
|
-
path
|
|
273
|
+
path.push(...segments(cause.path));
|
|
254
274
|
cause = cause.error;
|
|
255
275
|
}
|
|
256
276
|
if (cause instanceof SchemaValidationError) return cause.issues.slice(0, limit).map((issue) => ({
|
|
@@ -263,19 +283,23 @@ function decodeIssues(error, limit = Number.POSITIVE_INFINITY) {
|
|
|
263
283
|
issues.push({
|
|
264
284
|
code: "invalid_input",
|
|
265
285
|
message: issue.message,
|
|
266
|
-
path: segments(issue.path)
|
|
286
|
+
path: [...path, ...segments(issue.path)]
|
|
267
287
|
});
|
|
268
288
|
if (issues.length >= limit) break;
|
|
269
289
|
}
|
|
270
290
|
return issues;
|
|
271
291
|
}
|
|
272
|
-
if (cause instanceof TypeError) return [{
|
|
273
|
-
code: "invalid_input",
|
|
274
|
-
message: cause.message,
|
|
275
|
-
path: []
|
|
276
|
-
}];
|
|
277
292
|
return null;
|
|
278
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* What an owner codec threw, without the TypeBox error that wraps it: that wrapper carries the value being
|
|
296
|
+
* decoded, which a fault must never take with it to a log.
|
|
297
|
+
*/
|
|
298
|
+
function codecFault(error) {
|
|
299
|
+
let cause = error;
|
|
300
|
+
while (cause instanceof TransformDecodeError) cause = cause.error;
|
|
301
|
+
return cause;
|
|
302
|
+
}
|
|
279
303
|
/** RFC 6901 JSON Pointer of an issue path; the empty string names the whole input. */
|
|
280
304
|
function jsonPointer(path) {
|
|
281
305
|
return path.map((part) => `/${String(part).replaceAll("~", "~0").replaceAll("/", "~1")}`).join("");
|
|
@@ -326,22 +350,34 @@ function parseSchema(schema, input) {
|
|
|
326
350
|
if (!Value.Check(schema, input)) throw new TypeError("Value does not match its schema");
|
|
327
351
|
return input;
|
|
328
352
|
}
|
|
329
|
-
/**
|
|
353
|
+
/**
|
|
354
|
+
* Whether a value is a bounded plain JSON tree, which TypeBox's traversals expect and every transport admits:
|
|
355
|
+
* no cycles, class instances, functions, non-finite numbers, nesting beyond 100 levels or own `__proto__` key.
|
|
356
|
+
*/
|
|
330
357
|
function boundedInput(value, depth = 0, parents = /* @__PURE__ */ new Set()) {
|
|
331
358
|
if (depth > 100) return false;
|
|
332
359
|
if (value === void 0 || value === null || typeof value === "string" || typeof value === "boolean") return true;
|
|
333
360
|
if (typeof value === "number") return Number.isFinite(value);
|
|
334
361
|
if (typeof value !== "object" || parents.has(value)) return false;
|
|
335
362
|
if (!Array.isArray(value) && Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) return false;
|
|
363
|
+
if (Object.hasOwn(value, "__proto__")) return false;
|
|
336
364
|
parents.add(value);
|
|
337
365
|
const valid = Object.values(value).every((child) => boundedInput(child, depth + 1, parents));
|
|
338
366
|
parents.delete(value);
|
|
339
367
|
return valid;
|
|
340
368
|
}
|
|
341
|
-
/**
|
|
342
|
-
*
|
|
369
|
+
/**
|
|
370
|
+
* Decodes input against its schema: admits only a bounded plain JSON tree, applies the declared defaults to a
|
|
371
|
+
* copy, checks it and runs its codecs. Throws a `SchemaValidationError` (or TypeBox's assertion error) when the
|
|
372
|
+
* input is refused, and whatever an owner codec throws otherwise. Output is checked, never decoded: what a
|
|
373
|
+
* handler returns must already be canonical.
|
|
374
|
+
*/
|
|
343
375
|
function decodeSchema(schema, input) {
|
|
344
|
-
if (!boundedInput(input)) throw new
|
|
376
|
+
if (!boundedInput(input)) throw new SchemaValidationError([{
|
|
377
|
+
code: "invalid_input",
|
|
378
|
+
message: "Input must be a bounded plain JSON tree.",
|
|
379
|
+
path: []
|
|
380
|
+
}]);
|
|
345
381
|
const value = Value.Default(schema, Value.Clone(input));
|
|
346
382
|
Value.Assert(schema, value);
|
|
347
383
|
return HasTransform(schema, []) ? TransformDecode(schema, [], value) : value;
|
|
@@ -351,29 +387,34 @@ const MAX_ISSUES = 10;
|
|
|
351
387
|
/** The longest path or message one issue carries. */
|
|
352
388
|
const MAX_ISSUE_TEXT = 256;
|
|
353
389
|
/**
|
|
354
|
-
*
|
|
355
|
-
* field issues
|
|
390
|
+
* Decodes input as `decodeSchema` does and answers a refusal as the `INVALID_INPUT` failure, with its first
|
|
391
|
+
* field issues: where the input failed and what was expected, never a value. A fault of an owner codec, an
|
|
392
|
+
* error that refuses nothing, is thrown for the caller to report: it is the server's failure, not the input's.
|
|
356
393
|
*/
|
|
357
394
|
function decodeInput(schema, input) {
|
|
395
|
+
let value;
|
|
358
396
|
try {
|
|
359
|
-
|
|
360
|
-
ok: true,
|
|
361
|
-
value: decodeSchema(schema, input)
|
|
362
|
-
};
|
|
397
|
+
value = decodeSchema(schema, input);
|
|
363
398
|
} catch (error) {
|
|
399
|
+
const refused = decodeIssues(error, MAX_ISSUES);
|
|
400
|
+
if (!refused) throw codecFault(error);
|
|
364
401
|
return {
|
|
365
402
|
ok: false,
|
|
366
403
|
error: {
|
|
367
404
|
code: "INVALID_INPUT",
|
|
368
405
|
message: "The input does not match its schema.",
|
|
369
406
|
retryable: false,
|
|
370
|
-
data: { issues:
|
|
407
|
+
data: { issues: refused.map((issue) => ({
|
|
371
408
|
path: jsonPointer(issue.path).slice(0, MAX_ISSUE_TEXT),
|
|
372
409
|
message: issue.message.slice(0, MAX_ISSUE_TEXT)
|
|
373
410
|
})) }
|
|
374
411
|
}
|
|
375
412
|
};
|
|
376
413
|
}
|
|
414
|
+
return {
|
|
415
|
+
ok: true,
|
|
416
|
+
value
|
|
417
|
+
};
|
|
377
418
|
}
|
|
378
419
|
|
|
379
|
-
export {
|
|
420
|
+
export { wireInput as S, refineSchema as _, codecFault as a, transformSchema as b, defaultSchema as c, inputSchema as d, inspectSchema as f, pipeSchema as g, normalizeSchema as h, parseSchema as i, extendObject as l, looseObject as m, decodeSchema as n, decodeIssues as o, literalUnion as p, parseInput as r, SchemaValidationError as s, decodeInput as t, hasUncompiledCodecs as u, strictObject as v, urlSchema as x, stripObject as y };
|
|
@@ -0,0 +1,143 @@
|
|
|
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";
|
|
2
|
+
import { DurableObject, WorkerEntrypoint } from "cloudflare:workers";
|
|
3
|
+
/** A Workers static-assets binding; product stores and secrets never satisfy this capability. */
|
|
4
|
+
interface AssetBinding {
|
|
5
|
+
/** Answers a request with the uploaded build file at its URL path. */
|
|
6
|
+
fetch: (request: Request) => Promise<Response>;
|
|
7
|
+
}
|
|
8
|
+
/** The names of the env bindings that are asset bindings. */
|
|
9
|
+
type AssetBindingName<E> = { [K in keyof E]-?: E[K] extends AssetBinding ? K : never; }[keyof E] & string;
|
|
10
|
+
/**
|
|
11
|
+
* Which paths of a web app's build the Worker serves, and how: a page answers the app's shell, a listed file
|
|
12
|
+
* revalidates on every use, a file under an immutable prefix is cached for a year, and any other path answers
|
|
13
|
+
* `NOT_FOUND`, never the shell (under `development`, the dev server answers it). A method other than GET or
|
|
14
|
+
* HEAD answers `HTTP_METHOD_NOT_ALLOWED`.
|
|
15
|
+
*/
|
|
16
|
+
interface WorkerAssetsOptions<E> {
|
|
17
|
+
/** The name of the static-assets binding that serves the build's files. */
|
|
18
|
+
binding: AssetBindingName<E>;
|
|
19
|
+
/** The app's pages, which answer its shell with `cache-control: no-store`. */
|
|
20
|
+
pages?: {
|
|
21
|
+
/** The pages' exact paths, such as `/` and `/settings`. */
|
|
22
|
+
paths: readonly string[];
|
|
23
|
+
/**
|
|
24
|
+
* Patterns for pages whose paths carry a parameter, such as `/^\/notes\/[\w-]+$/`: regular expressions
|
|
25
|
+
* without the global or sticky flag.
|
|
26
|
+
*/
|
|
27
|
+
patterns?: readonly RegExp[];
|
|
28
|
+
/** The build file a page answers with; `/index.html` by default. */
|
|
29
|
+
shell?: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Build files served by exact path that clients revalidate on every use (`cache-control: no-cache`), such
|
|
33
|
+
* as a manifest or a service worker.
|
|
34
|
+
*/
|
|
35
|
+
files?: readonly string[];
|
|
36
|
+
/**
|
|
37
|
+
* Path prefixes whose files are content-hashed, served with `cache-control: public, max-age=31536000,
|
|
38
|
+
* immutable`; a prefix may not be `/`.
|
|
39
|
+
*/
|
|
40
|
+
immutablePrefixes?: readonly string[];
|
|
41
|
+
/**
|
|
42
|
+
* Response headers for every page and file, such as a Content Security Policy, or a function of the request
|
|
43
|
+
* and env that answers them. They never set `content-type` or `cache-control`, which the build file and
|
|
44
|
+
* the path decide.
|
|
45
|
+
*/
|
|
46
|
+
headers?: HeadersInit | ((request: Request, env: E) => HeadersInit);
|
|
47
|
+
/**
|
|
48
|
+
* Development under Vite (the Cloudflare Vite plugin), whose dev server stands behind the binding:
|
|
49
|
+
* a GET the Worker does not serve as a page, file or immutable asset (Vite's client, modules and
|
|
50
|
+
* sources) is forwarded to it as it came. Pass `import.meta.env.DEV`, which a production build sets to
|
|
51
|
+
* false: a deployed Worker must never forward unknown paths.
|
|
52
|
+
*/
|
|
53
|
+
development?: boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Reads the caller's organization credential, for a `.derive()` that prepares it: `accounts.getByName`
|
|
57
|
+
* addresses the organization's own store by its id (a Durable Object namespace, for example), whose
|
|
58
|
+
* `readCredential` answers the credential. A failure it answers is returned as it is; a credential that does
|
|
59
|
+
* not match `schema` or names another `organizationId` answers `INTERNAL_ERROR`. Otherwise it answers
|
|
60
|
+
* `{ credential }`.
|
|
61
|
+
*/
|
|
62
|
+
declare function credentials<Schema extends TSchema>(options: {
|
|
63
|
+
principal: Principal;
|
|
64
|
+
accounts: {
|
|
65
|
+
getByName: (name: string) => {
|
|
66
|
+
readCredential: (organizationId: string) => Promise<Result<unknown, Failure>>;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
schema: Schema;
|
|
70
|
+
}): Promise<Result<{
|
|
71
|
+
credential: Static<Schema>;
|
|
72
|
+
}, Failure>>;
|
|
73
|
+
/**
|
|
74
|
+
* The RPC methods of a Worker's entrypoint: one per operation that declares `rpc`, taking the caller's
|
|
75
|
+
* principal and the input and answering a Result.
|
|
76
|
+
*/
|
|
77
|
+
type RpcMethods<Ops extends Record<string, OperationShape>> = { [K in keyof Ops as Ops[K] extends {
|
|
78
|
+
rpc: true | {
|
|
79
|
+
callers: readonly string[];
|
|
80
|
+
};
|
|
81
|
+
} ? K : never]: (principal: Principal, input: Static<Ops[K]['input']>) => Promise<Result<Static<Ops[K]['output']>, Failure>>; };
|
|
82
|
+
/**
|
|
83
|
+
* What `createWorker` returns: the default export's handler, the named entrypoint for Worker RPC, and
|
|
84
|
+
* wrappers that run your own entrypoints and Durable Objects inside the application's diagnostics.
|
|
85
|
+
*/
|
|
86
|
+
interface WorkerRuntime<E, O extends Record<string, OperationShape>> {
|
|
87
|
+
/** The Worker's default export: `fetch` for HTTP, plus the other `handlers` given to `createWorker`. */
|
|
88
|
+
handler: ExportedHandler<E>;
|
|
89
|
+
/**
|
|
90
|
+
* A `WorkerEntrypoint` class with one method per operation that declares `rpc`, each taking the caller's
|
|
91
|
+
* principal and the input and answering a Result; export it by name for Service Bindings to call.
|
|
92
|
+
*/
|
|
93
|
+
entrypoint: new (ctx: ExecutionContext, env: E) => WorkerEntrypoint<E> & RpcMethods<O>;
|
|
94
|
+
/**
|
|
95
|
+
* Wraps your own `WorkerEntrypoint` class so its methods run inside the application's diagnostics; it keeps
|
|
96
|
+
* its methods and type.
|
|
97
|
+
*/
|
|
98
|
+
service: <D extends new (ctx: ExecutionContext, env: E) => WorkerEntrypoint<E>>(implementation: D) => D;
|
|
99
|
+
/**
|
|
100
|
+
* Wraps a Durable Object class so its methods run inside the application's diagnostics; it keeps its
|
|
101
|
+
* methods and type.
|
|
102
|
+
*/
|
|
103
|
+
durableObject: <T extends DurableObject<E>, D extends new (state: DurableObject['ctx'], env: E) => T>(implementation: D) => D;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* What `createWorker` takes besides the application: the Worker's other handlers, its transports, the HTTP
|
|
107
|
+
* handler's options, its static assets and its plain routes.
|
|
108
|
+
*/
|
|
109
|
+
interface WorkerOptions<E> {
|
|
110
|
+
/**
|
|
111
|
+
* The Worker's other handlers (`scheduled`, `queue`, …), merged into the default export. Each runs inside
|
|
112
|
+
* the application's diagnostics: an error it throws is reported by its safe description, then thrown on.
|
|
113
|
+
*/
|
|
114
|
+
handlers?: Omit<ExportedHandler<E>, 'fetch'>;
|
|
115
|
+
/** Protocol transports served beside the operations, such as `mcp()`. */
|
|
116
|
+
transports?: HttpOptions<E>['transports'];
|
|
117
|
+
/**
|
|
118
|
+
* The HTTP handler's other options: origins, middleware, `before`, `basePath`, `healthPath`, mounts,
|
|
119
|
+
* `fallback`, `aroundOperation` and the test `verify`.
|
|
120
|
+
*/
|
|
121
|
+
http?: Omit<HttpOptions<E>, 'transports' | 'routes' | 'annotate'>;
|
|
122
|
+
/**
|
|
123
|
+
* A web app's build, served from a static-assets binding as the HTTP fallback; it cannot be combined with
|
|
124
|
+
* `http.fallback`.
|
|
125
|
+
*/
|
|
126
|
+
assets?: WorkerAssetsOptions<E>;
|
|
127
|
+
/**
|
|
128
|
+
* Plain routes outside token admission (provider webhooks, signed links,
|
|
129
|
+
* OAuth callbacks), by exact path. Each handler verifies its own signature
|
|
130
|
+
* or token before reading the request. They run inside the same handler,
|
|
131
|
+
* so diagnostics cover them too.
|
|
132
|
+
*/
|
|
133
|
+
routes?: Readonly<Record<string, HttpRoute<E>>>;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Turns an application into a Cloudflare Worker: `handler` (export it as default) serves HTTP and the other
|
|
137
|
+
* handlers you pass; `entrypoint` (export it by name) serves every operation that declares `rpc` to the
|
|
138
|
+
* Workers whose Service Binding names an allowed `caller`. An RPC call whose binding's props are anything but
|
|
139
|
+
* `{ caller }` with an allowed caller, or whose principal does not match `PrincipalSchema`, answers
|
|
140
|
+
* `UNAUTHORIZED`; an admitted one runs through the shared execution path without `authority`.
|
|
141
|
+
*/
|
|
142
|
+
declare function createWorker<E, C, O extends Record<string, OperationShape>>(application: AppManifest<E, C, O>, options?: WorkerOptions<E>): WorkerRuntime<E, O>;
|
|
143
|
+
export { credentials as a, createWorker as i, WorkerOptions as n, WorkerAssetsOptions as o, WorkerRuntime as r, RpcMethods as t };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// src/internal/yaml.ts
|
|
2
|
+
/**
|
|
3
|
+
* A YAML writer for JSON data, for `/openapi.yaml` and a skill's frontmatter: block mappings and sequences,
|
|
4
|
+
* two spaces deep, and every scalar written as any YAML reader takes it back. A string stays plain only when
|
|
5
|
+
* no reader could take it for anything else, and is double-quoted with JSON's escapes otherwise.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* A string that is plain text to every YAML reader: it starts with a letter or `_` and holds only letters,
|
|
9
|
+
* digits, `_`, `.`, `/` and `-`, so it is no number, date, comment, alias, tag or flow collection.
|
|
10
|
+
*/
|
|
11
|
+
const PLAIN = /^[A-Za-z_][\w./-]*$/;
|
|
12
|
+
/** Words a YAML 1.1 reader takes for a boolean or null, whatever their case. */
|
|
13
|
+
const KEYWORDS = /* @__PURE__ */ new Set([
|
|
14
|
+
"y",
|
|
15
|
+
"n",
|
|
16
|
+
"yes",
|
|
17
|
+
"no",
|
|
18
|
+
"on",
|
|
19
|
+
"off",
|
|
20
|
+
"true",
|
|
21
|
+
"false",
|
|
22
|
+
"null"
|
|
23
|
+
]);
|
|
24
|
+
/** Characters YAML requires escaped in a double-quoted scalar that JSON leaves as they are. */
|
|
25
|
+
const UNPRINTABLE = /[\u007F-\u0084\u0086-\u009F]/g;
|
|
26
|
+
/** A string as a YAML scalar. */
|
|
27
|
+
function text(value) {
|
|
28
|
+
if (PLAIN.test(value) && !KEYWORDS.has(value.toLowerCase())) return value;
|
|
29
|
+
return JSON.stringify(value).replaceAll(UNPRINTABLE, (character) => `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
30
|
+
}
|
|
31
|
+
/** A value's own entries, as JSON keeps them: its items, or the fields whose value is defined. */
|
|
32
|
+
function entries(value) {
|
|
33
|
+
return Object.entries(value).filter(([, child]) => child !== void 0 && typeof child !== "function");
|
|
34
|
+
}
|
|
35
|
+
/** A value written on one line: a scalar, or an empty mapping or sequence. Undefined for any other. */
|
|
36
|
+
function inline(value) {
|
|
37
|
+
if (value === null) return "null";
|
|
38
|
+
switch (typeof value) {
|
|
39
|
+
case "string": return text(value);
|
|
40
|
+
case "number": return Number.isFinite(value) ? String(value) : "null";
|
|
41
|
+
case "boolean": return String(value);
|
|
42
|
+
case "object":
|
|
43
|
+
if (Array.isArray(value)) return value.length ? void 0 : "[]";
|
|
44
|
+
return entries(value).length ? void 0 : "{}";
|
|
45
|
+
default: return "null";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** The lines of a mapping or sequence that is not empty, `depth` levels in. */
|
|
49
|
+
function block(value, depth) {
|
|
50
|
+
const indent = " ".repeat(depth);
|
|
51
|
+
const lines = [];
|
|
52
|
+
if (Array.isArray(value)) {
|
|
53
|
+
for (const item of value) {
|
|
54
|
+
const single = inline(item === void 0 ? null : item);
|
|
55
|
+
if (single === void 0) {
|
|
56
|
+
const [first = "", ...rest] = block(item, depth + 1);
|
|
57
|
+
lines.push(`${indent}- ${first.trimStart()}`, ...rest);
|
|
58
|
+
} else lines.push(`${indent}- ${single}`);
|
|
59
|
+
}
|
|
60
|
+
return lines;
|
|
61
|
+
}
|
|
62
|
+
for (const [key, child] of entries(value)) {
|
|
63
|
+
const single = inline(child);
|
|
64
|
+
lines.push(single === void 0 ? `${indent}${text(key)}:` : `${indent}${text(key)}: ${single}`);
|
|
65
|
+
if (single === void 0) lines.push(...block(child, depth + 1));
|
|
66
|
+
}
|
|
67
|
+
return lines;
|
|
68
|
+
}
|
|
69
|
+
/** A JSON value as a YAML document. */
|
|
70
|
+
function toYaml(value) {
|
|
71
|
+
return `${inline(value) ?? block(value, 0).join("\n")}\n`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { toYaml as t };
|
package/dist/diagnostics.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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";
|
|
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.
|
|
@@ -28,9 +28,11 @@ interface ErrorDescription {
|
|
|
28
28
|
}[];
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
31
|
+
* The error describer for diagnostics, for an SDK's events or a log line its owner writes: `describeError`
|
|
32
|
+
* answers an `ErrorDescription`, and `safeErrorName` an error's name when it is built in or among
|
|
33
|
+
* `errorNames`, else `UnknownError`. Pass constant names of your own errors, never a value taken from an
|
|
34
|
+
* upstream response. No message, record key, URL or query parameter reaches a description, and nothing is
|
|
35
|
+
* logged.
|
|
34
36
|
*/
|
|
35
37
|
export declare function createDiagnostics(errorNames?: readonly string[]): {
|
|
36
38
|
safeErrorName: (error: unknown) => string;
|
package/dist/diagnostics.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as parseTraceParent, n as durableCorrelation, r as isRequestId, t as createRequestId } from "./chunks/correlation-
|
|
2
|
-
import { a as telemetryEnabled, c as createDiagnostics, i as reportUnexpected, o as withDiagnostics, r as recordExecution, t as diagnosticsEnabled } from "./chunks/telemetry-
|
|
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";
|
|
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 {
|
|
2
|
-
export { DefinedErrors, ErrorCatalog, ErrorDefinition, ErrorFactory, Failure, FailureData, FailureSchema, defineErrors, isRequestId, resultSchema, standardErrors };
|
|
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";
|
|
2
|
+
export { CreateArguments, DefinedErrors, ErrorCatalog, ErrorDefinition, ErrorFactory, Failure, FailureData, FailureSchema, defineErrors, isRequestId, resultSchema, standardErrors };
|
package/dist/errors.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as isRequestId } from "./chunks/correlation-
|
|
2
|
-
import { i as standardErrors, n as defineErrors, r as resultSchema, t as FailureSchema } from "./chunks/errors-
|
|
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";
|
|
3
3
|
|
|
4
4
|
export { FailureSchema, defineErrors, isRequestId, resultSchema, standardErrors };
|
package/dist/http-paths.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
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";
|
|
2
2
|
export { HttpRouteDefinition, HttpRouteMatch, createHttpRouteResolver, decodePathParameter, isInputHeaderName, isPathParameterValue, operationPathParameters };
|
package/dist/http-paths.js
CHANGED
|
@@ -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-
|
|
1
|
+
import { a as operationPathParameters, i as isPathParameterValue, n as decodePathParameter, r as isInputHeaderName, t as createHttpRouteResolver } from "./chunks/http-paths-DMBxwpp6.js";
|
|
2
2
|
|
|
3
3
|
export { createHttpRouteResolver, decodePathParameter, isInputHeaderName, isPathParameterValue, operationPathParameters };
|
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 BackgroundContext, type BinaryBody, type BodyReadOptions, type DefinedErrors, type DeletedObject, DeletedObjectSchema, EmailAddressSchema, EmptyInputSchema, type ErrorCatalog, type ErrorDefinition, type ErrorFactory, type ExecutionObservation, type Exposure, type Failure, type FailureData, type FailureResult, FailureSchema, 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 Principal, PrincipalSchema, type Result, type RouteContext, type ScopeMatch, type SignedUrl, SignedUrlSchema, type Static, type Success, type TPage, type TSchema, type TelemetryConfig, type TokenAlgorithm, type TokenClaims, type TokenClient, type TokenDevelopment, type TokenPolicy, type TokenPrincipal, type TokenResolutionContext, type TokenScheme, type TransportContext, Type, UuidSchema, createHttpHandler, createHttpRouteResolver, createOpenApi, createTokenAuthorization, createTokenVerifier, defineErrors, err, isJsonMediaType, isPublicOperation, isResult, matchesScopes, maximus, ok, operationMatchesScopes, operationScopes, pageLimit, parseInput, parseSchema, projectToken, protectedResourceMetadata, readBodyBytes, readBodyText, readJsonBody, readJsonResponse, reportUnexpected, resultSchema, retryAfterSeconds, standardErrors, t };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { i as parseSchema, r as parseInput } from "./chunks/validation-
|
|
2
|
-
import { i as standardErrors, n as defineErrors, r as resultSchema, t as FailureSchema } from "./chunks/errors-
|
|
3
|
-
import { n as readBodyBytes, r as readBodyText } from "./chunks/body-
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
8
|
-
import { i as
|
|
9
|
-
import { i as
|
|
10
|
-
import {
|
|
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";
|
|
3
|
+
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";
|
|
11
12
|
|
|
12
|
-
export { AttachmentOutputSchema, DeletedObjectSchema, EmailAddressSchema, EmptyInputSchema, FailureSchema, HexColorSchema, HttpsUrlSchema, NamedReferenceSchema, OrganizationIdSchema, Page, PageInfoSchema, PageQueryFields, PhoneNumberSchema, PostalAddressSchema, PrincipalSchema, SignedUrlSchema, Type, UuidSchema, createHttpHandler, createHttpRouteResolver, createOpenApi, createTokenAuthorization, createTokenVerifier, defineErrors, err, isJsonMediaType, isPublicOperation, isResult, matchesScopes, maximus, ok, operationMatchesScopes, operationScopes, pageLimit, parseInput, parseSchema, projectToken, protectedResourceMetadata, readBodyBytes, readBodyText, readJsonBody, readJsonResponse, reportUnexpected, resultSchema, retryAfterSeconds, standardErrors, t };
|
|
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 };
|
package/dist/internals.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
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
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 };
|
package/dist/internals.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as createHttpRouteResolver } from "./chunks/http-paths-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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";
|
|
5
6
|
|
|
6
7
|
export { composeOperations, createHttpRouteResolver, defineApp, executeOperation, operation, operationScopes, recordExecution, telemetryEnabled, withDiagnostics };
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { O as HttpTransport } from "../chunks/types-DTIuIEJ-.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
|
|
5
5
|
* resources, guides as prompts and skills through the Skills extension. A caller needs `<namespace>:mcp:use`
|
|
6
|
-
* and sees only the tools its scopes admit.
|
|
6
|
+
* and sees only the tools its scopes and actor kind admit. Each message of a JSON-RPC batch passes the rate
|
|
7
|
+
* limit as a request of its own, and each call is held to its operation's body limit.
|
|
7
8
|
*/
|
|
8
9
|
export declare function mcp(options?: {
|
|
9
10
|
path?: string;
|