@standardagents/builder 0.11.2 → 0.11.4

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/plugin.js CHANGED
@@ -2348,7 +2348,8 @@ import { hooks } from "virtual:@standardagents-hooks";
2348
2348
  import { models, modelNames } from "virtual:@standardagents-models";
2349
2349
  import { prompts, promptNames } from "virtual:@standardagents-prompts";
2350
2350
  import { agents, agentNames } from "virtual:@standardagents-agents";
2351
- import { requireAuth } from "@standardagents/builder/runtime";
2351
+ import { requireAuth, createThreadEndpointHandler } from "@standardagents/builder/runtime";
2352
+ import { isThreadEndpoint } from "@standardagents/spec";
2352
2353
 
2353
2354
  const MOUNT_POINT = "${mountPoint}";
2354
2355
 
@@ -2481,7 +2482,14 @@ ${threadRouteCode}
2481
2482
  authContext = authResult;
2482
2483
  }
2483
2484
 
2484
- const controller = await routeMatch.data();
2485
+ let controller = await routeMatch.data();
2486
+
2487
+ // Check if this is a thread endpoint (marked by defineThreadEndpoint)
2488
+ // If so, wrap it with createThreadEndpointHandler to provide ThreadState
2489
+ if (isThreadEndpoint(controller)) {
2490
+ controller = createThreadEndpointHandler(controller.__handler);
2491
+ }
2492
+
2485
2493
  const context = {
2486
2494
  req: request,
2487
2495
  params: routeMatch.params || {},