@arbol-ai/maximus 8.0.1 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics/analytics.d.ts +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/body.d.ts +1 -1
- package/dist/capture/index.d.ts +37 -0
- package/dist/capture/index.js +182 -0
- package/dist/chunks/{define-app-x7uY70_1.js → define-app-BxGZdNmS.js} +14 -3
- package/dist/chunks/delay-BsKQP_lF.js +12 -0
- package/dist/chunks/digest-C7UGt760.js +13 -0
- package/dist/chunks/{errors-C5w9WY1l.js → errors-CWgE9uvM.js} +1 -1
- package/dist/chunks/execution-BTiAWA4n.js +264 -0
- package/dist/chunks/{http-layout-DS8DnPyu.js → http-layout-BvlbD__1.js} +1 -1
- package/dist/chunks/{openapi-CeolxIqa.js → openapi-BF3eCpux.js} +11 -20
- package/dist/chunks/{openapi-file-Bz9FRaE6.js → openapi-file-RcXoq0AF.js} +1 -1
- package/dist/chunks/{pages-iZTvFs5a.js → pages-BCksUeRf.js} +1 -1
- package/dist/chunks/{runtime-D94vx21X.js → runtime-D5eR9-Es.js} +38 -9
- package/dist/chunks/{schemas-p_aRcMC1.js → schemas-BOFxZP1c.js} +1 -1
- package/dist/chunks/{server-Bzf1Q1_4.js → server-B9C8KPwa.js} +5 -4
- package/dist/chunks/{src-CPrJpbOM.js → src-C-4z443M.js} +61 -15
- package/dist/chunks/{telemetry-C3LfZcOB.js → telemetry-BtxJh69Q.js} +4 -4
- package/dist/chunks/{types-DTIuIEJ-.d.ts → types-Dqo3oGig.d.ts} +236 -31
- package/dist/chunks/{validation-fTohBT6R.js → validation-DMu0rkMQ.js} +266 -16
- package/dist/chunks/{workers-types-BRk_Xa_5.d.ts → workers-types-BgjyDtGd.d.ts} +1 -1
- package/dist/diagnostics.d.ts +1 -1
- package/dist/diagnostics.js +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +1 -1
- package/dist/http-paths.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/internals.d.ts +2 -2
- package/dist/internals.js +5 -5
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/project/config.d.ts +1 -1
- package/dist/project/index.d.ts +2 -2
- package/dist/project/index.js +3 -3
- package/dist/schemas.d.ts +2 -2
- package/dist/schemas.js +3 -3
- package/dist/standard-failures.d.ts +1 -1
- package/dist/tooling/cli.js +1 -1
- package/dist/vite/index.d.ts +2 -2
- package/dist/vite/index.js +12 -7
- package/dist/webhooks.d.ts +1 -1
- package/dist/workers/runtime.d.ts +1 -1
- package/dist/workers/runtime.js +1 -1
- package/package.json +5 -1
- package/skills/maximus/SKILL.md +7 -0
- package/skills/maximus/references/project.md +4 -0
- package/skills/maximus/references/routes-and-tools.md +2 -0
- package/templates/project/CLAUDE.md.template +3 -3
- package/templates/project/README.md.template +1 -0
- package/templates/project/tsconfig.json.template +1 -0
- package/dist/chunks/execution-rOiLo8VG.js +0 -84
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { t as STANDARD_FAILURES } from "./standard-failures-Lh4mSfwG.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { C as wireInput, T as withoutSecretKeyword, i as parseInput } from "./validation-DMu0rkMQ.js";
|
|
3
|
+
import { t as isRecord } from "./record-DQUDTpEA.js";
|
|
4
|
+
import { i as standardErrors } from "./errors-CWgE9uvM.js";
|
|
4
5
|
import { a as operationPathParameters } from "./http-paths-DMBxwpp6.js";
|
|
5
6
|
import { a as routeGroup, i as pathParameterSchemas, r as ok, t as err } from "./result-CKgZHrnj.js";
|
|
6
|
-
import {
|
|
7
|
-
import { i as UuidSchema, n as OrganizationIdSchema } from "./schemas-p_aRcMC1.js";
|
|
7
|
+
import { i as UuidSchema, n as OrganizationIdSchema } from "./schemas-BOFxZP1c.js";
|
|
8
8
|
import { t as queryKind } from "./query-kind-CWKAXEME.js";
|
|
9
|
+
import { t as sha256Hex } from "./digest-C7UGt760.js";
|
|
9
10
|
import { Type } from "@sinclair/typebox";
|
|
10
11
|
import { createRemoteJWKSet, jwtVerify } from "jose";
|
|
11
12
|
|
|
@@ -426,10 +427,12 @@ function replaceReferences(value, replace) {
|
|
|
426
427
|
* against its enclosing `$id`, as in JSON Schema; structurally different definitions that share an
|
|
427
428
|
* `$id` (for example a normalized input projection and its output) become distinct components. A
|
|
428
429
|
* reference outside any definition must name exactly one variant. Use-site annotations stay beside
|
|
429
|
-
* the reference. The owner's runtime schemas are not
|
|
430
|
+
* the reference, and `secret`, which only capture reads, is left out. The owner's runtime schemas are not
|
|
431
|
+
* changed.
|
|
430
432
|
*/
|
|
431
433
|
function bundleSchemas(sources, existing) {
|
|
432
|
-
const
|
|
434
|
+
const published = sources.map((source) => withoutSecretKeyword(source));
|
|
435
|
+
const ids = schemaIds(published);
|
|
433
436
|
const components = {};
|
|
434
437
|
const variants = /* @__PURE__ */ new Map();
|
|
435
438
|
const taken = new Set(Object.keys(existing));
|
|
@@ -469,7 +472,7 @@ function bundleSchemas(sources, existing) {
|
|
|
469
472
|
return [key, rewrite(child, scope)];
|
|
470
473
|
}));
|
|
471
474
|
}
|
|
472
|
-
const rewritten =
|
|
475
|
+
const rewritten = published.map((source) => rewrite(source, /* @__PURE__ */ new Map()));
|
|
473
476
|
/**
|
|
474
477
|
* A pending reference as the one component its name has once every variant is known; refused when the name
|
|
475
478
|
* has several shapes or none.
|
|
@@ -740,18 +743,6 @@ function failureUnion(codes) {
|
|
|
740
743
|
};
|
|
741
744
|
}
|
|
742
745
|
|
|
743
|
-
// src/internal/digest.ts
|
|
744
|
-
/**
|
|
745
|
-
* SHA-256 digests in hexadecimal, for rate limit keys, the development token's comparison and skill
|
|
746
|
-
* manifests.
|
|
747
|
-
*/
|
|
748
|
-
/** The SHA-256 digest of text or bytes, in lowercase hexadecimal. */
|
|
749
|
-
async function sha256Hex(value) {
|
|
750
|
-
const bytes = typeof value === "string" ? new TextEncoder().encode(value) : value;
|
|
751
|
-
const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", bytes));
|
|
752
|
-
return Array.from(digest, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
753
|
-
}
|
|
754
|
-
|
|
755
746
|
// src/tokens.ts
|
|
756
747
|
/**
|
|
757
748
|
* Token verification: the principal every operation receives, the token policy, OAuth access token
|
|
@@ -1585,4 +1576,4 @@ function securitySchemes(tokens, scopes) {
|
|
|
1585
1576
|
};
|
|
1586
1577
|
}
|
|
1587
1578
|
|
|
1588
|
-
export { operationOutputLimit as A, MAX_BODY_BYTES_CEILING as C, mcpOpenWorld as D, isPublicOperation as E, isNamespacedScope as M, matchesScopes as N, operation as O, DEFAULT_MAX_BODY_BYTES as S, composeOperations as T, projectAccessToken as _, createTokenVerifier as a, ADMISSION_CODES as b,
|
|
1579
|
+
export { operationOutputLimit as A, MAX_BODY_BYTES_CEILING as C, mcpOpenWorld as D, isPublicOperation as E, isNamespacedScope as M, matchesScopes as N, operation as O, DEFAULT_MAX_BODY_BYTES as S, composeOperations as T, projectAccessToken as _, createTokenVerifier as a, ADMISSION_CODES as b, tokenAudiences as c, canonical as d, hasSchemaReferences as f, isCrossSiteWrite as g, queryKinds as h, createTokenAuthorization as i, operationScopes as j, operationMatchesScopes as k, tokenIssuer as l, queryInput as m, createRpcOpenApi as n, presentedToken as o, standaloneSchema as p, checkTokenAuthority as r, projectToken as s, createOpenApi as t, usesOwnBearer as u, usesCloudflareAccess as v, STANDARD_CODES as w, BODY_CODES as x, PrincipalSchema as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createRpcOpenApi } from "./openapi-
|
|
1
|
+
import { n as createRpcOpenApi } from "./openapi-BF3eCpux.js";
|
|
2
2
|
import { t as prepareConfiguredProject } from "./prepare-configured-Cithjf80.js";
|
|
3
3
|
import { t as packageDirectory } from "./scaffold-DZD6dfoZ.js";
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as parseInput } from "./validation-DMu0rkMQ.js";
|
|
2
2
|
import { r as isRequestId } from "./correlation-4b23a-a4.js";
|
|
3
|
-
import { i as standardErrors } from "./errors-
|
|
3
|
+
import { i as standardErrors } from "./errors-CWgE9uvM.js";
|
|
4
4
|
import { r as ok, t as err } from "./result-CKgZHrnj.js";
|
|
5
|
-
import { y as PrincipalSchema } from "./openapi-
|
|
6
|
-
import { r as createHttpHandler } from "./src-
|
|
7
|
-
import { a as
|
|
8
|
-
import { t as executeOperation } from "./execution-
|
|
5
|
+
import { y as PrincipalSchema } from "./openapi-BF3eCpux.js";
|
|
6
|
+
import { r as createHttpHandler } from "./src-C-4z443M.js";
|
|
7
|
+
import { a as recordExecution, l as withTelemetry, o as reportUnexpected, s as telemetryEnabled } from "./telemetry-BtxJh69Q.js";
|
|
8
|
+
import { n as recordCapture, t as executeOperation } from "./execution-BTiAWA4n.js";
|
|
9
9
|
import { DurableObject, WorkerEntrypoint, tracing } from "cloudflare:workers";
|
|
10
10
|
|
|
11
11
|
// src/workers/assets.ts
|
|
@@ -200,13 +200,32 @@ function createWorker(application, options = {}) {
|
|
|
200
200
|
Object.defineProperty(Entrypoint.prototype, name, {
|
|
201
201
|
configurable: true,
|
|
202
202
|
async value(principal, input) {
|
|
203
|
+
const requestStarted = performance.now();
|
|
203
204
|
const props = this.ctx.props;
|
|
204
|
-
if (!props || Object.keys(props).length !== 1 || typeof props.caller !== "string" || !callers.includes(props.caller)) return err(standardErrors.unauthorized.create());
|
|
205
205
|
const parsed = parseInput(PrincipalSchema, principal);
|
|
206
|
-
|
|
206
|
+
/**
|
|
207
|
+
* Refuses the call, and captures the refusal: the principal it names is unverified, so the record keeps
|
|
208
|
+
* its request id, for correlation, and never its organization or actor.
|
|
209
|
+
*/
|
|
210
|
+
const refuse = () => {
|
|
211
|
+
const refusal = err(standardErrors.unauthorized.create());
|
|
212
|
+
recordCapture(manifest, this.env, this.ctx, {
|
|
213
|
+
operation: name,
|
|
214
|
+
surface: "rpc",
|
|
215
|
+
requestId: parsed.ok ? parsed.value.requestId : crypto.randomUUID(),
|
|
216
|
+
principal: null,
|
|
217
|
+
requestStarted,
|
|
218
|
+
result: refusal,
|
|
219
|
+
call: typeof props?.caller === "string" ? { rpcCaller: props.caller.slice(0, 64) } : {}
|
|
220
|
+
});
|
|
221
|
+
return refusal;
|
|
222
|
+
};
|
|
223
|
+
if (!props || Object.keys(props).length !== 1 || typeof props.caller !== "string" || !callers.includes(props.caller)) return refuse();
|
|
224
|
+
if (!parsed.ok) return refuse();
|
|
207
225
|
if (telemetryEnabled(manifest.telemetry, this.env)) annotateInvocation(manifest.name, name, parsed.value.requestId);
|
|
226
|
+
const call = { rpcCaller: props.caller };
|
|
208
227
|
const started = performance.now();
|
|
209
|
-
const result = await withTelemetry(manifest.telemetry, this.env, () => executeOperation(manifest, op, this.env, parsed.value, input, void 0, this.ctx));
|
|
228
|
+
const result = await withTelemetry(manifest.telemetry, this.env, () => executeOperation(manifest, op, this.env, parsed.value, input, void 0, this.ctx, void 0, call));
|
|
210
229
|
recordExecution(manifest, this.env, this.ctx, {
|
|
211
230
|
principal: parsed.value,
|
|
212
231
|
operation: name,
|
|
@@ -214,6 +233,16 @@ function createWorker(application, options = {}) {
|
|
|
214
233
|
started,
|
|
215
234
|
result
|
|
216
235
|
});
|
|
236
|
+
recordCapture(manifest, this.env, this.ctx, {
|
|
237
|
+
operation: name,
|
|
238
|
+
surface: "rpc",
|
|
239
|
+
requestId: parsed.value.requestId,
|
|
240
|
+
principal: parsed.value,
|
|
241
|
+
requestStarted,
|
|
242
|
+
executionStarted: started,
|
|
243
|
+
result,
|
|
244
|
+
call
|
|
245
|
+
});
|
|
217
246
|
return result;
|
|
218
247
|
}
|
|
219
248
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as SchemaValidationError, f as inputSchema, l as defaultSchema, o as codecFault, r as decodeSchema, s as decodeIssues } from "./validation-DMu0rkMQ.js";
|
|
2
2
|
import { Kind, Type, Type as Type$1, Type as t } from "@sinclair/typebox";
|
|
3
3
|
|
|
4
4
|
// src/schema-reader.ts
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as standardErrors } from "./errors-
|
|
3
|
-
import { C as MAX_BODY_BYTES_CEILING, D as mcpOpenWorld, d as canonical, k as operationMatchesScopes, p as standaloneSchema
|
|
4
|
-
import {
|
|
1
|
+
import { C as wireInput } from "./validation-DMu0rkMQ.js";
|
|
2
|
+
import { i as standardErrors } from "./errors-CWgE9uvM.js";
|
|
3
|
+
import { C as MAX_BODY_BYTES_CEILING, D as mcpOpenWorld, d as canonical, k as operationMatchesScopes, p as standaloneSchema } from "./openapi-BF3eCpux.js";
|
|
4
|
+
import { t as sha256Hex } from "./digest-C7UGt760.js";
|
|
5
|
+
import { o as reportUnexpected } from "./telemetry-BtxJh69Q.js";
|
|
5
6
|
import { t as toYaml } from "./yaml-Dk2L24yQ.js";
|
|
6
7
|
import { Type } from "@sinclair/typebox";
|
|
7
8
|
import { Value } from "@sinclair/typebox/value";
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { i as standardErrors } from "./errors-
|
|
1
|
+
import { i as standardErrors } from "./errors-CWgE9uvM.js";
|
|
2
2
|
import { r as readBodyText } from "./body-DOIHwIIl.js";
|
|
3
|
-
import { i as binaryBody, n as defineApp, r as attachmentResponse } from "./define-app-
|
|
3
|
+
import { i as binaryBody, n as defineApp, r as attachmentResponse } from "./define-app-BxGZdNmS.js";
|
|
4
4
|
import { t as createHttpRouteResolver } from "./http-paths-DMBxwpp6.js";
|
|
5
5
|
import { r as ok, t as err } from "./result-CKgZHrnj.js";
|
|
6
|
-
import { E as isPublicOperation, S as DEFAULT_MAX_BODY_BYTES, T as composeOperations, c as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { E as isPublicOperation, S as DEFAULT_MAX_BODY_BYTES, T as composeOperations, c as tokenAudiences, g as isCrossSiteWrite, h as queryKinds, i as createTokenAuthorization, j as operationScopes, k as operationMatchesScopes, l as tokenIssuer, m as queryInput, o as presentedToken, t as createOpenApi } from "./openapi-BF3eCpux.js";
|
|
7
|
+
import { t as sha256Hex } from "./digest-C7UGt760.js";
|
|
8
|
+
import { a as recordExecution, i as recordAdmission, l as withTelemetry, o as reportUnexpected, s as telemetryEnabled } from "./telemetry-BtxJh69Q.js";
|
|
9
|
+
import { n as recordCapture, t as executeOperation } from "./execution-BTiAWA4n.js";
|
|
10
|
+
import { a as ownsPrefix, i as nativePaths, n as composition, o as servesCloudflareAccess, r as httpTransports, s as servesOwnBearer, t as VERSIONED_PATH } from "./http-layout-BvlbD__1.js";
|
|
10
11
|
import { n as mediaType } from "./json-B14evE6-.js";
|
|
11
12
|
import { t as toYaml } from "./yaml-Dk2L24yQ.js";
|
|
12
13
|
import { Type as Type$1, Type as t } from "@sinclair/typebox";
|
|
@@ -282,6 +283,8 @@ function createHttpHandler(manifest, hooks = {}) {
|
|
|
282
283
|
let surface = "http";
|
|
283
284
|
let plain = false;
|
|
284
285
|
let requestEnv = env;
|
|
286
|
+
let verified;
|
|
287
|
+
const userAgent = incoming.headers.get("user-agent")?.slice(0, 200) || void 0;
|
|
285
288
|
const context = {
|
|
286
289
|
requestId,
|
|
287
290
|
fail: (error, headers) => failure(error, requestId, resolutionContext(), headers),
|
|
@@ -304,6 +307,19 @@ function createHttpHandler(manifest, hooks = {}) {
|
|
|
304
307
|
applicationScopes,
|
|
305
308
|
background
|
|
306
309
|
});
|
|
310
|
+
/** Captures a refusal before execution, of this request's operation or the one a transport names. */
|
|
311
|
+
function captureRefusal(error, refused, scopedEnv) {
|
|
312
|
+
recordCapture(manifest, scopedEnv, background, {
|
|
313
|
+
operation: refused,
|
|
314
|
+
surface,
|
|
315
|
+
requestId,
|
|
316
|
+
principal,
|
|
317
|
+
...verified ? { verified } : {},
|
|
318
|
+
requestStarted: started,
|
|
319
|
+
result: err(error),
|
|
320
|
+
call: userAgent ? { userAgent } : {}
|
|
321
|
+
});
|
|
322
|
+
}
|
|
307
323
|
/** A refusal before execution, observed as a rejected admission. */
|
|
308
324
|
function reject(error) {
|
|
309
325
|
recordAdmission(manifest, requestEnv, background, {
|
|
@@ -314,6 +330,7 @@ function createHttpHandler(manifest, hooks = {}) {
|
|
|
314
330
|
started,
|
|
315
331
|
errorCode: error.code
|
|
316
332
|
});
|
|
333
|
+
captureRefusal(error, operation, requestEnv);
|
|
317
334
|
return failure(error, requestId, resolutionContext());
|
|
318
335
|
}
|
|
319
336
|
/**
|
|
@@ -386,6 +403,14 @@ function createHttpHandler(manifest, hooks = {}) {
|
|
|
386
403
|
requestId
|
|
387
404
|
};
|
|
388
405
|
principal = actor;
|
|
406
|
+
if (manifest.capture) {
|
|
407
|
+
const token = presentedToken(incoming, manifest.tokens);
|
|
408
|
+
verified = {
|
|
409
|
+
scopes: authenticated.scopes,
|
|
410
|
+
...authenticated.client ? { client: authenticated.client } : {},
|
|
411
|
+
...token ? { token } : {}
|
|
412
|
+
};
|
|
413
|
+
}
|
|
389
414
|
if (!await withinRateLimit(scopedEnv, authenticated)) return reject(standardErrors.rateLimited.create());
|
|
390
415
|
let request = incoming;
|
|
391
416
|
let bodyText = "";
|
|
@@ -415,22 +440,31 @@ function createHttpHandler(manifest, hooks = {}) {
|
|
|
415
440
|
* Runs one operation through the shared execution path as the admitted caller, and records the call.
|
|
416
441
|
*/
|
|
417
442
|
async function invoke(name, op, input) {
|
|
418
|
-
if (transport && !operations.some(([selectedName, selected]) => selectedName === name && selected === op))
|
|
419
|
-
|
|
420
|
-
error
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}
|
|
443
|
+
if (transport && !operations.some(([selectedName, selected]) => selectedName === name && selected === op)) {
|
|
444
|
+
const error = standardErrors.notFound.create();
|
|
445
|
+
captureRefusal(error, null, scopedEnv);
|
|
446
|
+
return {
|
|
447
|
+
ok: false,
|
|
448
|
+
error
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
if (transport && !operationMatchesScopes(op, authenticated.scopes)) {
|
|
452
|
+
const error = standardErrors.forbidden.create();
|
|
453
|
+
captureRefusal(error, name, scopedEnv);
|
|
454
|
+
return {
|
|
455
|
+
ok: false,
|
|
456
|
+
error
|
|
457
|
+
};
|
|
458
|
+
}
|
|
426
459
|
if (telemetryEnabled(manifest.telemetry, scopedEnv)) hooks.annotate?.(name, requestId);
|
|
460
|
+
const call = userAgent ? { userAgent } : {};
|
|
427
461
|
const invocationStarted = performance.now();
|
|
428
462
|
const output = await executeOperation(manifest, op, scopedEnv, actor, input, authenticated.client ? {
|
|
429
463
|
surface: transport ? "mcp" : "http",
|
|
430
464
|
scopes: authenticated.scopes,
|
|
431
465
|
client: authenticated.client,
|
|
432
466
|
...accessToken ? { token: accessToken } : {}
|
|
433
|
-
} : void 0, background, byteOperation ? binaryBody(incoming, op.maxBodyBytes ?? fallbackBodyBytes) : void 0);
|
|
467
|
+
} : void 0, background, byteOperation ? binaryBody(incoming, op.maxBodyBytes ?? fallbackBodyBytes) : void 0, call);
|
|
434
468
|
recordExecution(manifest, scopedEnv, background, {
|
|
435
469
|
principal: actor,
|
|
436
470
|
operation: name,
|
|
@@ -438,6 +472,17 @@ function createHttpHandler(manifest, hooks = {}) {
|
|
|
438
472
|
started: invocationStarted,
|
|
439
473
|
result: output
|
|
440
474
|
});
|
|
475
|
+
recordCapture(manifest, scopedEnv, background, {
|
|
476
|
+
operation: name,
|
|
477
|
+
surface: transport ? "mcp" : "http",
|
|
478
|
+
requestId,
|
|
479
|
+
principal: actor,
|
|
480
|
+
...verified ? { verified } : {},
|
|
481
|
+
requestStarted: started,
|
|
482
|
+
executionStarted: invocationStarted,
|
|
483
|
+
result: output,
|
|
484
|
+
call
|
|
485
|
+
});
|
|
441
486
|
return output;
|
|
442
487
|
}
|
|
443
488
|
if (transport) return transport.handle({
|
|
@@ -460,6 +505,7 @@ function createHttpHandler(manifest, hooks = {}) {
|
|
|
460
505
|
started,
|
|
461
506
|
errorCode: error.code
|
|
462
507
|
});
|
|
508
|
+
captureRefusal(error, name ?? null, scopedEnv);
|
|
463
509
|
},
|
|
464
510
|
body: bodyText,
|
|
465
511
|
bodyLimit: (op) => op.maxBodyBytes ?? fallbackBodyBytes
|
|
@@ -95,9 +95,9 @@ function createDiagnostics(errorNames = []) {
|
|
|
95
95
|
* Telemetry: invocation-local diagnostics kept in AsyncLocalStorage, safe native log events, and observers
|
|
96
96
|
* that receive execution and admission observations as background work.
|
|
97
97
|
*/
|
|
98
|
-
/** Microseconds
|
|
99
|
-
function elapsedMicros(started) {
|
|
100
|
-
return Math.max(0, Math.round((
|
|
98
|
+
/** Microseconds from `started` to `until` or now, each a `performance.now()` reading. */
|
|
99
|
+
function elapsedMicros(started, until = performance.now()) {
|
|
100
|
+
return Math.max(0, Math.round((until - started) * 1e3));
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
103
103
|
* Hands one event to one observer as background work: a failed delivery is logged with its request id
|
|
@@ -236,4 +236,4 @@ function recordExecution(manifest, env, background, invocation) {
|
|
|
236
236
|
for (const observer of manifest.telemetry?.observers ?? []) if (observer.execution) deliver(background, event.principal.requestId, () => observer.execution?.(event, env));
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
export {
|
|
239
|
+
export { recordExecution as a, withDiagnostics as c, recordAdmission as i, withTelemetry as l, diagnosticsEnabled as n, reportUnexpected as o, elapsedMicros as r, telemetryEnabled as s, activeTraceId as t, createDiagnostics as u };
|