@agent-score/commerce 2.4.0 → 2.5.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.
Files changed (59) hide show
  1. package/dist/challenge/index.d.mts +5 -1
  2. package/dist/challenge/index.d.ts +5 -1
  3. package/dist/challenge/index.js +11 -4
  4. package/dist/challenge/index.js.map +1 -1
  5. package/dist/challenge/index.mjs +11 -4
  6. package/dist/challenge/index.mjs.map +1 -1
  7. package/dist/{checkout-B-MIzYzW.d.ts → checkout-McfNpZJf.d.ts} +72 -1
  8. package/dist/{checkout-Bn7ZKIBD.d.mts → checkout-o17dIxHi.d.mts} +72 -1
  9. package/dist/core.d.mts +23 -1
  10. package/dist/core.d.ts +23 -1
  11. package/dist/core.js +25 -11
  12. package/dist/core.js.map +1 -1
  13. package/dist/core.mjs +25 -11
  14. package/dist/core.mjs.map +1 -1
  15. package/dist/discovery/index.d.mts +17 -2
  16. package/dist/discovery/index.d.ts +17 -2
  17. package/dist/discovery/index.js +14 -4
  18. package/dist/discovery/index.js.map +1 -1
  19. package/dist/discovery/index.mjs +14 -4
  20. package/dist/discovery/index.mjs.map +1 -1
  21. package/dist/gate-CWP10xPQ.d.mts +339 -0
  22. package/dist/gate-CWP10xPQ.d.ts +339 -0
  23. package/dist/identity/express.d.mts +26 -1
  24. package/dist/identity/express.d.ts +26 -1
  25. package/dist/identity/express.js +587 -13
  26. package/dist/identity/express.js.map +1 -1
  27. package/dist/identity/express.mjs +583 -12
  28. package/dist/identity/express.mjs.map +1 -1
  29. package/dist/identity/fastify.d.mts +12 -2
  30. package/dist/identity/fastify.d.ts +12 -2
  31. package/dist/identity/fastify.js +595 -13
  32. package/dist/identity/fastify.js.map +1 -1
  33. package/dist/identity/fastify.mjs +591 -12
  34. package/dist/identity/fastify.mjs.map +1 -1
  35. package/dist/identity/hono.d.mts +26 -1
  36. package/dist/identity/hono.d.ts +26 -1
  37. package/dist/identity/hono.js +576 -13
  38. package/dist/identity/hono.js.map +1 -1
  39. package/dist/identity/hono.mjs +572 -12
  40. package/dist/identity/hono.mjs.map +1 -1
  41. package/dist/identity/nextjs.d.mts +3 -0
  42. package/dist/identity/nextjs.d.ts +3 -0
  43. package/dist/identity/nextjs.js +581 -13
  44. package/dist/identity/nextjs.js.map +1 -1
  45. package/dist/identity/nextjs.mjs +577 -12
  46. package/dist/identity/nextjs.mjs.map +1 -1
  47. package/dist/identity/web.d.mts +24 -1
  48. package/dist/identity/web.d.ts +24 -1
  49. package/dist/identity/web.js +581 -13
  50. package/dist/identity/web.js.map +1 -1
  51. package/dist/identity/web.mjs +577 -12
  52. package/dist/identity/web.mjs.map +1 -1
  53. package/dist/index.d.mts +119 -3
  54. package/dist/index.d.ts +119 -3
  55. package/dist/index.js +893 -35
  56. package/dist/index.js.map +1 -1
  57. package/dist/index.mjs +873 -35
  58. package/dist/index.mjs.map +1 -1
  59. package/package.json +11 -11
@@ -1,4 +1,6 @@
1
+ import { b as AipGateOptions, r as buildAipErrorBody, V as VerifiedAit } from '../gate-CWP10xPQ.mjs';
1
2
  import { AgentScoreCoreOptions, AgentIdentity, DenialReason, CreateSessionOnMissing, AssessResult, SignerVerdict, FailOpenInfraReason, GateQuotaInfo } from '../core.mjs';
3
+ import 'jose';
2
4
  import '../signer-3FAit11j.mjs';
3
5
 
