@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,5 +1,7 @@
1
+ import { b as AipGateOptions, r as buildAipErrorBody, V as VerifiedAit } from '../gate-CWP10xPQ.mjs';
1
2
  import { AgentScoreCoreOptions, AgentIdentity, DenialReason, CreateSessionOnMissing, AssessResult, FailOpenInfraReason, GateQuotaInfo, SignerVerdict } from '../core.mjs';
2
3
  import { Context, MiddlewareHandler } from 'hono';
4
+ import 'jose';
3
5
  import '../signer-3FAit11j.mjs';
4
6
 
5
7
  interface AgentScoreGateOptions extends Omit<AgentScoreCoreOptions, 'createSessionOnMissing'> {
@@ -93,5 +95,28 @@ declare function getSignerVerdict(c: Context): SignerVerdict | undefined;
93
95
  * wrap pattern in consumer codebases.
94
96
  */
95
97
  declare function conditionalAgentscoreGate(options: AgentScoreGateOptions): MiddlewareHandler;
98
+ interface AipGateHonoOptions extends AipGateOptions {
99
+ /** Custom denial responder. Defaults to a 401/403 `application/problem+json` Response. */
100
+ onDenied?: (c: Context, body: ReturnType<typeof buildAipErrorBody>) => Response | Promise<Response>;
101
+ }
102
+ /**
103
+ * Hono middleware that requires a valid AIT on every request it guards.
104
+ *
105
+ * ```ts
106
+ * import { JwksCache } from '@agent-score/commerce';
107
+ * import { aipGate, getVerifiedAit } from '@agent-score/commerce/identity/hono';
108
+ *
109
+ * const jwks = new JwksCache({ trustedIssuers: ['https://issuer.example'] }); // AgentScore always trusted
110
+ * app.post('/checkout', aipGate({ jwks }), (c) => {
111
+ * const ait = getVerifiedAit(c)!;
112
+ * return c.json({ buyer: ait.payload.identity?.email });
113
+ * });
114
+ * ```
115
+ */
116
+ declare function aipGate(options: AipGateHonoOptions): MiddlewareHandler;
117
+ /** Wrap {@link aipGate} so it only runs when an `Agent-Identity` header is present. */
118
+ declare function conditionalAipGate(options: AipGateHonoOptions): MiddlewareHandler;
119
+ /** Read the verified AIT attached to a Hono `Context` by {@link aipGate}. */
120
+ declare function getVerifiedAit(c: Context): VerifiedAit | undefined;
96
121
 
97
- export { agentscoreGate, captureWallet, conditionalAgentscoreGate, getAgentScoreData, getGateDegradedState, getGateQuotaInfo, getSignerVerdict };
122
+ export { type AipGateHonoOptions, agentscoreGate, aipGate, captureWallet, conditionalAgentscoreGate, conditionalAipGate, getAgentScoreData, getGateDegradedState, getGateQuotaInfo, getSignerVerdict, getVerifiedAit };
@@ -1,5 +1,7 @@
1
+ import { b as AipGateOptions, r as buildAipErrorBody, V as VerifiedAit } from '../gate-CWP10xPQ.js';
1
2
  import { AgentScoreCoreOptions, AgentIdentity, DenialReason, CreateSessionOnMissing, AssessResult, FailOpenInfraReason, GateQuotaInfo, SignerVerdict } from '../core.js';
2
3
  import { Context, MiddlewareHandler } from 'hono';
4
+ import 'jose';
3
5
  import '../signer-3FAit11j.js';
4
6
 
5
7
  interface AgentScoreGateOptions extends Omit<AgentScoreCoreOptions, 'createSessionOnMissing'> {
@@ -93,5 +95,28 @@ declare function getSignerVerdict(c: Context): SignerVerdict | undefined;
93
95
  * wrap pattern in consumer codebases.
94
96
  */
95
97
  declare function conditionalAgentscoreGate(options: AgentScoreGateOptions): MiddlewareHandler;
98
+ interface AipGateHonoOptions extends AipGateOptions {
99
+ /** Custom denial responder. Defaults to a 401/403 `application/problem+json` Response. */
100
+ onDenied?: (c: Context, body: ReturnType<typeof buildAipErrorBody>) => Response | Promise<Response>;
101
+ }
102
+ /**
103
+ * Hono middleware that requires a valid AIT on every request it guards.
104
+ *
105
+ * ```ts
106
+ * import { JwksCache } from '@agent-score/commerce';
107
+ * import { aipGate, getVerifiedAit } from '@agent-score/commerce/identity/hono';
108
+ *
109
+ * const jwks = new JwksCache({ trustedIssuers: ['https://issuer.example'] }); // AgentScore always trusted
110
+ * app.post('/checkout', aipGate({ jwks }), (c) => {
111
+ * const ait = getVerifiedAit(c)!;
112
+ * return c.json({ buyer: ait.payload.identity?.email });
113
+ * });
114
+ * ```
115
+ */
116
+ declare function aipGate(options: AipGateHonoOptions): MiddlewareHandler;
117
+ /** Wrap {@link aipGate} so it only runs when an `Agent-Identity` header is present. */
118
+ declare function conditionalAipGate(options: AipGateHonoOptions): MiddlewareHandler;
119
+ /** Read the verified AIT attached to a Hono `Context` by {@link aipGate}. */
120
+ declare function getVerifiedAit(c: Context): VerifiedAit | undefined;
96
121
 
97
- export { agentscoreGate, captureWallet, conditionalAgentscoreGate, getAgentScoreData, getGateDegradedState, getGateQuotaInfo, getSignerVerdict };
122
+ export { type AipGateHonoOptions, agentscoreGate, aipGate, captureWallet, conditionalAgentscoreGate, conditionalAipGate, getAgentScoreData, getGateDegradedState, getGateQuotaInfo, getSignerVerdict, getVerifiedAit };