@economic/agents 0.0.1-alpha.21 → 0.0.1-alpha.22

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/index.d.mts CHANGED
@@ -184,7 +184,7 @@ declare abstract class AIChatAgent<Env extends Cloudflare.Env = Cloudflare.Env>
184
184
  * Typical uses include auth, rate limits, or feature flags — all logic lives here;
185
185
  * the `guard` decorator only forwards `body` and handles the return shape.
186
186
  */
187
- type GuardFn<TBody = Record<string, unknown>> = (body: TBody | undefined) => Response | void | Promise<Response | void>;
187
+ type GuardFn<TBody = Record<string, unknown>> = (body: TBody) => Response | void | Promise<Response | void>;
188
188
  /**
189
189
  * Method decorator (TypeScript 5+ stage-3) that runs `guardFn` with the second
190
190
  * argument's `body` (the chat request body). If `guardFn` returns a
@@ -213,7 +213,7 @@ type GuardFn<TBody = Record<string, unknown>> = (body: TBody | undefined) => Res
213
213
  * }
214
214
  * ```
215
215
  */
216
- declare function guard<TBody = Record<string, unknown>>(guardFn: GuardFn<TBody>): (target: (...args: unknown[]) => Promise<Response>, _context: ClassMethodDecoratorContext) => (this: unknown, ...args: unknown[]) => Promise<Response>;
216
+ declare function guard<TBody = Record<string, unknown>>(guardFn: GuardFn<TBody>): (target: (...args: any[]) => Promise<Response>, _context: ClassMethodDecoratorContext) => (this: unknown, ...args: unknown[]) => Promise<Response>;
217
217
  //#endregion
218
218
  //#region src/types.d.ts
219
219
  /**
package/dist/index.mjs CHANGED
@@ -3982,7 +3982,7 @@ function guard(guardFn) {
3982
3982
  return function(target, _context) {
3983
3983
  return async function(...args) {
3984
3984
  const options = args[1];
3985
- const result = await guardFn(options?.body);
3985
+ const result = await guardFn(options?.body ?? {});
3986
3986
  if (result instanceof Response) return result;
3987
3987
  return target.apply(this, args);
3988
3988
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@economic/agents",
3
- "version": "0.0.1-alpha.21",
3
+ "version": "0.0.1-alpha.22",
4
4
  "description": "A starter for creating a TypeScript package.",
5
5
  "homepage": "https://github.com/author/library#readme",
6
6
  "bugs": {