4
6
  interface AgentScoreGateOptions extends Omit<AgentScoreCoreOptions, 'createSessionOnMissing'> {
@@ -96,5 +98,26 @@ declare function createConditionalAgentScoreGate(options: AgentScoreGateOptions)
96
98
  /** Wrapper variant matching `withAgentScoreGate(opts, handler)` that only
97
99
  * invokes the gate when a payment credential is attached. */
98
100
  declare function withConditionalAgentScoreGate<TCtx = unknown>(options: AgentScoreGateOptions, handler: Parameters<typeof withAgentScoreGate<TCtx>>[1]): (req: Request, ctx: TCtx) => Promise<Response>;
101
+ type AipGuardResult = {
102
+ allowed: true;
103
+ ait: VerifiedAit;
104
+ } | {
105
+ allowed: false;
106
+ response: Response;
107
+ };
108
+ interface AipGateWebOptions extends AipGateOptions {
109
+ /** Custom denial responder. Defaults to a 401/403 `application/problem+json` Response. */
110
+ onDenied?: (req: Request, body: ReturnType<typeof buildAipErrorBody>) => Response | Promise<Response>;
111
+ }
112
+ /** Create a Web Fetch AIP guard: returns `{ allowed, ait }` or `{ allowed: false, response }`. */
113
+ declare function createAipGate(options: AipGateWebOptions): (req: Request) => Promise<AipGuardResult>;
114
+ /** Wrap a Web Fetch handler with the AIP gate. Denied requests return the problem+json Response. */
115
+ declare function withAipGate<TCtx = unknown>(options: AipGateWebOptions, handler: (req: Request, gate: {
116
+ ait: VerifiedAit;
117
+ }, ctx?: TCtx) => Response | Promise<Response>): (req: Request, ctx?: TCtx) => Promise<Response>;
118
+ /** Conditional variant: only runs the AIP gate when an `Agent-Identity` header is present. */
119
+ declare function withConditionalAipGate<TCtx = unknown>(options: AipGateWebOptions, handler: (req: Request, gate: {
120
+ ait?: VerifiedAit;
121
+ }, ctx?: TCtx) => Response | Promise<Response>): (req: Request, ctx?: TCtx) => Promise<Response>;
99
122
 
100
- export { type GuardResult, createAgentScoreGate, createConditionalAgentScoreGate, withAgentScoreGate, withConditionalAgentScoreGate };
123
+ export { type AipGateWebOptions, type AipGuardResult, type GuardResult, createAgentScoreGate, createAipGate, createConditionalAgentScoreGate, withAgentScoreGate, withAipGate, withConditionalAgentScoreGate, withConditionalAipGate };
@@ -1,4 +1,6 @@
1
+ import { b as AipGateOptions, r as buildAipErrorBody, V as VerifiedAit } from '../gate-CWP10xPQ.js';
1
2
  import { AgentScoreCoreOptions, AgentIdentity, DenialReason, CreateSessionOnMissing, AssessResult, SignerVerdict, FailOpenInfraReason, GateQuotaInfo } from '../core.js';
3
+ import 'jose';
2
4
  import '../signer-3FAit11j.js';
3
5
 
4
6
  interface AgentScoreGateOptions extends Omit<AgentScoreCoreOptions, 'createSessionOnMissing'> {
@@ -96,5 +98,26 @@ declare function createConditionalAgentScoreGate(options: AgentScoreGateOptions)
96
98
  /** Wrapper variant matching `withAgentScoreGate(opts, handler)` that only
97
99
  * invokes the gate when a payment credential is attached. */
98
100
  declare function withConditionalAgentScoreGate<TCtx = unknown>(options: AgentScoreGateOptions, handler: Parameters<typeof withAgentScoreGate<TCtx>>[1]): (req: Request, ctx: TCtx) => Promise<Response>;
101
+ type AipGuardResult = {
102
+ allowed: true;
103
+ ait: VerifiedAit;
104
+ } | {
105
+ allowed: false;
106
+ response: Response;
107
+ };
108
+ interface AipGateWebOptions extends AipGateOptions {
109
+ /** Custom denial responder. Defaults to a 401/403 `application/problem+json` Response. */
110
+ onDenied?: (req: Request, body: ReturnType<typeof buildAipErrorBody>) => Response | Promise<Response>;
111
+ }
112
+ /** Create a Web Fetch AIP guard: returns `{ allowed, ait }` or `{ allowed: false, response }`. */
113
+ declare function createAipGate(options: AipGateWebOptions): (req: Request) => Promise<AipGuardResult>;
114
+ /** Wrap a Web Fetch handler with the AIP gate. Denied requests return the problem+json Response. */
115
+ declare function withAipGate<TCtx = unknown>(options: AipGateWebOptions, handler: (req: Request, gate: {
116
+ ait: VerifiedAit;
117
+ }, ctx?: TCtx) => Response | Promise<Response>): (req: Request, ctx?: TCtx) => Promise<Response>;
118
+ /** Conditional variant: only runs the AIP gate when an `Agent-Identity` header is present. */
119
+ declare function withConditionalAipGate<TCtx = unknown>(options: AipGateWebOptions, handler: (req: Request, gate: {
120
+ ait?: VerifiedAit;
121
+ }, ctx?: TCtx) => Response | Promise<Response>): (req: Request, ctx?: TCtx) => Promise<Response>;
99
122
 
100
- export { type GuardResult, createAgentScoreGate, createConditionalAgentScoreGate, withAgentScoreGate, withConditionalAgentScoreGate };
123
+ export { type AipGateWebOptions, type AipGuardResult, type GuardResult, createAgentScoreGate, createAipGate, createConditionalAgentScoreGate, withAgentScoreGate, withAipGate, withConditionalAgentScoreGate, withConditionalAipGate };