@astrasyncai/verification-gateway 1.1.0 → 2.0.1
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 +71 -0
- package/dist/adapter-interface/interface.d.ts +71 -0
- package/dist/adapter-interface/interface.js +36 -0
- package/dist/adapter-interface/interface.js.map +1 -0
- package/dist/adapter-interface/interface.mjs +10 -0
- package/dist/adapter-interface/interface.mjs.map +1 -0
- package/dist/adapter-interface/purpose-mapping.d.mts +28 -0
- package/dist/adapter-interface/purpose-mapping.d.ts +28 -0
- package/dist/adapter-interface/purpose-mapping.js +117 -0
- package/dist/adapter-interface/purpose-mapping.js.map +1 -0
- package/dist/adapter-interface/purpose-mapping.mjs +89 -0
- package/dist/adapter-interface/purpose-mapping.mjs.map +1 -0
- package/dist/adapters/express.d.mts +2 -2
- package/dist/adapters/express.d.ts +2 -2
- package/dist/adapters/express.js +123 -11
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/express.mjs +123 -11
- package/dist/adapters/express.mjs.map +1 -1
- package/dist/adapters/nextjs.d.mts +2 -2
- package/dist/adapters/nextjs.d.ts +2 -2
- package/dist/adapters/nextjs.js +192 -14
- package/dist/adapters/nextjs.js.map +1 -1
- package/dist/adapters/nextjs.mjs +192 -14
- package/dist/adapters/nextjs.mjs.map +1 -1
- package/dist/adapters/sdk.d.mts +2 -2
- package/dist/adapters/sdk.d.ts +2 -2
- package/dist/adapters/sdk.js +7 -2
- package/dist/adapters/sdk.js.map +1 -1
- package/dist/adapters/sdk.mjs +7 -2
- package/dist/adapters/sdk.mjs.map +1 -1
- package/dist/agent/index.d.mts +2 -0
- package/dist/agent/index.d.ts +2 -0
- package/dist/agent/index.js +354 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/index.mjs +323 -0
- package/dist/agent/index.mjs.map +1 -0
- package/dist/browser/background.d.mts +2 -0
- package/dist/browser/background.d.ts +2 -0
- package/dist/browser/background.js +4090 -0
- package/dist/browser/background.js.map +1 -0
- package/dist/browser/background.mjs +4088 -0
- package/dist/browser/background.mjs.map +1 -0
- package/dist/browser/browser-adapter.d.mts +110 -0
- package/dist/browser/browser-adapter.d.ts +110 -0
- package/dist/browser/browser-adapter.js +297 -0
- package/dist/browser/browser-adapter.js.map +1 -0
- package/dist/browser/browser-adapter.mjs +269 -0
- package/dist/browser/browser-adapter.mjs.map +1 -0
- package/dist/cli/index.d.mts +241 -0
- package/dist/cli/index.d.ts +241 -0
- package/dist/cli/index.js +3734 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/index.mjs +3688 -0
- package/dist/cli/index.mjs.map +1 -0
- package/dist/cursor/cursor-adapter.d.mts +91 -0
- package/dist/cursor/cursor-adapter.d.ts +91 -0
- package/dist/cursor/cursor-adapter.js +273 -0
- package/dist/cursor/cursor-adapter.js.map +1 -0
- package/dist/cursor/cursor-adapter.mjs +246 -0
- package/dist/cursor/cursor-adapter.mjs.map +1 -0
- package/dist/cursor/extension.d.mts +27 -0
- package/dist/cursor/extension.d.ts +27 -0
- package/dist/cursor/extension.js +4057 -0
- package/dist/cursor/extension.js.map +1 -0
- package/dist/cursor/extension.mjs +4029 -0
- package/dist/cursor/extension.mjs.map +1 -0
- package/dist/{express-BGZiLINd.d.ts → express-Bcl-uBUE.d.ts} +1 -1
- package/dist/{express-BoayLpqq.d.mts → express-CtwDIZyF.d.mts} +1 -1
- package/dist/gateway/gateway.d.mts +70 -0
- package/dist/gateway/gateway.d.ts +70 -0
- package/dist/gateway/gateway.js +3726 -0
- package/dist/gateway/gateway.js.map +1 -0
- package/dist/gateway/gateway.mjs +3699 -0
- package/dist/gateway/gateway.mjs.map +1 -0
- package/dist/git-trigger/git-hooks.d.mts +69 -0
- package/dist/git-trigger/git-hooks.d.ts +69 -0
- package/dist/git-trigger/git-hooks.js +243 -0
- package/dist/git-trigger/git-hooks.js.map +1 -0
- package/dist/git-trigger/git-hooks.mjs +213 -0
- package/dist/git-trigger/git-hooks.mjs.map +1 -0
- package/dist/index-B1ThcGZl.d.mts +89 -0
- package/dist/index-BY8yQ8N8.d.mts +206 -0
- package/dist/index-CtYSYwn3.d.ts +206 -0
- package/dist/index-DnoXfdFd.d.ts +89 -0
- package/dist/index.d.mts +8 -295
- package/dist/index.d.ts +8 -295
- package/dist/index.js +215 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +215 -27
- package/dist/index.mjs.map +1 -1
- package/dist/local-evaluator/evaluator.d.mts +55 -0
- package/dist/local-evaluator/evaluator.d.ts +55 -0
- package/dist/local-evaluator/evaluator.js +272 -0
- package/dist/local-evaluator/evaluator.js.map +1 -0
- package/dist/local-evaluator/evaluator.mjs +244 -0
- package/dist/local-evaluator/evaluator.mjs.map +1 -0
- package/dist/{nextjs-BNbHm5Ui.d.mts → nextjs-BQyMCSx_.d.mts} +1 -1
- package/dist/{nextjs-DTCS5Sw8.d.ts → nextjs-CEldnIJ9.d.ts} +1 -1
- package/dist/{sdk-VAFRmdt7.d.mts → sdk-BhvuJSrH.d.mts} +3 -1
- package/dist/{sdk-9TKZzhxE.d.ts → sdk-BlyVSC_S.d.ts} +3 -1
- package/dist/transport/index.d.mts +2 -0
- package/dist/transport/index.d.ts +2 -0
- package/dist/transport/index.js +211 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/transport/index.mjs +176 -0
- package/dist/transport/index.mjs.map +1 -0
- package/dist/types-79qS7aON.d.ts +153 -0
- package/dist/{types-cA_xfFU7.d.mts → types-CxQwJKbd.d.mts} +17 -2
- package/dist/{types-cA_xfFU7.d.ts → types-CxQwJKbd.d.ts} +17 -2
- package/dist/types-jJnPXStc.d.mts +153 -0
- package/dist/ui/index.d.mts +1 -1
- package/dist/ui/index.d.ts +1 -1
- package/package.json +48 -2
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { A as AstraSyncCredentials, g as ProtocolTransport } from './types-CxQwJKbd.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* HTTP Transport Adapter
|
|
5
|
+
*
|
|
6
|
+
* Maps AstraSync credentials to/from HTTP headers (X-Astra-* convention).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Inject AstraSync credentials into HTTP headers.
|
|
11
|
+
*/
|
|
12
|
+
declare function setHttpHeaders(headers: Record<string, string>, credentials: AstraSyncCredentials): Record<string, string>;
|
|
13
|
+
/**
|
|
14
|
+
* Extract AstraSync credentials from HTTP headers.
|
|
15
|
+
*/
|
|
16
|
+
declare function extractHttpCredentials(headers: Record<string, string | string[] | undefined>): AstraSyncCredentials | null;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A2A (Agent-to-Agent) Transport Adapter
|
|
20
|
+
*
|
|
21
|
+
* Maps AstraSync credentials to/from A2A task metadata.astrasync block.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
interface A2ATask {
|
|
25
|
+
metadata?: Record<string, unknown>;
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Add AstraSync credentials to an A2A task's metadata block.
|
|
30
|
+
*/
|
|
31
|
+
declare function setA2AMetadata(task: A2ATask, credentials: AstraSyncCredentials): A2ATask;
|
|
32
|
+
/**
|
|
33
|
+
* Extract AstraSync credentials from an A2A task's metadata block.
|
|
34
|
+
*/
|
|
35
|
+
declare function extractA2ACredentials(task: A2ATask): AstraSyncCredentials | null;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* MCP (Model Context Protocol) Transport Adapter
|
|
39
|
+
*
|
|
40
|
+
* Maps AstraSync credentials to/from MCP params._meta.astrasync block.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
interface McpParams {
|
|
44
|
+
_meta?: Record<string, unknown>;
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Add AstraSync credentials to MCP params' _meta block.
|
|
49
|
+
*/
|
|
50
|
+
declare function setMcpMeta(params: McpParams, credentials: AstraSyncCredentials): McpParams;
|
|
51
|
+
/**
|
|
52
|
+
* Extract AstraSync credentials from MCP params' _meta block.
|
|
53
|
+
*/
|
|
54
|
+
declare function extractMcpCredentials(params: McpParams): AstraSyncCredentials | null;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Cross-Protocol Transport Module
|
|
58
|
+
*
|
|
59
|
+
* Provides adapters for injecting/extracting AstraSync credentials
|
|
60
|
+
* across HTTP, A2A, and MCP protocols.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Auto-detect protocol from request/context shape.
|
|
65
|
+
*/
|
|
66
|
+
declare function detectProtocol(context: Record<string, unknown>): ProtocolTransport;
|
|
67
|
+
/**
|
|
68
|
+
* Apply credentials to any protocol target.
|
|
69
|
+
*/
|
|
70
|
+
declare function applyCredentials(protocol: ProtocolTransport, target: Record<string, unknown>, credentials: AstraSyncCredentials): Record<string, unknown>;
|
|
71
|
+
/**
|
|
72
|
+
* Extract credentials from any protocol context.
|
|
73
|
+
*/
|
|
74
|
+
declare function extractCredentialsFromProtocol(protocol: ProtocolTransport, context: Record<string, unknown>): AstraSyncCredentials | null;
|
|
75
|
+
|
|
76
|
+
declare const index_applyCredentials: typeof applyCredentials;
|
|
77
|
+
declare const index_detectProtocol: typeof detectProtocol;
|
|
78
|
+
declare const index_extractA2ACredentials: typeof extractA2ACredentials;
|
|
79
|
+
declare const index_extractCredentialsFromProtocol: typeof extractCredentialsFromProtocol;
|
|
80
|
+
declare const index_extractHttpCredentials: typeof extractHttpCredentials;
|
|
81
|
+
declare const index_extractMcpCredentials: typeof extractMcpCredentials;
|
|
82
|
+
declare const index_setA2AMetadata: typeof setA2AMetadata;
|
|
83
|
+
declare const index_setHttpHeaders: typeof setHttpHeaders;
|
|
84
|
+
declare const index_setMcpMeta: typeof setMcpMeta;
|
|
85
|
+
declare namespace index {
|
|
86
|
+
export { index_applyCredentials as applyCredentials, index_detectProtocol as detectProtocol, index_extractA2ACredentials as extractA2ACredentials, index_extractCredentialsFromProtocol as extractCredentialsFromProtocol, index_extractHttpCredentials as extractHttpCredentials, index_extractMcpCredentials as extractMcpCredentials, index_setA2AMetadata as setA2AMetadata, index_setHttpHeaders as setHttpHeaders, index_setMcpMeta as setMcpMeta };
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export { applyCredentials as a, extractCredentialsFromProtocol as b, extractHttpCredentials as c, detectProtocol as d, extractA2ACredentials as e, extractMcpCredentials as f, setHttpHeaders as g, setMcpMeta as h, index as i, setA2AMetadata as s };
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { A as AstraSyncCredentials, g as ProtocolTransport, G as GatewayConfig } from './types-CxQwJKbd.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AgentClient — Credential Presentation
|
|
5
|
+
*
|
|
6
|
+
* Agent-side SDK for automatically injecting AstraSync credentials
|
|
7
|
+
* into outgoing requests across all supported protocols.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
interface AgentClientConfig {
|
|
11
|
+
agentId: string;
|
|
12
|
+
verifyUrl?: string;
|
|
13
|
+
challengeUrl?: string;
|
|
14
|
+
pdlss?: AstraSyncCredentials['pdlss'];
|
|
15
|
+
}
|
|
16
|
+
interface FetchOptions extends RequestInit {
|
|
17
|
+
purpose?: string;
|
|
18
|
+
action?: string;
|
|
19
|
+
}
|
|
20
|
+
declare class AgentClient {
|
|
21
|
+
private credentials;
|
|
22
|
+
constructor(config: AgentClientConfig);
|
|
23
|
+
/**
|
|
24
|
+
* Make an HTTP request with AstraSync headers automatically injected.
|
|
25
|
+
*/
|
|
26
|
+
fetch(url: string, options?: FetchOptions): Promise<Response>;
|
|
27
|
+
/**
|
|
28
|
+
* Prepare A2A task metadata with AstraSync credentials.
|
|
29
|
+
*/
|
|
30
|
+
prepareA2AMetadata(task: Record<string, unknown>, overrides?: {
|
|
31
|
+
purpose?: string;
|
|
32
|
+
action?: string;
|
|
33
|
+
}): Record<string, unknown>;
|
|
34
|
+
/**
|
|
35
|
+
* Prepare MCP params with AstraSync _meta.
|
|
36
|
+
*/
|
|
37
|
+
prepareMcpMeta(params: Record<string, unknown>, overrides?: {
|
|
38
|
+
purpose?: string;
|
|
39
|
+
action?: string;
|
|
40
|
+
}): Record<string, unknown>;
|
|
41
|
+
/**
|
|
42
|
+
* Generic: apply credentials to any protocol.
|
|
43
|
+
*/
|
|
44
|
+
applyCredentials(protocol: ProtocolTransport, target: Record<string, unknown>, overrides?: {
|
|
45
|
+
purpose?: string;
|
|
46
|
+
action?: string;
|
|
47
|
+
}): Record<string, unknown>;
|
|
48
|
+
private buildCredentials;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* ChallengeHandler — Agent-Side Runtime Challenge Responder
|
|
53
|
+
*
|
|
54
|
+
* Handles incoming runtime challenges from AstraSync's verification service.
|
|
55
|
+
* Agents register pending counterparties before initiating contact,
|
|
56
|
+
* then this handler validates and responds to challenges.
|
|
57
|
+
*/
|
|
58
|
+
interface ChallengeResponse {
|
|
59
|
+
status: number;
|
|
60
|
+
body: {
|
|
61
|
+
challengeId: string;
|
|
62
|
+
acknowledged: boolean;
|
|
63
|
+
pendingCounterparties: string[];
|
|
64
|
+
respondedAt: string;
|
|
65
|
+
error?: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
interface ChallengeHandlerConfig {
|
|
69
|
+
agentId: string;
|
|
70
|
+
}
|
|
71
|
+
declare class ChallengeHandler {
|
|
72
|
+
private agentId;
|
|
73
|
+
private pendingCounterparties;
|
|
74
|
+
constructor(config: ChallengeHandlerConfig);
|
|
75
|
+
/**
|
|
76
|
+
* Register a counterparty as pending (before initiating contact).
|
|
77
|
+
*/
|
|
78
|
+
registerPending(counterpartyId: string): void;
|
|
79
|
+
/**
|
|
80
|
+
* Remove a counterparty from pending list (after interaction complete).
|
|
81
|
+
*/
|
|
82
|
+
removePending(counterpartyId: string): void;
|
|
83
|
+
/**
|
|
84
|
+
* Get current pending counterparties list.
|
|
85
|
+
*/
|
|
86
|
+
getPendingList(): string[];
|
|
87
|
+
/**
|
|
88
|
+
* Express middleware for the challenge endpoint.
|
|
89
|
+
* Mount at: app.post('/astrasync/challenge', handler.expressMiddleware())
|
|
90
|
+
*/
|
|
91
|
+
expressMiddleware(): (req: {
|
|
92
|
+
body: unknown;
|
|
93
|
+
}, res: {
|
|
94
|
+
status: (code: number) => {
|
|
95
|
+
json: (body: unknown) => void;
|
|
96
|
+
};
|
|
97
|
+
}) => void;
|
|
98
|
+
/**
|
|
99
|
+
* Generic handler (framework-agnostic).
|
|
100
|
+
* Returns { status, body } for the caller to send.
|
|
101
|
+
*/
|
|
102
|
+
handleChallenge(body: unknown): ChallengeResponse;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* PDLSS Formatter — Transport Format Conversion
|
|
107
|
+
*
|
|
108
|
+
* Converts between full PDLSS boundaries and compact transport format
|
|
109
|
+
* used in HTTP headers, A2A metadata, and MCP _meta blocks.
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Full PDLSS configuration (as returned by the backend).
|
|
114
|
+
*/
|
|
115
|
+
interface PDLSSConfig {
|
|
116
|
+
purpose?: {
|
|
117
|
+
categories?: string[];
|
|
118
|
+
allowedActions?: string[];
|
|
119
|
+
deniedActions?: string[];
|
|
120
|
+
};
|
|
121
|
+
duration?: {
|
|
122
|
+
maxSessionDuration?: number;
|
|
123
|
+
ttl?: number;
|
|
124
|
+
allowedDays?: number[];
|
|
125
|
+
allowedHours?: {
|
|
126
|
+
start: number;
|
|
127
|
+
end: number;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
limits?: {
|
|
131
|
+
autonomousThreshold?: number;
|
|
132
|
+
stepUpThreshold?: number;
|
|
133
|
+
approvalThreshold?: number;
|
|
134
|
+
currency?: string;
|
|
135
|
+
};
|
|
136
|
+
scope?: {
|
|
137
|
+
jurisdictions?: string[];
|
|
138
|
+
resources?: string[];
|
|
139
|
+
resourceTypes?: string[];
|
|
140
|
+
};
|
|
141
|
+
selfInstantiation?: {
|
|
142
|
+
allowed: boolean;
|
|
143
|
+
maxDepth?: number;
|
|
144
|
+
maxSubAgents?: number;
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Compact transport format (embedded in headers/metadata).
|
|
149
|
+
*/
|
|
150
|
+
type TransportPDLSS = NonNullable<AstraSyncCredentials['pdlss']>;
|
|
151
|
+
/**
|
|
152
|
+
* Convert full PDLSS boundaries into compact transport format.
|
|
153
|
+
* Used by AgentClient when building credential headers/metadata.
|
|
154
|
+
*/
|
|
155
|
+
declare function formatPDLSSForTransport(pdlss: PDLSSConfig): TransportPDLSS;
|
|
156
|
+
/**
|
|
157
|
+
* Parse transport format back into full PDLSS config.
|
|
158
|
+
* Used by counterparty-side when receiving credentials.
|
|
159
|
+
*/
|
|
160
|
+
declare function parsePDLSSFromTransport(transport: TransportPDLSS): PDLSSConfig;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Decision Client — Counterparty-Side Decision Recording
|
|
164
|
+
*
|
|
165
|
+
* Helper for counterparties to record their grant/deny decisions
|
|
166
|
+
* back to AstraSync after receiving a verification result.
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
interface RecordDecisionParams {
|
|
170
|
+
sessionId: string;
|
|
171
|
+
decision: 'granted' | 'denied';
|
|
172
|
+
reason?: string;
|
|
173
|
+
tokenIssued?: boolean;
|
|
174
|
+
auditId?: string;
|
|
175
|
+
}
|
|
176
|
+
interface RecordDecisionResult {
|
|
177
|
+
recorded: boolean;
|
|
178
|
+
blockchainTxHash?: string;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Record a counterparty's grant/deny decision for a verification session.
|
|
182
|
+
* POST to /agents/verify-access/:sessionId/decision
|
|
183
|
+
*/
|
|
184
|
+
declare function recordDecision(config: GatewayConfig, params: RecordDecisionParams): Promise<RecordDecisionResult>;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Agent-Side SDK Module
|
|
188
|
+
*
|
|
189
|
+
* Tools for AI agents to present credentials, handle challenges,
|
|
190
|
+
* and interact with the AstraSync verification protocol.
|
|
191
|
+
*/
|
|
192
|
+
|
|
193
|
+
type index_AgentClient = AgentClient;
|
|
194
|
+
declare const index_AgentClient: typeof AgentClient;
|
|
195
|
+
type index_ChallengeHandler = ChallengeHandler;
|
|
196
|
+
declare const index_ChallengeHandler: typeof ChallengeHandler;
|
|
197
|
+
type index_PDLSSConfig = PDLSSConfig;
|
|
198
|
+
type index_TransportPDLSS = TransportPDLSS;
|
|
199
|
+
declare const index_formatPDLSSForTransport: typeof formatPDLSSForTransport;
|
|
200
|
+
declare const index_parsePDLSSFromTransport: typeof parsePDLSSFromTransport;
|
|
201
|
+
declare const index_recordDecision: typeof recordDecision;
|
|
202
|
+
declare namespace index {
|
|
203
|
+
export { index_AgentClient as AgentClient, index_ChallengeHandler as ChallengeHandler, type index_PDLSSConfig as PDLSSConfig, type index_TransportPDLSS as TransportPDLSS, index_formatPDLSSForTransport as formatPDLSSForTransport, index_parsePDLSSFromTransport as parsePDLSSFromTransport, index_recordDecision as recordDecision };
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export { AgentClient as A, ChallengeHandler as C, type PDLSSConfig as P, type TransportPDLSS as T, formatPDLSSForTransport as f, index as i, parsePDLSSFromTransport as p, recordDecision as r };
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { A as AstraSyncCredentials, g as ProtocolTransport, G as GatewayConfig } from './types-CxQwJKbd.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AgentClient — Credential Presentation
|
|
5
|
+
*
|
|
6
|
+
* Agent-side SDK for automatically injecting AstraSync credentials
|
|
7
|
+
* into outgoing requests across all supported protocols.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
interface AgentClientConfig {
|
|
11
|
+
agentId: string;
|
|
12
|
+
verifyUrl?: string;
|
|
13
|
+
challengeUrl?: string;
|
|
14
|
+
pdlss?: AstraSyncCredentials['pdlss'];
|
|
15
|
+
}
|
|
16
|
+
interface FetchOptions extends RequestInit {
|
|
17
|
+
purpose?: string;
|
|
18
|
+
action?: string;
|
|
19
|
+
}
|
|
20
|
+
declare class AgentClient {
|
|
21
|
+
private credentials;
|
|
22
|
+
constructor(config: AgentClientConfig);
|
|
23
|
+
/**
|
|
24
|
+
* Make an HTTP request with AstraSync headers automatically injected.
|
|
25
|
+
*/
|
|
26
|
+
fetch(url: string, options?: FetchOptions): Promise<Response>;
|
|
27
|
+
/**
|
|
28
|
+
* Prepare A2A task metadata with AstraSync credentials.
|
|
29
|
+
*/
|
|
30
|
+
prepareA2AMetadata(task: Record<string, unknown>, overrides?: {
|
|
31
|
+
purpose?: string;
|
|
32
|
+
action?: string;
|
|
33
|
+
}): Record<string, unknown>;
|
|
34
|
+
/**
|
|
35
|
+
* Prepare MCP params with AstraSync _meta.
|
|
36
|
+
*/
|
|
37
|
+
prepareMcpMeta(params: Record<string, unknown>, overrides?: {
|
|
38
|
+
purpose?: string;
|
|
39
|
+
action?: string;
|
|
40
|
+
}): Record<string, unknown>;
|
|
41
|
+
/**
|
|
42
|
+
* Generic: apply credentials to any protocol.
|
|
43
|
+
*/
|
|
44
|
+
applyCredentials(protocol: ProtocolTransport, target: Record<string, unknown>, overrides?: {
|
|
45
|
+
purpose?: string;
|
|
46
|
+
action?: string;
|
|
47
|
+
}): Record<string, unknown>;
|
|
48
|
+
private buildCredentials;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* ChallengeHandler — Agent-Side Runtime Challenge Responder
|
|
53
|
+
*
|
|
54
|
+
* Handles incoming runtime challenges from AstraSync's verification service.
|
|
55
|
+
* Agents register pending counterparties before initiating contact,
|
|
56
|
+
* then this handler validates and responds to challenges.
|
|
57
|
+
*/
|
|
58
|
+
interface ChallengeResponse {
|
|
59
|
+
status: number;
|
|
60
|
+
body: {
|
|
61
|
+
challengeId: string;
|
|
62
|
+
acknowledged: boolean;
|
|
63
|
+
pendingCounterparties: string[];
|
|
64
|
+
respondedAt: string;
|
|
65
|
+
error?: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
interface ChallengeHandlerConfig {
|
|
69
|
+
agentId: string;
|
|
70
|
+
}
|
|
71
|
+
declare class ChallengeHandler {
|
|
72
|
+
private agentId;
|
|
73
|
+
private pendingCounterparties;
|
|
74
|
+
constructor(config: ChallengeHandlerConfig);
|
|
75
|
+
/**
|
|
76
|
+
* Register a counterparty as pending (before initiating contact).
|
|
77
|
+
*/
|
|
78
|
+
registerPending(counterpartyId: string): void;
|
|
79
|
+
/**
|
|
80
|
+
* Remove a counterparty from pending list (after interaction complete).
|
|
81
|
+
*/
|
|
82
|
+
removePending(counterpartyId: string): void;
|
|
83
|
+
/**
|
|
84
|
+
* Get current pending counterparties list.
|
|
85
|
+
*/
|
|
86
|
+
getPendingList(): string[];
|
|
87
|
+
/**
|
|
88
|
+
* Express middleware for the challenge endpoint.
|
|
89
|
+
* Mount at: app.post('/astrasync/challenge', handler.expressMiddleware())
|
|
90
|
+
*/
|
|
91
|
+
expressMiddleware(): (req: {
|
|
92
|
+
body: unknown;
|
|
93
|
+
}, res: {
|
|
94
|
+
status: (code: number) => {
|
|
95
|
+
json: (body: unknown) => void;
|
|
96
|
+
};
|
|
97
|
+
}) => void;
|
|
98
|
+
/**
|
|
99
|
+
* Generic handler (framework-agnostic).
|
|
100
|
+
* Returns { status, body } for the caller to send.
|
|
101
|
+
*/
|
|
102
|
+
handleChallenge(body: unknown): ChallengeResponse;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* PDLSS Formatter — Transport Format Conversion
|
|
107
|
+
*
|
|
108
|
+
* Converts between full PDLSS boundaries and compact transport format
|
|
109
|
+
* used in HTTP headers, A2A metadata, and MCP _meta blocks.
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Full PDLSS configuration (as returned by the backend).
|
|
114
|
+
*/
|
|
115
|
+
interface PDLSSConfig {
|
|
116
|
+
purpose?: {
|
|
117
|
+
categories?: string[];
|
|
118
|
+
allowedActions?: string[];
|
|
119
|
+
deniedActions?: string[];
|
|
120
|
+
};
|
|
121
|
+
duration?: {
|
|
122
|
+
maxSessionDuration?: number;
|
|
123
|
+
ttl?: number;
|
|
124
|
+
allowedDays?: number[];
|
|
125
|
+
allowedHours?: {
|
|
126
|
+
start: number;
|
|
127
|
+
end: number;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
limits?: {
|
|
131
|
+
autonomousThreshold?: number;
|
|
132
|
+
stepUpThreshold?: number;
|
|
133
|
+
approvalThreshold?: number;
|
|
134
|
+
currency?: string;
|
|
135
|
+
};
|
|
136
|
+
scope?: {
|
|
137
|
+
jurisdictions?: string[];
|
|
138
|
+
resources?: string[];
|
|
139
|
+
resourceTypes?: string[];
|
|
140
|
+
};
|
|
141
|
+
selfInstantiation?: {
|
|
142
|
+
allowed: boolean;
|
|
143
|
+
maxDepth?: number;
|
|
144
|
+
maxSubAgents?: number;
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Compact transport format (embedded in headers/metadata).
|
|
149
|
+
*/
|
|
150
|
+
type TransportPDLSS = NonNullable<AstraSyncCredentials['pdlss']>;
|
|
151
|
+
/**
|
|
152
|
+
* Convert full PDLSS boundaries into compact transport format.
|
|
153
|
+
* Used by AgentClient when building credential headers/metadata.
|
|
154
|
+
*/
|
|
155
|
+
declare function formatPDLSSForTransport(pdlss: PDLSSConfig): TransportPDLSS;
|
|
156
|
+
/**
|
|
157
|
+
* Parse transport format back into full PDLSS config.
|
|
158
|
+
* Used by counterparty-side when receiving credentials.
|
|
159
|
+
*/
|
|
160
|
+
declare function parsePDLSSFromTransport(transport: TransportPDLSS): PDLSSConfig;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Decision Client — Counterparty-Side Decision Recording
|
|
164
|
+
*
|
|
165
|
+
* Helper for counterparties to record their grant/deny decisions
|
|
166
|
+
* back to AstraSync after receiving a verification result.
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
interface RecordDecisionParams {
|
|
170
|
+
sessionId: string;
|
|
171
|
+
decision: 'granted' | 'denied';
|
|
172
|
+
reason?: string;
|
|
173
|
+
tokenIssued?: boolean;
|
|
174
|
+
auditId?: string;
|
|
175
|
+
}
|
|
176
|
+
interface RecordDecisionResult {
|
|
177
|
+
recorded: boolean;
|
|
178
|
+
blockchainTxHash?: string;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Record a counterparty's grant/deny decision for a verification session.
|
|
182
|
+
* POST to /agents/verify-access/:sessionId/decision
|
|
183
|
+
*/
|
|
184
|
+
declare function recordDecision(config: GatewayConfig, params: RecordDecisionParams): Promise<RecordDecisionResult>;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Agent-Side SDK Module
|
|
188
|
+
*
|
|
189
|
+
* Tools for AI agents to present credentials, handle challenges,
|
|
190
|
+
* and interact with the AstraSync verification protocol.
|
|
191
|
+
*/
|
|
192
|
+
|
|
193
|
+
type index_AgentClient = AgentClient;
|
|
194
|
+
declare const index_AgentClient: typeof AgentClient;
|
|
195
|
+
type index_ChallengeHandler = ChallengeHandler;
|
|
196
|
+
declare const index_ChallengeHandler: typeof ChallengeHandler;
|
|
197
|
+
type index_PDLSSConfig = PDLSSConfig;
|
|
198
|
+
type index_TransportPDLSS = TransportPDLSS;
|
|
199
|
+
declare const index_formatPDLSSForTransport: typeof formatPDLSSForTransport;
|
|
200
|
+
declare const index_parsePDLSSFromTransport: typeof parsePDLSSFromTransport;
|
|
201
|
+
declare const index_recordDecision: typeof recordDecision;
|
|
202
|
+
declare namespace index {
|
|
203
|
+
export { index_AgentClient as AgentClient, index_ChallengeHandler as ChallengeHandler, type index_PDLSSConfig as PDLSSConfig, type index_TransportPDLSS as TransportPDLSS, index_formatPDLSSForTransport as formatPDLSSForTransport, index_parsePDLSSFromTransport as parsePDLSSFromTransport, index_recordDecision as recordDecision };
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export { AgentClient as A, ChallengeHandler as C, type PDLSSConfig as P, type TransportPDLSS as T, formatPDLSSForTransport as f, index as i, parsePDLSSFromTransport as p, recordDecision as r };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { A as AstraSyncCredentials, g as ProtocolTransport } from './types-CxQwJKbd.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* HTTP Transport Adapter
|
|
5
|
+
*
|
|
6
|
+
* Maps AstraSync credentials to/from HTTP headers (X-Astra-* convention).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Inject AstraSync credentials into HTTP headers.
|
|
11
|
+
*/
|
|
12
|
+
declare function setHttpHeaders(headers: Record<string, string>, credentials: AstraSyncCredentials): Record<string, string>;
|
|
13
|
+
/**
|
|
14
|
+
* Extract AstraSync credentials from HTTP headers.
|
|
15
|
+
*/
|
|
16
|
+
declare function extractHttpCredentials(headers: Record<string, string | string[] | undefined>): AstraSyncCredentials | null;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A2A (Agent-to-Agent) Transport Adapter
|
|
20
|
+
*
|
|
21
|
+
* Maps AstraSync credentials to/from A2A task metadata.astrasync block.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
interface A2ATask {
|
|
25
|
+
metadata?: Record<string, unknown>;
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Add AstraSync credentials to an A2A task's metadata block.
|
|
30
|
+
*/
|
|
31
|
+
declare function setA2AMetadata(task: A2ATask, credentials: AstraSyncCredentials): A2ATask;
|
|
32
|
+
/**
|
|
33
|
+
* Extract AstraSync credentials from an A2A task's metadata block.
|
|
34
|
+
*/
|
|
35
|
+
declare function extractA2ACredentials(task: A2ATask): AstraSyncCredentials | null;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* MCP (Model Context Protocol) Transport Adapter
|
|
39
|
+
*
|
|
40
|
+
* Maps AstraSync credentials to/from MCP params._meta.astrasync block.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
interface McpParams {
|
|
44
|
+
_meta?: Record<string, unknown>;
|
|
45
|
+
[key: string]: unknown;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Add AstraSync credentials to MCP params' _meta block.
|
|
49
|
+
*/
|
|
50
|
+
declare function setMcpMeta(params: McpParams, credentials: AstraSyncCredentials): McpParams;
|
|
51
|
+
/**
|
|
52
|
+
* Extract AstraSync credentials from MCP params' _meta block.
|
|
53
|
+
*/
|
|
54
|
+
declare function extractMcpCredentials(params: McpParams): AstraSyncCredentials | null;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Cross-Protocol Transport Module
|
|
58
|
+
*
|
|
59
|
+
* Provides adapters for injecting/extracting AstraSync credentials
|
|
60
|
+
* across HTTP, A2A, and MCP protocols.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Auto-detect protocol from request/context shape.
|
|
65
|
+
*/
|
|
66
|
+
declare function detectProtocol(context: Record<string, unknown>): ProtocolTransport;
|
|
67
|
+
/**
|
|
68
|
+
* Apply credentials to any protocol target.
|
|
69
|
+
*/
|
|
70
|
+
declare function applyCredentials(protocol: ProtocolTransport, target: Record<string, unknown>, credentials: AstraSyncCredentials): Record<string, unknown>;
|
|
71
|
+
/**
|
|
72
|
+
* Extract credentials from any protocol context.
|
|
73
|
+
*/
|
|
74
|
+
declare function extractCredentialsFromProtocol(protocol: ProtocolTransport, context: Record<string, unknown>): AstraSyncCredentials | null;
|
|
75
|
+
|
|
76
|
+
declare const index_applyCredentials: typeof applyCredentials;
|
|
77
|
+
declare const index_detectProtocol: typeof detectProtocol;
|
|
78
|
+
declare const index_extractA2ACredentials: typeof extractA2ACredentials;
|
|
79
|
+
declare const index_extractCredentialsFromProtocol: typeof extractCredentialsFromProtocol;
|
|
80
|
+
declare const index_extractHttpCredentials: typeof extractHttpCredentials;
|
|
81
|
+
declare const index_extractMcpCredentials: typeof extractMcpCredentials;
|
|
82
|
+
declare const index_setA2AMetadata: typeof setA2AMetadata;
|
|
83
|
+
declare const index_setHttpHeaders: typeof setHttpHeaders;
|
|
84
|
+
declare const index_setMcpMeta: typeof setMcpMeta;
|
|
85
|
+
declare namespace index {
|
|
86
|
+
export { index_applyCredentials as applyCredentials, index_detectProtocol as detectProtocol, index_extractA2ACredentials as extractA2ACredentials, index_extractCredentialsFromProtocol as extractCredentialsFromProtocol, index_extractHttpCredentials as extractHttpCredentials, index_extractMcpCredentials as extractMcpCredentials, index_setA2AMetadata as setA2AMetadata, index_setHttpHeaders as setHttpHeaders, index_setMcpMeta as setMcpMeta };
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export { applyCredentials as a, extractCredentialsFromProtocol as b, extractHttpCredentials as c, detectProtocol as d, extractA2ACredentials as e, extractMcpCredentials as f, setHttpHeaders as g, setMcpMeta as h, index as i, setA2AMetadata as s };
|