@astrasyncai/verification-gateway 5.4.0 → 5.4.2
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/adapter-interface/interface.d.mts +2 -3
- package/dist/adapter-interface/interface.d.ts +2 -3
- package/dist/adapters/express.d.mts +63 -4
- package/dist/adapters/express.d.ts +63 -4
- package/dist/adapters/express.js +9 -2
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +9 -2
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/mcp.d.mts +396 -4
- package/dist/adapters/mcp.d.ts +396 -4
- package/dist/adapters/mcp.js +9 -2
- package/dist/adapters/mcp.js.map +1 -1
- package/dist/adapters/mcp.mjs +9 -2
- package/dist/adapters/mcp.mjs.map +1 -1
- package/dist/adapters/nextjs.d.mts +22 -4
- package/dist/adapters/nextjs.d.ts +22 -4
- package/dist/adapters/nextjs.js +9 -2
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +9 -2
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.d.mts +157 -3
- package/dist/adapters/sdk.d.ts +157 -3
- package/dist/adapters/sdk.js +35 -15
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +35 -15
- package/dist/adapters/sdk.mjs.map +1 -1
- package/dist/agent/index.d.mts +224 -3
- package/dist/agent/index.d.ts +224 -3
- package/dist/agent/index.js +1 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/index.mjs +1 -1
- package/dist/agent/index.mjs.map +1 -1
- package/dist/bin/astrasync-claude-hook.js +9 -2
- package/dist/bin/astrasync-codex-hook.js +9 -2
- package/dist/bin/astrasync-guard.js +9 -2
- package/dist/bin/astrasync.js +9 -2
- package/dist/browser/background.js +9 -2
- package/dist/browser/background.js.map +1 -1
- package/dist/browser/background.mjs +9 -2
- package/dist/browser/background.mjs.map +1 -1
- package/dist/browser/browser-adapter.d.mts +1 -5
- package/dist/browser/browser-adapter.d.ts +1 -5
- package/dist/claude-code/claude-code-adapter.d.mts +1 -5
- package/dist/claude-code/claude-code-adapter.d.ts +1 -5
- package/dist/cli/index.d.mts +1 -5
- package/dist/cli/index.d.ts +1 -5
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/cli/index.mjs.map +1 -1
- package/dist/codex/index.d.mts +1 -5
- package/dist/codex/index.d.ts +1 -5
- package/dist/codex/index.js +9 -2
- package/dist/codex/index.js.map +1 -1
- package/dist/codex/index.mjs +9 -2
- package/dist/codex/index.mjs.map +1 -1
- package/dist/cursor/cursor-adapter.d.mts +1 -5
- package/dist/cursor/cursor-adapter.d.ts +1 -5
- package/dist/cursor/extension.d.mts +1 -5
- package/dist/cursor/extension.d.ts +1 -5
- package/dist/cursor/extension.js +9 -2
- package/dist/cursor/extension.js.map +1 -1
- package/dist/cursor/extension.mjs +9 -2
- package/dist/cursor/extension.mjs.map +1 -1
- package/dist/edge-config.d.mts +1 -1
- package/dist/edge-config.d.ts +1 -1
- package/dist/edge-config.js +1 -1
- package/dist/edge-config.js.map +1 -1
- package/dist/edge-config.mjs +1 -1
- package/dist/edge-config.mjs.map +1 -1
- package/dist/edge-core/index.d.mts +1 -1
- package/dist/edge-core/index.d.ts +1 -1
- package/dist/edge-core/index.js +9 -2
- package/dist/edge-core/index.js.map +1 -1
- package/dist/edge-core/index.mjs +9 -2
- package/dist/edge-core/index.mjs.map +1 -1
- package/dist/gateway/gateway.d.mts +2 -3
- package/dist/gateway/gateway.d.ts +2 -3
- package/dist/gateway/gateway.js +9 -2
- package/dist/gateway/gateway.js.map +1 -1
- package/dist/gateway/gateway.mjs +9 -2
- package/dist/gateway/gateway.mjs.map +1 -1
- package/dist/git-trigger/git-hooks.d.mts +253 -3
- package/dist/git-trigger/git-hooks.d.ts +253 -3
- package/dist/index.d.mts +4506 -42
- package/dist/index.d.ts +4506 -42
- package/dist/index.js +35 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -15
- package/dist/index.mjs.map +1 -1
- package/dist/interface-q1WrMsB1.d.mts +365 -0
- package/dist/interface-q1WrMsB1.d.ts +365 -0
- package/dist/local-evaluator/evaluator.d.mts +2 -3
- package/dist/local-evaluator/evaluator.d.ts +2 -3
- package/dist/registration/index.js +1 -1
- package/dist/registration/index.js.map +1 -1
- package/dist/registration/index.mjs +1 -1
- package/dist/registration/index.mjs.map +1 -1
- package/dist/transport/index.d.mts +1324 -4
- package/dist/transport/index.d.ts +1324 -4
- package/dist/transport/index.js +1 -1
- package/dist/transport/index.js.map +1 -1
- package/dist/transport/index.mjs +1 -1
- package/dist/transport/index.mjs.map +1 -1
- package/dist/{types-DGh2akuh.d.ts → types-BRz2U0Pn.d.ts} +2 -2
- package/dist/{types-76TB0fxW.d.ts → types-BU04qAAR.d.mts} +59 -213
- package/dist/{types-CD1F9fmp.d.mts → types-BU04qAAR.d.ts} +59 -213
- package/dist/types-Bd2O3eX1.d.mts +769 -0
- package/dist/types-BfILnheI.d.mts +189 -0
- package/dist/types-BfILnheI.d.ts +189 -0
- package/dist/{types-z_RNjHWm.d.mts → types-CfBpm3w5.d.mts} +2 -2
- package/dist/types-DMChboN_.d.ts +769 -0
- package/dist/ui/index.d.mts +1 -2
- package/dist/ui/index.d.ts +1 -2
- package/dist/verify.d.mts +1 -1
- package/dist/verify.d.ts +1 -1
- package/dist/verify.js +9 -2
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +9 -2
- package/dist/verify.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/express-BIAT2pe0.d.mts +0 -69
- package/dist/express-D3Tf-b23.d.ts +0 -69
- package/dist/index-BVJkTyIF.d.mts +0 -248
- package/dist/index-By021oSN.d.mts +0 -1469
- package/dist/index-DaMXZabg.d.ts +0 -248
- package/dist/index-iJ9_DdLk.d.ts +0 -1469
- package/dist/mcp-BqfTDZLh.d.mts +0 -397
- package/dist/mcp-OrVOrH-s.d.ts +0 -397
- package/dist/nextjs-DGJXzWst.d.mts +0 -28
- package/dist/nextjs-xM-jdNrX.d.ts +0 -28
- package/dist/sdk-C1IOA5LE.d.ts +0 -173
- package/dist/sdk-C6_-6D-9.d.mts +0 -173
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AstraSync Universal Verification Gateway Types
|
|
3
|
+
*
|
|
4
|
+
* TypeScript type definitions for agent verification across all counterparty types.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Types of counterparties that can integrate the gateway
|
|
9
|
+
*/
|
|
10
|
+
type CounterpartyType = 'agent' | 'api' | 'mcp_server' | 'website' | 'other' | 'unknown';
|
|
11
|
+
/**
|
|
12
|
+
* Configuration options for the verification gateway
|
|
13
|
+
*/
|
|
14
|
+
interface GatewayConfig {
|
|
15
|
+
/** AstraSync API base URL */
|
|
16
|
+
apiBaseUrl: string;
|
|
17
|
+
/** API key for authenticating with AstraSync. */
|
|
18
|
+
apiKey?: string;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Removed in v2.3.0 — server is the single source of truth for
|
|
21
|
+
* access decisions (verified ID + runtime challenge + PDLSS + trust score).
|
|
22
|
+
* Setting this no longer affects access decisions. If you need a higher gate
|
|
23
|
+
* for an endpoint, configure it server-side via the endpoint's
|
|
24
|
+
* `trust_score_requirement`.
|
|
25
|
+
*/
|
|
26
|
+
minTrustScore?: number;
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Removed in v2.3.0 — see `minTrustScore` above.
|
|
29
|
+
*/
|
|
30
|
+
minTrustScoreForFull?: number;
|
|
31
|
+
/** Cache verification results (TTL in seconds) */
|
|
32
|
+
cacheTtl?: number;
|
|
33
|
+
/** Enable debug logging */
|
|
34
|
+
debug?: boolean;
|
|
35
|
+
/** Custom headers to send with verification requests */
|
|
36
|
+
customHeaders?: Record<string, string>;
|
|
37
|
+
/** This counterparty's URL (sent with verify-access requests for analytics) */
|
|
38
|
+
counterpartyUrl?: string;
|
|
39
|
+
/** This counterparty's type (sent with verify-access requests for analytics) */
|
|
40
|
+
counterpartyType?: CounterpartyType;
|
|
41
|
+
/**
|
|
42
|
+
* This counterparty's ASTRAE-id (issued at endpoint registration). When set,
|
|
43
|
+
* the SDK forwards it on verify-access calls so the server attributes traffic
|
|
44
|
+
* directly to this endpoint rather than resolving by URL. Useful when:
|
|
45
|
+
* - The merchant has multiple endpoints under the same origin (each running
|
|
46
|
+
* its own SDK instance with its own counterpartyId)
|
|
47
|
+
* - The endpoint URL might be served behind a proxy / different host than
|
|
48
|
+
* the registered origin
|
|
49
|
+
*/
|
|
50
|
+
counterpartyId?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Step-up hold-and-poll (3.6.0, opt-in). When set, adapters HOLD a request
|
|
53
|
+
* whose verify() came back step_up_required, poll the approval status, and
|
|
54
|
+
* on 'approved' re-verify the same request once (cache-bypassed) so the
|
|
55
|
+
* backend redeems the single-use approval — the MFA model the Java SDK
|
|
56
|
+
* ships default-on. Values:
|
|
57
|
+
* - undefined (default): feature OFF — adapters fail closed immediately,
|
|
58
|
+
* exactly as 3.5.0 (a minor release must not silently convert instant
|
|
59
|
+
* 403s into multi-minute holds).
|
|
60
|
+
* - 0: hold until the approval's expiresAt (+5s grace); 5-min fallback
|
|
61
|
+
* when expiresAt is missing/unparsable (Java parity).
|
|
62
|
+
* - >0: hold at most this many milliseconds.
|
|
63
|
+
* Next.js edge runtimes enforce ~25s wall-clock budgets — set a small value
|
|
64
|
+
* there (≤20000) or gate in a Node route handler instead.
|
|
65
|
+
*/
|
|
66
|
+
stepUpMaxWaitMs?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Poll interval for the step-up hold (3.6.0). Default 3000ms, clamped to a
|
|
69
|
+
* 250ms floor. At the default the backend's 60/min/IP poll rate limit
|
|
70
|
+
* tolerates ~3 concurrent holds per merchant IP; poll errors are treated as
|
|
71
|
+
* transient, so limiter hits degrade the hold to 'timeout', never an error.
|
|
72
|
+
*/
|
|
73
|
+
stepUpPollIntervalMs?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Disable the one-time init self-test. The SDK normally fires a HEAD/OPTIONS
|
|
76
|
+
* to `${apiBaseUrl}/agents/verify-access` on first verify() call and warns
|
|
77
|
+
* if the response is HTML (indicating apiBaseUrl is pointing at a marketing
|
|
78
|
+
* site rather than the API). Set true for tests or environments where the
|
|
79
|
+
* extra request is undesirable.
|
|
80
|
+
*/
|
|
81
|
+
disableInitChecks?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* When true, the init self-test runs synchronously on the first verify()
|
|
84
|
+
* call and THROWS on misconfig (apiBaseUrl returning HTML, unreachable,
|
|
85
|
+
* etc.) instead of warning + continuing. Recommended for production
|
|
86
|
+
* deploys where you want a fast-fail startup signal rather than silent
|
|
87
|
+
* verify-access call failures. Default false for backward compatibility.
|
|
88
|
+
*/
|
|
89
|
+
strictInit?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* 4.0.0: hard timeout (ms) on the outbound verify-access call. Without it
|
|
92
|
+
* a hanging backend hangs the merchant's middleware — and every inbound
|
|
93
|
+
* agent request behind it — indefinitely. Timeouts surface as the
|
|
94
|
+
* fail-closed `verify_access.api_error` result. Default 10_000.
|
|
95
|
+
*/
|
|
96
|
+
verifyTimeoutMs?: number;
|
|
97
|
+
/**
|
|
98
|
+
* v2.3.8: emit `X-Astra-Gateway-Mode: unenforced` (with
|
|
99
|
+
* `X-Astra-Gateway-Reason: no-policy | no-match`) on responses where the
|
|
100
|
+
* middleware fell through without consulting verify-access. Lets integration
|
|
101
|
+
* tests assert "this endpoint should be gated; if it falls through, fail
|
|
102
|
+
* loudly". Default off; opt-in.
|
|
103
|
+
*
|
|
104
|
+
* The header value was renamed from the ambiguous `pass-through` to
|
|
105
|
+
* `unenforced` so it describes the GATE state only — not whether the
|
|
106
|
+
* request succeeded end-to-end. The config FLAG name
|
|
107
|
+
* (`setPassThroughHeader`) is unchanged for backwards compatibility.
|
|
108
|
+
*/
|
|
109
|
+
setPassThroughHeader?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* v2.3.8: dashboard origin used to construct configuration links in
|
|
112
|
+
* boot-time warnings (e.g. when no per-route policy is configured).
|
|
113
|
+
* Defaults to `https://astrasync.ai/dashboard` (the `app.astrasync.ai`
|
|
114
|
+
* subdomain referenced in older docs does not resolve).
|
|
115
|
+
*/
|
|
116
|
+
dashboardUrl?: string;
|
|
117
|
+
/**
|
|
118
|
+
* When true, the middleware calls verify-access for any request that presents
|
|
119
|
+
* AstraSync credentials, even on `observe`-marked routes / tools that would
|
|
120
|
+
* otherwise pass through unevaluated. Populates `req.agentVerification` and
|
|
121
|
+
* records the verification event for the audit trail. Enforcement still
|
|
122
|
+
* respects the gate — an `observe` marker still passes through regardless of
|
|
123
|
+
* the server decision. Default false to preserve existing behaviour.
|
|
124
|
+
*
|
|
125
|
+
* Use this when a single endpoint serves both anonymous and verified
|
|
126
|
+
* traffic with different response shapes (e.g. anonymous catalog vs
|
|
127
|
+
* verified catalog with agent-only SKUs; anonymous MCP tool listing
|
|
128
|
+
* vs verified tool-listing with restricted tools surfaced). Without
|
|
129
|
+
* the flag, anonymous-with-credentials passes are invisible to the
|
|
130
|
+
* merchant handler and to the AstraSync activity feed.
|
|
131
|
+
*
|
|
132
|
+
* Lives on `GatewayConfig` (not adapter-specific) so both express and
|
|
133
|
+
* MCP middlewares inherit it via their `extends GatewayConfig` chain.
|
|
134
|
+
*/
|
|
135
|
+
evaluateAlwaysIfCredentialed?: boolean;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Token guidance returned from verify-access.
|
|
139
|
+
*
|
|
140
|
+
* `recommendedRateLimit` carries `requestsPerMinute` and `currency` only.
|
|
141
|
+
* `maxTransactionValue` was removed in v2.2.4 — it leaked the agent's
|
|
142
|
+
* spending headroom to the merchant, which is a price-discrimination signal
|
|
143
|
+
* (a merchant could see the agent's autonomous threshold and price the
|
|
144
|
+
* transaction just under it to capture surplus). The agent's SDK receives
|
|
145
|
+
* its own limits separately for client-side budgeting; the merchant's
|
|
146
|
+
* decision doesn't need amount info.
|
|
147
|
+
*/
|
|
148
|
+
interface TokenGuidance {
|
|
149
|
+
recommendedScopes: string[];
|
|
150
|
+
recommendedTtlSeconds: number;
|
|
151
|
+
recommendedRateLimit?: {
|
|
152
|
+
requestsPerMinute: number;
|
|
153
|
+
currency?: string;
|
|
154
|
+
};
|
|
155
|
+
jurisdictionConstraints?: string[];
|
|
156
|
+
delegationAllowed: boolean;
|
|
157
|
+
maxDelegationDepth?: number;
|
|
158
|
+
safetyDefaults: {
|
|
159
|
+
writePrivilegesRequested: boolean;
|
|
160
|
+
shortLivedTokenRecommended: boolean;
|
|
161
|
+
scopeConvention: 'astrasync-canonical';
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Cross-protocol credential config
|
|
166
|
+
*/
|
|
167
|
+
interface AstraSyncCredentials {
|
|
168
|
+
agentId: string;
|
|
169
|
+
verifyUrl?: string;
|
|
170
|
+
challengeUrl?: string;
|
|
171
|
+
pdlss?: {
|
|
172
|
+
purpose?: {
|
|
173
|
+
category: string;
|
|
174
|
+
action?: string;
|
|
175
|
+
};
|
|
176
|
+
duration?: {
|
|
177
|
+
maxSessionDuration?: number;
|
|
178
|
+
};
|
|
179
|
+
scope?: {
|
|
180
|
+
jurisdiction?: string;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Protocol transport type
|
|
186
|
+
*/
|
|
187
|
+
type ProtocolTransport = 'http' | 'a2a' | 'mcp';
|
|
188
|
+
|
|
189
|
+
export type { AstraSyncCredentials as A, CounterpartyType as C, GatewayConfig as G, ProtocolTransport as P, TokenGuidance as T };
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AstraSync Universal Verification Gateway Types
|
|
3
|
+
*
|
|
4
|
+
* TypeScript type definitions for agent verification across all counterparty types.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Types of counterparties that can integrate the gateway
|
|
9
|
+
*/
|
|
10
|
+
type CounterpartyType = 'agent' | 'api' | 'mcp_server' | 'website' | 'other' | 'unknown';
|
|
11
|
+
/**
|
|
12
|
+
* Configuration options for the verification gateway
|
|
13
|
+
*/
|
|
14
|
+
interface GatewayConfig {
|
|
15
|
+
/** AstraSync API base URL */
|
|
16
|
+
apiBaseUrl: string;
|
|
17
|
+
/** API key for authenticating with AstraSync. */
|
|
18
|
+
apiKey?: string;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Removed in v2.3.0 — server is the single source of truth for
|
|
21
|
+
* access decisions (verified ID + runtime challenge + PDLSS + trust score).
|
|
22
|
+
* Setting this no longer affects access decisions. If you need a higher gate
|
|
23
|
+
* for an endpoint, configure it server-side via the endpoint's
|
|
24
|
+
* `trust_score_requirement`.
|
|
25
|
+
*/
|
|
26
|
+
minTrustScore?: number;
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Removed in v2.3.0 — see `minTrustScore` above.
|
|
29
|
+
*/
|
|
30
|
+
minTrustScoreForFull?: number;
|
|
31
|
+
/** Cache verification results (TTL in seconds) */
|
|
32
|
+
cacheTtl?: number;
|
|
33
|
+
/** Enable debug logging */
|
|
34
|
+
debug?: boolean;
|
|
35
|
+
/** Custom headers to send with verification requests */
|
|
36
|
+
customHeaders?: Record<string, string>;
|
|
37
|
+
/** This counterparty's URL (sent with verify-access requests for analytics) */
|
|
38
|
+
counterpartyUrl?: string;
|
|
39
|
+
/** This counterparty's type (sent with verify-access requests for analytics) */
|
|
40
|
+
counterpartyType?: CounterpartyType;
|
|
41
|
+
/**
|
|
42
|
+
* This counterparty's ASTRAE-id (issued at endpoint registration). When set,
|
|
43
|
+
* the SDK forwards it on verify-access calls so the server attributes traffic
|
|
44
|
+
* directly to this endpoint rather than resolving by URL. Useful when:
|
|
45
|
+
* - The merchant has multiple endpoints under the same origin (each running
|
|
46
|
+
* its own SDK instance with its own counterpartyId)
|
|
47
|
+
* - The endpoint URL might be served behind a proxy / different host than
|
|
48
|
+
* the registered origin
|
|
49
|
+
*/
|
|
50
|
+
counterpartyId?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Step-up hold-and-poll (3.6.0, opt-in). When set, adapters HOLD a request
|
|
53
|
+
* whose verify() came back step_up_required, poll the approval status, and
|
|
54
|
+
* on 'approved' re-verify the same request once (cache-bypassed) so the
|
|
55
|
+
* backend redeems the single-use approval — the MFA model the Java SDK
|
|
56
|
+
* ships default-on. Values:
|
|
57
|
+
* - undefined (default): feature OFF — adapters fail closed immediately,
|
|
58
|
+
* exactly as 3.5.0 (a minor release must not silently convert instant
|
|
59
|
+
* 403s into multi-minute holds).
|
|
60
|
+
* - 0: hold until the approval's expiresAt (+5s grace); 5-min fallback
|
|
61
|
+
* when expiresAt is missing/unparsable (Java parity).
|
|
62
|
+
* - >0: hold at most this many milliseconds.
|
|
63
|
+
* Next.js edge runtimes enforce ~25s wall-clock budgets — set a small value
|
|
64
|
+
* there (≤20000) or gate in a Node route handler instead.
|
|
65
|
+
*/
|
|
66
|
+
stepUpMaxWaitMs?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Poll interval for the step-up hold (3.6.0). Default 3000ms, clamped to a
|
|
69
|
+
* 250ms floor. At the default the backend's 60/min/IP poll rate limit
|
|
70
|
+
* tolerates ~3 concurrent holds per merchant IP; poll errors are treated as
|
|
71
|
+
* transient, so limiter hits degrade the hold to 'timeout', never an error.
|
|
72
|
+
*/
|
|
73
|
+
stepUpPollIntervalMs?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Disable the one-time init self-test. The SDK normally fires a HEAD/OPTIONS
|
|
76
|
+
* to `${apiBaseUrl}/agents/verify-access` on first verify() call and warns
|
|
77
|
+
* if the response is HTML (indicating apiBaseUrl is pointing at a marketing
|
|
78
|
+
* site rather than the API). Set true for tests or environments where the
|
|
79
|
+
* extra request is undesirable.
|
|
80
|
+
*/
|
|
81
|
+
disableInitChecks?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* When true, the init self-test runs synchronously on the first verify()
|
|
84
|
+
* call and THROWS on misconfig (apiBaseUrl returning HTML, unreachable,
|
|
85
|
+
* etc.) instead of warning + continuing. Recommended for production
|
|
86
|
+
* deploys where you want a fast-fail startup signal rather than silent
|
|
87
|
+
* verify-access call failures. Default false for backward compatibility.
|
|
88
|
+
*/
|
|
89
|
+
strictInit?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* 4.0.0: hard timeout (ms) on the outbound verify-access call. Without it
|
|
92
|
+
* a hanging backend hangs the merchant's middleware — and every inbound
|
|
93
|
+
* agent request behind it — indefinitely. Timeouts surface as the
|
|
94
|
+
* fail-closed `verify_access.api_error` result. Default 10_000.
|
|
95
|
+
*/
|
|
96
|
+
verifyTimeoutMs?: number;
|
|
97
|
+
/**
|
|
98
|
+
* v2.3.8: emit `X-Astra-Gateway-Mode: unenforced` (with
|
|
99
|
+
* `X-Astra-Gateway-Reason: no-policy | no-match`) on responses where the
|
|
100
|
+
* middleware fell through without consulting verify-access. Lets integration
|
|
101
|
+
* tests assert "this endpoint should be gated; if it falls through, fail
|
|
102
|
+
* loudly". Default off; opt-in.
|
|
103
|
+
*
|
|
104
|
+
* The header value was renamed from the ambiguous `pass-through` to
|
|
105
|
+
* `unenforced` so it describes the GATE state only — not whether the
|
|
106
|
+
* request succeeded end-to-end. The config FLAG name
|
|
107
|
+
* (`setPassThroughHeader`) is unchanged for backwards compatibility.
|
|
108
|
+
*/
|
|
109
|
+
setPassThroughHeader?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* v2.3.8: dashboard origin used to construct configuration links in
|
|
112
|
+
* boot-time warnings (e.g. when no per-route policy is configured).
|
|
113
|
+
* Defaults to `https://astrasync.ai/dashboard` (the `app.astrasync.ai`
|
|
114
|
+
* subdomain referenced in older docs does not resolve).
|
|
115
|
+
*/
|
|
116
|
+
dashboardUrl?: string;
|
|
117
|
+
/**
|
|
118
|
+
* When true, the middleware calls verify-access for any request that presents
|
|
119
|
+
* AstraSync credentials, even on `observe`-marked routes / tools that would
|
|
120
|
+
* otherwise pass through unevaluated. Populates `req.agentVerification` and
|
|
121
|
+
* records the verification event for the audit trail. Enforcement still
|
|
122
|
+
* respects the gate — an `observe` marker still passes through regardless of
|
|
123
|
+
* the server decision. Default false to preserve existing behaviour.
|
|
124
|
+
*
|
|
125
|
+
* Use this when a single endpoint serves both anonymous and verified
|
|
126
|
+
* traffic with different response shapes (e.g. anonymous catalog vs
|
|
127
|
+
* verified catalog with agent-only SKUs; anonymous MCP tool listing
|
|
128
|
+
* vs verified tool-listing with restricted tools surfaced). Without
|
|
129
|
+
* the flag, anonymous-with-credentials passes are invisible to the
|
|
130
|
+
* merchant handler and to the AstraSync activity feed.
|
|
131
|
+
*
|
|
132
|
+
* Lives on `GatewayConfig` (not adapter-specific) so both express and
|
|
133
|
+
* MCP middlewares inherit it via their `extends GatewayConfig` chain.
|
|
134
|
+
*/
|
|
135
|
+
evaluateAlwaysIfCredentialed?: boolean;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Token guidance returned from verify-access.
|
|
139
|
+
*
|
|
140
|
+
* `recommendedRateLimit` carries `requestsPerMinute` and `currency` only.
|
|
141
|
+
* `maxTransactionValue` was removed in v2.2.4 — it leaked the agent's
|
|
142
|
+
* spending headroom to the merchant, which is a price-discrimination signal
|
|
143
|
+
* (a merchant could see the agent's autonomous threshold and price the
|
|
144
|
+
* transaction just under it to capture surplus). The agent's SDK receives
|
|
145
|
+
* its own limits separately for client-side budgeting; the merchant's
|
|
146
|
+
* decision doesn't need amount info.
|
|
147
|
+
*/
|
|
148
|
+
interface TokenGuidance {
|
|
149
|
+
recommendedScopes: string[];
|
|
150
|
+
recommendedTtlSeconds: number;
|
|
151
|
+
recommendedRateLimit?: {
|
|
152
|
+
requestsPerMinute: number;
|
|
153
|
+
currency?: string;
|
|
154
|
+
};
|
|
155
|
+
jurisdictionConstraints?: string[];
|
|
156
|
+
delegationAllowed: boolean;
|
|
157
|
+
maxDelegationDepth?: number;
|
|
158
|
+
safetyDefaults: {
|
|
159
|
+
writePrivilegesRequested: boolean;
|
|
160
|
+
shortLivedTokenRecommended: boolean;
|
|
161
|
+
scopeConvention: 'astrasync-canonical';
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Cross-protocol credential config
|
|
166
|
+
*/
|
|
167
|
+
interface AstraSyncCredentials {
|
|
168
|
+
agentId: string;
|
|
169
|
+
verifyUrl?: string;
|
|
170
|
+
challengeUrl?: string;
|
|
171
|
+
pdlss?: {
|
|
172
|
+
purpose?: {
|
|
173
|
+
category: string;
|
|
174
|
+
action?: string;
|
|
175
|
+
};
|
|
176
|
+
duration?: {
|
|
177
|
+
maxSessionDuration?: number;
|
|
178
|
+
};
|
|
179
|
+
scope?: {
|
|
180
|
+
jurisdiction?: string;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Protocol transport type
|
|
186
|
+
*/
|
|
187
|
+
type ProtocolTransport = 'http' | 'a2a' | 'mcp';
|
|
188
|
+
|
|
189
|
+
export type { AstraSyncCredentials as A, CounterpartyType as C, GatewayConfig as G, ProtocolTransport as P, TokenGuidance as T };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as CounterpartyType, T as TokenGuidance } from './types-BfILnheI.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* AstraSync Gateway - Types for gateway modes, local evaluation, and adapter interface.
|
|
@@ -172,4 +172,4 @@ interface InterceptResult {
|
|
|
172
172
|
skipReason?: string;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
export type { AgentAction as A, InterceptResult as I, LocalPolicy as L, PDLSSContext as P, VerificationDecision as V, AstraSyncGatewayConfig as a, LocalPurposeRule as b
|
|
175
|
+
export type { AgentAction as A, InterceptResult as I, LocalPolicy as L, PDLSSContext as P, VerificationDecision as V, AstraSyncGatewayConfig as a, LocalPurposeRule as b };
|