@standardagents/builder 0.41.6 → 0.41.8

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/packing.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { P as PackingAnalysis, a as PackingOptions, b as PackingResult, U as UnpackAnalysis, c as UnpackOptions, d as UnpackResult } from './types-D1ABHvAH.js';
2
- export { D as DiscoveredPackage } from './types-D1ABHvAH.js';
3
- export { P as PackageDiscoveryService, d as discoverPackages } from './discovery-CIGNVJfG.js';
1
+ import { P as PackingAnalysis, a as PackingOptions, b as PackingResult, d as UnpackAnalysis, U as UnpackOptions, c as UnpackResult } from './types-Dhd0M369.js';
2
+ export { D as DiscoveredPackage } from './types-Dhd0M369.js';
3
+ export { P as PackageDiscoveryService, d as discoverPackages } from './discovery-D5pmuazY.js';
4
4
  import '@standardagents/spec';
5
5
 
6
6
  /**
package/dist/plugin.js CHANGED
@@ -7891,6 +7891,8 @@ import {
7891
7891
  applyRuntimeCors,
7892
7892
  runtimeCorsHeaders,
7893
7893
  runtimePreflightResponse,
7894
+ formatUpstreamTiming,
7895
+ withUpstreamTiming,
7894
7896
  } from "@standardagents/builder/runtime";
7895
7897
  import { isThreadEndpoint, getEndpointAccess } from "@standardagents/spec";
7896
7898
 
@@ -8015,13 +8017,19 @@ ${packedThreadRouteCode}
8015
8017
  // thread id, for same-request reuse by controllers (AB-05). Never cached
8016
8018
  // across requests.
8017
8019
  let threadAccess = null;
8020
+ // The request handed to the controller. A protected API request carries
8021
+ // x-standard-upstream-timing with the authentication cost; the header is
8022
+ // overwritten, never merged, so a caller cannot forge upstream time.
8023
+ let controllerRequest = request;
8018
8024
 
8019
8025
  // Require authentication for all API routes except public ones.
8020
8026
  // WebSocket tickets are single-use and are consumed here. Controllers
8021
8027
  // must reuse context.auth (resolveRequestAuth) rather than calling
8022
8028
  // requireAuth again, or a ticket-only upgrade will 401.
8023
8029
  if (isApiRoute && !publicRoute) {
8030
+ const authStartedAt = Date.now();
8024
8031
  const authResult = await requireAuth(request, env);
8032
+ controllerRequest = withUpstreamTiming(request, formatUpstreamTiming('auth', Date.now() - authStartedAt));
8025
8033
 
8026
8034
  // If requireAuth returns a Response, it's an error (401)
8027
8035
  if (authResult instanceof Response) {
@@ -8078,7 +8086,7 @@ ${packedThreadRouteCode}
8078
8086
  }
8079
8087
 
8080
8088
  const context = {
8081
- req: request,
8089
+ req: controllerRequest,
8082
8090
  params: routeMatch.params || {},
8083
8091
  env: env,
8084
8092
  url: url,