@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
package/dist/agent/index.d.mts
CHANGED
|
@@ -1,3 +1,224 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { A as AstraSyncCredentials, P as ProtocolTransport, G as GatewayConfig } from '../types-BfILnheI.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
|
+
/** Base URL for AstraSync API (used for ownership check). Defaults to https://astrasync.ai/api */
|
|
16
|
+
apiBaseUrl?: string;
|
|
17
|
+
/** API key used to authenticate ownership check + other authenticated calls. */
|
|
18
|
+
apiKey?: string;
|
|
19
|
+
}
|
|
20
|
+
interface FetchOptions extends RequestInit {
|
|
21
|
+
purpose?: string;
|
|
22
|
+
action?: string;
|
|
23
|
+
}
|
|
24
|
+
declare class AgentClient {
|
|
25
|
+
private credentials;
|
|
26
|
+
private apiBaseUrl;
|
|
27
|
+
private apiKey;
|
|
28
|
+
constructor(config: AgentClientConfig);
|
|
29
|
+
/**
|
|
30
|
+
* Async factory that validates the API key's account owns the configured
|
|
31
|
+
* ASTRA-id before returning a usable client. Refuses to initialise on
|
|
32
|
+
* mismatch so a stolen ASTRA-id cannot be paired with a valid (different)
|
|
33
|
+
* API key.
|
|
34
|
+
*
|
|
35
|
+
* Set env `ASTRASYNC_SKIP_OWNERSHIP_CHECK=true` to bypass — intended for
|
|
36
|
+
* test environments only.
|
|
37
|
+
*/
|
|
38
|
+
static create(config: AgentClientConfig): Promise<AgentClient>;
|
|
39
|
+
/**
|
|
40
|
+
* Calls GET /api/agents/:astraId/ownership with the configured API key.
|
|
41
|
+
* Returns true only when the backend confirms this API key's account
|
|
42
|
+
* owns the configured agent.
|
|
43
|
+
*/
|
|
44
|
+
private verifyOwnership;
|
|
45
|
+
/**
|
|
46
|
+
* Make an HTTP request with AstraSync headers automatically injected.
|
|
47
|
+
*/
|
|
48
|
+
fetch(url: string, options?: FetchOptions): Promise<Response>;
|
|
49
|
+
/**
|
|
50
|
+
* Prepare A2A task metadata with AstraSync credentials.
|
|
51
|
+
*/
|
|
52
|
+
prepareA2AMetadata(task: Record<string, unknown>, overrides?: {
|
|
53
|
+
purpose?: string;
|
|
54
|
+
action?: string;
|
|
55
|
+
}): Record<string, unknown>;
|
|
56
|
+
/**
|
|
57
|
+
* Prepare MCP params with AstraSync _meta.
|
|
58
|
+
*/
|
|
59
|
+
prepareMcpMeta(params: Record<string, unknown>, overrides?: {
|
|
60
|
+
purpose?: string;
|
|
61
|
+
action?: string;
|
|
62
|
+
}): Record<string, unknown>;
|
|
63
|
+
/**
|
|
64
|
+
* Generic: apply credentials to any protocol.
|
|
65
|
+
*/
|
|
66
|
+
applyCredentials(protocol: ProtocolTransport, target: Record<string, unknown>, overrides?: {
|
|
67
|
+
purpose?: string;
|
|
68
|
+
action?: string;
|
|
69
|
+
}): Record<string, unknown>;
|
|
70
|
+
private buildCredentials;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* ChallengeHandler — Agent-Side Runtime Challenge Responder
|
|
75
|
+
*
|
|
76
|
+
* Handles incoming runtime challenges from AstraSync's verification service.
|
|
77
|
+
* Agents register pending counterparties before initiating contact,
|
|
78
|
+
* then this handler validates and responds to challenges.
|
|
79
|
+
*/
|
|
80
|
+
interface ChallengeResponse {
|
|
81
|
+
status: number;
|
|
82
|
+
body: {
|
|
83
|
+
challengeId: string;
|
|
84
|
+
acknowledged: boolean;
|
|
85
|
+
pendingCounterparties: string[];
|
|
86
|
+
respondedAt: string;
|
|
87
|
+
error?: string;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
interface ChallengeHandlerConfig {
|
|
91
|
+
agentId: string;
|
|
92
|
+
}
|
|
93
|
+
declare class ChallengeHandler {
|
|
94
|
+
private agentId;
|
|
95
|
+
private pendingCounterparties;
|
|
96
|
+
constructor(config: ChallengeHandlerConfig);
|
|
97
|
+
/**
|
|
98
|
+
* Register a counterparty as pending (before initiating contact).
|
|
99
|
+
*/
|
|
100
|
+
registerPending(counterpartyId: string): void;
|
|
101
|
+
/**
|
|
102
|
+
* Remove a counterparty from pending list (after interaction complete).
|
|
103
|
+
*/
|
|
104
|
+
removePending(counterpartyId: string): void;
|
|
105
|
+
/**
|
|
106
|
+
* Get current pending counterparties list.
|
|
107
|
+
*/
|
|
108
|
+
getPendingList(): string[];
|
|
109
|
+
/**
|
|
110
|
+
* Express middleware for the challenge endpoint.
|
|
111
|
+
* Mount at: app.post('/astrasync/challenge', handler.expressMiddleware())
|
|
112
|
+
*/
|
|
113
|
+
expressMiddleware(): (req: {
|
|
114
|
+
body: unknown;
|
|
115
|
+
}, res: {
|
|
116
|
+
status: (code: number) => {
|
|
117
|
+
json: (body: unknown) => void;
|
|
118
|
+
};
|
|
119
|
+
}) => void;
|
|
120
|
+
/**
|
|
121
|
+
* Generic handler (framework-agnostic).
|
|
122
|
+
* Returns { status, body } for the caller to send.
|
|
123
|
+
*/
|
|
124
|
+
handleChallenge(body: unknown): ChallengeResponse;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* PDLSS Formatter — Transport Format Conversion
|
|
129
|
+
*
|
|
130
|
+
* Converts between full PDLSS boundaries and compact transport format
|
|
131
|
+
* used in HTTP headers, A2A metadata, and MCP _meta blocks.
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Full PDLSS configuration (as returned by the backend).
|
|
136
|
+
*/
|
|
137
|
+
interface PDLSSConfig {
|
|
138
|
+
purpose?: {
|
|
139
|
+
categories?: string[];
|
|
140
|
+
allowedActions?: string[];
|
|
141
|
+
deniedActions?: string[];
|
|
142
|
+
};
|
|
143
|
+
duration?: {
|
|
144
|
+
maxSessionDuration?: number;
|
|
145
|
+
ttl?: number;
|
|
146
|
+
allowedDays?: number[];
|
|
147
|
+
allowedHours?: {
|
|
148
|
+
start: number;
|
|
149
|
+
end: number;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
limits?: {
|
|
153
|
+
autonomousThreshold?: number;
|
|
154
|
+
approvalThreshold?: number;
|
|
155
|
+
currency?: string;
|
|
156
|
+
};
|
|
157
|
+
scope?: {
|
|
158
|
+
jurisdictions?: string[];
|
|
159
|
+
resources?: string[];
|
|
160
|
+
resourceTypes?: string[];
|
|
161
|
+
};
|
|
162
|
+
selfInstantiation?: {
|
|
163
|
+
allowed: boolean;
|
|
164
|
+
maxDepth?: number;
|
|
165
|
+
maxSubAgents?: number;
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Compact transport format (embedded in headers/metadata).
|
|
170
|
+
*/
|
|
171
|
+
type TransportPDLSS = NonNullable<AstraSyncCredentials['pdlss']>;
|
|
172
|
+
/**
|
|
173
|
+
* Convert full PDLSS boundaries into compact transport format.
|
|
174
|
+
* Used by AgentClient when building credential headers/metadata.
|
|
175
|
+
*/
|
|
176
|
+
declare function formatPDLSSForTransport(pdlss: PDLSSConfig): TransportPDLSS;
|
|
177
|
+
/**
|
|
178
|
+
* Parse transport format back into full PDLSS config.
|
|
179
|
+
* Used by counterparty-side when receiving credentials.
|
|
180
|
+
*/
|
|
181
|
+
declare function parsePDLSSFromTransport(transport: TransportPDLSS): PDLSSConfig;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Decision Client — Counterparty-Side Decision Recording
|
|
185
|
+
*
|
|
186
|
+
* Helper for counterparties to record their grant/deny decisions
|
|
187
|
+
* back to AstraSync after receiving a verification result.
|
|
188
|
+
*/
|
|
189
|
+
|
|
190
|
+
interface RecordDecisionParams {
|
|
191
|
+
sessionId: string;
|
|
192
|
+
decision: 'granted' | 'denied';
|
|
193
|
+
reason?: string;
|
|
194
|
+
tokenIssued?: boolean;
|
|
195
|
+
auditId?: string;
|
|
196
|
+
}
|
|
197
|
+
interface RecordDecisionResult {
|
|
198
|
+
recorded: boolean;
|
|
199
|
+
blockchainTxHash?: string;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Record a counterparty's grant/deny decision for a verification session.
|
|
203
|
+
* POST to /agents/verify-access/:sessionId/decision
|
|
204
|
+
*/
|
|
205
|
+
declare function recordDecision(config: GatewayConfig, params: RecordDecisionParams): Promise<RecordDecisionResult>;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Agent-side SDK errors.
|
|
209
|
+
*/
|
|
210
|
+
declare class AstraSyncSdkError extends Error {
|
|
211
|
+
readonly code: string;
|
|
212
|
+
constructor(code: string, message: string);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Thrown when the API key used to initialise AgentClient is not owned by
|
|
216
|
+
* the same account that registered the configured ASTRA-id. Blocks the
|
|
217
|
+
* client from doing anything under a mismatched identity.
|
|
218
|
+
*/
|
|
219
|
+
declare class OwnershipMismatchError extends AstraSyncSdkError {
|
|
220
|
+
readonly astraId: string;
|
|
221
|
+
constructor(astraId: string);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export { AgentClient, AstraSyncSdkError, ChallengeHandler, OwnershipMismatchError, type PDLSSConfig, type TransportPDLSS, formatPDLSSForTransport, parsePDLSSFromTransport, recordDecision };
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,3 +1,224 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { A as AstraSyncCredentials, P as ProtocolTransport, G as GatewayConfig } from '../types-BfILnheI.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
|
+
/** Base URL for AstraSync API (used for ownership check). Defaults to https://astrasync.ai/api */
|
|
16
|
+
apiBaseUrl?: string;
|
|
17
|
+
/** API key used to authenticate ownership check + other authenticated calls. */
|
|
18
|
+
apiKey?: string;
|
|
19
|
+
}
|
|
20
|
+
interface FetchOptions extends RequestInit {
|
|
21
|
+
purpose?: string;
|
|
22
|
+
action?: string;
|
|
23
|
+
}
|
|
24
|
+
declare class AgentClient {
|
|
25
|
+
private credentials;
|
|
26
|
+
private apiBaseUrl;
|
|
27
|
+
private apiKey;
|
|
28
|
+
constructor(config: AgentClientConfig);
|
|
29
|
+
/**
|
|
30
|
+
* Async factory that validates the API key's account owns the configured
|
|
31
|
+
* ASTRA-id before returning a usable client. Refuses to initialise on
|
|
32
|
+
* mismatch so a stolen ASTRA-id cannot be paired with a valid (different)
|
|
33
|
+
* API key.
|
|
34
|
+
*
|
|
35
|
+
* Set env `ASTRASYNC_SKIP_OWNERSHIP_CHECK=true` to bypass — intended for
|
|
36
|
+
* test environments only.
|
|
37
|
+
*/
|
|
38
|
+
static create(config: AgentClientConfig): Promise<AgentClient>;
|
|
39
|
+
/**
|
|
40
|
+
* Calls GET /api/agents/:astraId/ownership with the configured API key.
|
|
41
|
+
* Returns true only when the backend confirms this API key's account
|
|
42
|
+
* owns the configured agent.
|
|
43
|
+
*/
|
|
44
|
+
private verifyOwnership;
|
|
45
|
+
/**
|
|
46
|
+
* Make an HTTP request with AstraSync headers automatically injected.
|
|
47
|
+
*/
|
|
48
|
+
fetch(url: string, options?: FetchOptions): Promise<Response>;
|
|
49
|
+
/**
|
|
50
|
+
* Prepare A2A task metadata with AstraSync credentials.
|
|
51
|
+
*/
|
|
52
|
+
prepareA2AMetadata(task: Record<string, unknown>, overrides?: {
|
|
53
|
+
purpose?: string;
|
|
54
|
+
action?: string;
|
|
55
|
+
}): Record<string, unknown>;
|
|
56
|
+
/**
|
|
57
|
+
* Prepare MCP params with AstraSync _meta.
|
|
58
|
+
*/
|
|
59
|
+
prepareMcpMeta(params: Record<string, unknown>, overrides?: {
|
|
60
|
+
purpose?: string;
|
|
61
|
+
action?: string;
|
|
62
|
+
}): Record<string, unknown>;
|
|
63
|
+
/**
|
|
64
|
+
* Generic: apply credentials to any protocol.
|
|
65
|
+
*/
|
|
66
|
+
applyCredentials(protocol: ProtocolTransport, target: Record<string, unknown>, overrides?: {
|
|
67
|
+
purpose?: string;
|
|
68
|
+
action?: string;
|
|
69
|
+
}): Record<string, unknown>;
|
|
70
|
+
private buildCredentials;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* ChallengeHandler — Agent-Side Runtime Challenge Responder
|
|
75
|
+
*
|
|
76
|
+
* Handles incoming runtime challenges from AstraSync's verification service.
|
|
77
|
+
* Agents register pending counterparties before initiating contact,
|
|
78
|
+
* then this handler validates and responds to challenges.
|
|
79
|
+
*/
|
|
80
|
+
interface ChallengeResponse {
|
|
81
|
+
status: number;
|
|
82
|
+
body: {
|
|
83
|
+
challengeId: string;
|
|
84
|
+
acknowledged: boolean;
|
|
85
|
+
pendingCounterparties: string[];
|
|
86
|
+
respondedAt: string;
|
|
87
|
+
error?: string;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
interface ChallengeHandlerConfig {
|
|
91
|
+
agentId: string;
|
|
92
|
+
}
|
|
93
|
+
declare class ChallengeHandler {
|
|
94
|
+
private agentId;
|
|
95
|
+
private pendingCounterparties;
|
|
96
|
+
constructor(config: ChallengeHandlerConfig);
|
|
97
|
+
/**
|
|
98
|
+
* Register a counterparty as pending (before initiating contact).
|
|
99
|
+
*/
|
|
100
|
+
registerPending(counterpartyId: string): void;
|
|
101
|
+
/**
|
|
102
|
+
* Remove a counterparty from pending list (after interaction complete).
|
|
103
|
+
*/
|
|
104
|
+
removePending(counterpartyId: string): void;
|
|
105
|
+
/**
|
|
106
|
+
* Get current pending counterparties list.
|
|
107
|
+
*/
|
|
108
|
+
getPendingList(): string[];
|
|
109
|
+
/**
|
|
110
|
+
* Express middleware for the challenge endpoint.
|
|
111
|
+
* Mount at: app.post('/astrasync/challenge', handler.expressMiddleware())
|
|
112
|
+
*/
|
|
113
|
+
expressMiddleware(): (req: {
|
|
114
|
+
body: unknown;
|
|
115
|
+
}, res: {
|
|
116
|
+
status: (code: number) => {
|
|
117
|
+
json: (body: unknown) => void;
|
|
118
|
+
};
|
|
119
|
+
}) => void;
|
|
120
|
+
/**
|
|
121
|
+
* Generic handler (framework-agnostic).
|
|
122
|
+
* Returns { status, body } for the caller to send.
|
|
123
|
+
*/
|
|
124
|
+
handleChallenge(body: unknown): ChallengeResponse;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* PDLSS Formatter — Transport Format Conversion
|
|
129
|
+
*
|
|
130
|
+
* Converts between full PDLSS boundaries and compact transport format
|
|
131
|
+
* used in HTTP headers, A2A metadata, and MCP _meta blocks.
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Full PDLSS configuration (as returned by the backend).
|
|
136
|
+
*/
|
|
137
|
+
interface PDLSSConfig {
|
|
138
|
+
purpose?: {
|
|
139
|
+
categories?: string[];
|
|
140
|
+
allowedActions?: string[];
|
|
141
|
+
deniedActions?: string[];
|
|
142
|
+
};
|
|
143
|
+
duration?: {
|
|
144
|
+
maxSessionDuration?: number;
|
|
145
|
+
ttl?: number;
|
|
146
|
+
allowedDays?: number[];
|
|
147
|
+
allowedHours?: {
|
|
148
|
+
start: number;
|
|
149
|
+
end: number;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
limits?: {
|
|
153
|
+
autonomousThreshold?: number;
|
|
154
|
+
approvalThreshold?: number;
|
|
155
|
+
currency?: string;
|
|
156
|
+
};
|
|
157
|
+
scope?: {
|
|
158
|
+
jurisdictions?: string[];
|
|
159
|
+
resources?: string[];
|
|
160
|
+
resourceTypes?: string[];
|
|
161
|
+
};
|
|
162
|
+
selfInstantiation?: {
|
|
163
|
+
allowed: boolean;
|
|
164
|
+
maxDepth?: number;
|
|
165
|
+
maxSubAgents?: number;
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Compact transport format (embedded in headers/metadata).
|
|
170
|
+
*/
|
|
171
|
+
type TransportPDLSS = NonNullable<AstraSyncCredentials['pdlss']>;
|
|
172
|
+
/**
|
|
173
|
+
* Convert full PDLSS boundaries into compact transport format.
|
|
174
|
+
* Used by AgentClient when building credential headers/metadata.
|
|
175
|
+
*/
|
|
176
|
+
declare function formatPDLSSForTransport(pdlss: PDLSSConfig): TransportPDLSS;
|
|
177
|
+
/**
|
|
178
|
+
* Parse transport format back into full PDLSS config.
|
|
179
|
+
* Used by counterparty-side when receiving credentials.
|
|
180
|
+
*/
|
|
181
|
+
declare function parsePDLSSFromTransport(transport: TransportPDLSS): PDLSSConfig;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Decision Client — Counterparty-Side Decision Recording
|
|
185
|
+
*
|
|
186
|
+
* Helper for counterparties to record their grant/deny decisions
|
|
187
|
+
* back to AstraSync after receiving a verification result.
|
|
188
|
+
*/
|
|
189
|
+
|
|
190
|
+
interface RecordDecisionParams {
|
|
191
|
+
sessionId: string;
|
|
192
|
+
decision: 'granted' | 'denied';
|
|
193
|
+
reason?: string;
|
|
194
|
+
tokenIssued?: boolean;
|
|
195
|
+
auditId?: string;
|
|
196
|
+
}
|
|
197
|
+
interface RecordDecisionResult {
|
|
198
|
+
recorded: boolean;
|
|
199
|
+
blockchainTxHash?: string;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Record a counterparty's grant/deny decision for a verification session.
|
|
203
|
+
* POST to /agents/verify-access/:sessionId/decision
|
|
204
|
+
*/
|
|
205
|
+
declare function recordDecision(config: GatewayConfig, params: RecordDecisionParams): Promise<RecordDecisionResult>;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Agent-side SDK errors.
|
|
209
|
+
*/
|
|
210
|
+
declare class AstraSyncSdkError extends Error {
|
|
211
|
+
readonly code: string;
|
|
212
|
+
constructor(code: string, message: string);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Thrown when the API key used to initialise AgentClient is not owned by
|
|
216
|
+
* the same account that registered the configured ASTRA-id. Blocks the
|
|
217
|
+
* client from doing anything under a mismatched identity.
|
|
218
|
+
*/
|
|
219
|
+
declare class OwnershipMismatchError extends AstraSyncSdkError {
|
|
220
|
+
readonly astraId: string;
|
|
221
|
+
constructor(astraId: string);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export { AgentClient, AstraSyncSdkError, ChallengeHandler, OwnershipMismatchError, type PDLSSConfig, type TransportPDLSS, formatPDLSSForTransport, parsePDLSSFromTransport, recordDecision };
|
package/dist/agent/index.js
CHANGED