@agent-score/commerce 1.5.1 → 1.6.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.
- package/README.md +22 -8
- package/dist/challenge/index.js.map +1 -1
- package/dist/challenge/index.mjs.map +1 -1
- package/dist/core.d.mts +36 -27
- package/dist/core.d.ts +36 -27
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +1 -1
- package/dist/core.mjs.map +1 -1
- package/dist/identity/express.d.mts +2 -2
- package/dist/identity/express.d.ts +2 -2
- package/dist/identity/express.js +1 -1
- package/dist/identity/express.js.map +1 -1
- package/dist/identity/express.mjs +1 -1
- package/dist/identity/express.mjs.map +1 -1
- package/dist/identity/fastify.d.mts +2 -2
- package/dist/identity/fastify.d.ts +2 -2
- package/dist/identity/fastify.js +1 -1
- package/dist/identity/fastify.js.map +1 -1
- package/dist/identity/fastify.mjs +1 -1
- package/dist/identity/fastify.mjs.map +1 -1
- package/dist/identity/hono.d.mts +2 -2
- package/dist/identity/hono.d.ts +2 -2
- package/dist/identity/hono.js +1 -1
- package/dist/identity/hono.js.map +1 -1
- package/dist/identity/hono.mjs +1 -1
- package/dist/identity/hono.mjs.map +1 -1
- package/dist/identity/nextjs.d.mts +2 -2
- package/dist/identity/nextjs.d.ts +2 -2
- package/dist/identity/nextjs.js +1 -1
- package/dist/identity/nextjs.js.map +1 -1
- package/dist/identity/nextjs.mjs +1 -1
- package/dist/identity/nextjs.mjs.map +1 -1
- package/dist/identity/policy.d.mts +3 -3
- package/dist/identity/policy.d.ts +3 -3
- package/dist/identity/policy.js +3 -3
- package/dist/identity/policy.js.map +1 -1
- package/dist/identity/policy.mjs +2 -2
- package/dist/identity/policy.mjs.map +1 -1
- package/dist/identity/web.d.mts +3 -3
- package/dist/identity/web.d.ts +3 -3
- package/dist/identity/web.js +1 -1
- package/dist/identity/web.js.map +1 -1
- package/dist/identity/web.mjs +1 -1
- package/dist/identity/web.mjs.map +1 -1
- package/dist/index.d.mts +217 -123
- package/dist/index.d.ts +217 -123
- package/dist/index.js +86 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +84 -68
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/core.d.mts
CHANGED
|
@@ -110,7 +110,7 @@ interface DenialReason {
|
|
|
110
110
|
* not promoted to first-class DenialReason properties (e.g., `policy_result`). Undefined for
|
|
111
111
|
* denials that did not originate from an assess call (missing_identity, api_error,
|
|
112
112
|
* payment_required, identity_verification_required). */
|
|
113
|
-
data?:
|
|
113
|
+
data?: AssessResult;
|
|
114
114
|
/** Extra fields returned from the `createSessionOnMissing.onBeforeSession` hook. Merged
|
|
115
115
|
* into the default 403 body; custom `onDenied` handlers can spread these into their own
|
|
116
116
|
* response shape (e.g. to include a merchant-minted `order_id`). */
|
|
@@ -127,39 +127,48 @@ interface DenialReason {
|
|
|
127
127
|
/** Wallets the claimed operator could sign with (if enumerable). Present when non-empty. */
|
|
128
128
|
linked_wallets?: string[];
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
/** Operator verification details from the assess response. Mirrors python's
|
|
131
|
+
* `OperatorVerification` dataclass. */
|
|
132
|
+
interface OperatorVerification {
|
|
133
|
+
level: string;
|
|
134
|
+
operator_type: string | null;
|
|
135
|
+
verified_at: string | null;
|
|
136
|
+
}
|
|
137
|
+
/** Account-level KYC facts that apply to every operator under the same account.
|
|
138
|
+
* Populated when the API returns account_verification (post-KYC operator).
|
|
139
|
+
* Mirrors python's account_verification dict shape. */
|
|
140
|
+
interface AccountVerification {
|
|
141
|
+
kyc_level?: string;
|
|
142
|
+
sanctions_clear?: boolean;
|
|
143
|
+
age_bracket?: string;
|
|
144
|
+
jurisdiction?: string;
|
|
145
|
+
verified_at?: string | null;
|
|
146
|
+
}
|
|
147
|
+
/** A single policy check from the assess response. Mirrors python's `PolicyCheck`. */
|
|
148
|
+
interface PolicyCheck {
|
|
149
|
+
rule: string;
|
|
150
|
+
passed: boolean;
|
|
151
|
+
required?: unknown;
|
|
152
|
+
actual?: unknown;
|
|
153
|
+
}
|
|
154
|
+
/** Policy evaluation result from the assess response. Mirrors python's `PolicyResult`. */
|
|
155
|
+
interface PolicyResult {
|
|
156
|
+
all_passed: boolean;
|
|
157
|
+
checks: PolicyCheck[];
|
|
158
|
+
}
|
|
159
|
+
interface AssessResult {
|
|
131
160
|
decision: string | null;
|
|
132
161
|
decision_reasons: string[];
|
|
133
162
|
identity_method?: string;
|
|
134
|
-
operator_verification?:
|
|
135
|
-
|
|
136
|
-
operator_type: string | null;
|
|
137
|
-
verified_at: string | null;
|
|
138
|
-
};
|
|
139
|
-
/** Account-level KYC facts that apply to every operator under the same account.
|
|
140
|
-
* Populated when the API returns account_verification (post-KYC operator). */
|
|
141
|
-
account_verification?: {
|
|
142
|
-
kyc_level?: string;
|
|
143
|
-
sanctions_clear?: boolean;
|
|
144
|
-
age_bracket?: string;
|
|
145
|
-
jurisdiction?: string;
|
|
146
|
-
verified_at?: string | null;
|
|
147
|
-
};
|
|
163
|
+
operator_verification?: OperatorVerification;
|
|
164
|
+
account_verification?: AccountVerification;
|
|
148
165
|
resolved_operator?: string | null;
|
|
149
166
|
/** Wallets linked to the same operator as the resolved identity. Capped at 100 entries
|
|
150
167
|
* by the API. Useful for advertising in 402 challenges so wallet-auth agents know which
|
|
151
168
|
* alt-signers will satisfy `wallet_signer_mismatch`. */
|
|
152
169
|
linked_wallets?: string[];
|
|
153
170
|
verify_url?: string;
|
|
154
|
-
policy_result?:
|
|
155
|
-
all_passed: boolean;
|
|
156
|
-
checks: Array<{
|
|
157
|
-
rule: string;
|
|
158
|
-
passed: boolean;
|
|
159
|
-
required?: unknown;
|
|
160
|
-
actual?: unknown;
|
|
161
|
-
}>;
|
|
162
|
-
} | null;
|
|
171
|
+
policy_result?: PolicyResult | null;
|
|
163
172
|
}
|
|
164
173
|
/**
|
|
165
174
|
* Reason a failOpen allow short-circuited an evaluate call due to AgentScore-side
|
|
@@ -196,7 +205,7 @@ interface GateQuotaInfo {
|
|
|
196
205
|
*/
|
|
197
206
|
type EvaluateOutcome = {
|
|
198
207
|
kind: 'allow';
|
|
199
|
-
data?:
|
|
208
|
+
data?: AssessResult;
|
|
200
209
|
degraded?: boolean;
|
|
201
210
|
infraReason?: FailOpenInfraReason;
|
|
202
211
|
quota?: GateQuotaInfo;
|
|
@@ -276,4 +285,4 @@ interface AgentScoreCore {
|
|
|
276
285
|
declare function buildAgentMemoryHint(): AgentMemoryHint;
|
|
277
286
|
declare function createAgentScoreCore(options: AgentScoreCoreOptions): AgentScoreCore;
|
|
278
287
|
|
|
279
|
-
export { type AgentIdentity, type AgentMemoryHint, type AgentScoreCore, type AgentScoreCoreOptions, type
|
|
288
|
+
export { type AccountVerification, type AgentIdentity, type AgentMemoryHint, type AgentScoreCore, type AgentScoreCoreOptions, type AssessResult, type CaptureWalletOptions, type CreateSessionOnMissing, type DenialCode, type DenialReason, type EvaluateOutcome, type FailOpenInfraReason, type GateQuotaInfo, type OperatorVerification, type PolicyCheck, type PolicyResult, type SessionMetadata, type VerifyWalletSignerMatchOptions, type VerifyWalletSignerResult, buildAgentMemoryHint, createAgentScoreCore };
|
package/dist/core.d.ts
CHANGED
|
@@ -110,7 +110,7 @@ interface DenialReason {
|
|
|
110
110
|
* not promoted to first-class DenialReason properties (e.g., `policy_result`). Undefined for
|
|
111
111
|
* denials that did not originate from an assess call (missing_identity, api_error,
|
|
112
112
|
* payment_required, identity_verification_required). */
|
|
113
|
-
data?:
|
|
113
|
+
data?: AssessResult;
|
|
114
114
|
/** Extra fields returned from the `createSessionOnMissing.onBeforeSession` hook. Merged
|
|
115
115
|
* into the default 403 body; custom `onDenied` handlers can spread these into their own
|
|
116
116
|
* response shape (e.g. to include a merchant-minted `order_id`). */
|
|
@@ -127,39 +127,48 @@ interface DenialReason {
|
|
|
127
127
|
/** Wallets the claimed operator could sign with (if enumerable). Present when non-empty. */
|
|
128
128
|
linked_wallets?: string[];
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
/** Operator verification details from the assess response. Mirrors python's
|
|
131
|
+
* `OperatorVerification` dataclass. */
|
|
132
|
+
interface OperatorVerification {
|
|
133
|
+
level: string;
|
|
134
|
+
operator_type: string | null;
|
|
135
|
+
verified_at: string | null;
|
|
136
|
+
}
|
|
137
|
+
/** Account-level KYC facts that apply to every operator under the same account.
|
|
138
|
+
* Populated when the API returns account_verification (post-KYC operator).
|
|
139
|
+
* Mirrors python's account_verification dict shape. */
|
|
140
|
+
interface AccountVerification {
|
|
141
|
+
kyc_level?: string;
|
|
142
|
+
sanctions_clear?: boolean;
|
|
143
|
+
age_bracket?: string;
|
|
144
|
+
jurisdiction?: string;
|
|
145
|
+
verified_at?: string | null;
|
|
146
|
+
}
|
|
147
|
+
/** A single policy check from the assess response. Mirrors python's `PolicyCheck`. */
|
|
148
|
+
interface PolicyCheck {
|
|
149
|
+
rule: string;
|
|
150
|
+
passed: boolean;
|
|
151
|
+
required?: unknown;
|
|
152
|
+
actual?: unknown;
|
|
153
|
+
}
|
|
154
|
+
/** Policy evaluation result from the assess response. Mirrors python's `PolicyResult`. */
|
|
155
|
+
interface PolicyResult {
|
|
156
|
+
all_passed: boolean;
|
|
157
|
+
checks: PolicyCheck[];
|
|
158
|
+
}
|
|
159
|
+
interface AssessResult {
|
|
131
160
|
decision: string | null;
|
|
132
161
|
decision_reasons: string[];
|
|
133
162
|
identity_method?: string;
|
|
134
|
-
operator_verification?:
|
|
135
|
-
|
|
136
|
-
operator_type: string | null;
|
|
137
|
-
verified_at: string | null;
|
|
138
|
-
};
|
|
139
|
-
/** Account-level KYC facts that apply to every operator under the same account.
|
|
140
|
-
* Populated when the API returns account_verification (post-KYC operator). */
|
|
141
|
-
account_verification?: {
|
|
142
|
-
kyc_level?: string;
|
|
143
|
-
sanctions_clear?: boolean;
|
|
144
|
-
age_bracket?: string;
|
|
145
|
-
jurisdiction?: string;
|
|
146
|
-
verified_at?: string | null;
|
|
147
|
-
};
|
|
163
|
+
operator_verification?: OperatorVerification;
|
|
164
|
+
account_verification?: AccountVerification;
|
|
148
165
|
resolved_operator?: string | null;
|
|
149
166
|
/** Wallets linked to the same operator as the resolved identity. Capped at 100 entries
|
|
150
167
|
* by the API. Useful for advertising in 402 challenges so wallet-auth agents know which
|
|
151
168
|
* alt-signers will satisfy `wallet_signer_mismatch`. */
|
|
152
169
|
linked_wallets?: string[];
|
|
153
170
|
verify_url?: string;
|
|
154
|
-
policy_result?:
|
|
155
|
-
all_passed: boolean;
|
|
156
|
-
checks: Array<{
|
|
157
|
-
rule: string;
|
|
158
|
-
passed: boolean;
|
|
159
|
-
required?: unknown;
|
|
160
|
-
actual?: unknown;
|
|
161
|
-
}>;
|
|
162
|
-
} | null;
|
|
171
|
+
policy_result?: PolicyResult | null;
|
|
163
172
|
}
|
|
164
173
|
/**
|
|
165
174
|
* Reason a failOpen allow short-circuited an evaluate call due to AgentScore-side
|
|
@@ -196,7 +205,7 @@ interface GateQuotaInfo {
|
|
|
196
205
|
*/
|
|
197
206
|
type EvaluateOutcome = {
|
|
198
207
|
kind: 'allow';
|
|
199
|
-
data?:
|
|
208
|
+
data?: AssessResult;
|
|
200
209
|
degraded?: boolean;
|
|
201
210
|
infraReason?: FailOpenInfraReason;
|
|
202
211
|
quota?: GateQuotaInfo;
|
|
@@ -276,4 +285,4 @@ interface AgentScoreCore {
|
|
|
276
285
|
declare function buildAgentMemoryHint(): AgentMemoryHint;
|
|
277
286
|
declare function createAgentScoreCore(options: AgentScoreCoreOptions): AgentScoreCore;
|
|
278
287
|
|
|
279
|
-
export { type AgentIdentity, type AgentMemoryHint, type AgentScoreCore, type AgentScoreCoreOptions, type
|
|
288
|
+
export { type AccountVerification, type AgentIdentity, type AgentMemoryHint, type AgentScoreCore, type AgentScoreCoreOptions, type AssessResult, type CaptureWalletOptions, type CreateSessionOnMissing, type DenialCode, type DenialReason, type EvaluateOutcome, type FailOpenInfraReason, type GateQuotaInfo, type OperatorVerification, type PolicyCheck, type PolicyResult, type SessionMetadata, type VerifyWalletSignerMatchOptions, type VerifyWalletSignerResult, buildAgentMemoryHint, createAgentScoreCore };
|
package/dist/core.js
CHANGED
|
@@ -220,7 +220,7 @@ function createAgentScoreCore(options) {
|
|
|
220
220
|
} = options;
|
|
221
221
|
const baseUrl = stripTrailingSlashes(rawBaseUrl);
|
|
222
222
|
const agentMemoryHint = buildAgentMemoryHint();
|
|
223
|
-
const defaultUa = `@agent-score/commerce@${"1.
|
|
223
|
+
const defaultUa = `@agent-score/commerce@${"1.6.0"}`;
|
|
224
224
|
const userAgentHeader = userAgent ? `${userAgent} (${defaultUa})` : defaultUa;
|
|
225
225
|
const sdk = new import_sdk.AgentScore({ apiKey, baseUrl, userAgent: userAgentHeader });
|
|
226
226
|
const sessionSdkCache = /* @__PURE__ */ new Map();
|