@vorionsys/agentanchor-sdk 0.1.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/CHANGELOG.md +9 -0
- package/LICENSE +190 -0
- package/README.md +249 -0
- package/dist/car/index.d.ts +247 -0
- package/dist/car/index.d.ts.map +1 -0
- package/dist/car/index.js +372 -0
- package/dist/car/index.js.map +1 -0
- package/dist/client.d.ts +233 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +408 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +515 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +147 -0
- package/dist/types.js.map +1 -0
- package/package.json +75 -0
package/dist/client.js
ADDED
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Agent Anchor SDK Client
|
|
3
|
+
* @module @vorionsys/agentanchor-sdk
|
|
4
|
+
*/
|
|
5
|
+
import { DEFAULT_CONFIG, SDKErrorCode, AgentAnchorError, } from './types.js';
|
|
6
|
+
import { parseCAR, validateCAR } from './car/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Agent Anchor SDK Client
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { AgentAnchor } from '@vorionsys/agentanchor-sdk';
|
|
13
|
+
*
|
|
14
|
+
* const anchor = new AgentAnchor({ apiKey: 'your-api-key' });
|
|
15
|
+
*
|
|
16
|
+
* // Register an agent
|
|
17
|
+
* const agent = await anchor.registerAgent({
|
|
18
|
+
* organization: 'acme',
|
|
19
|
+
* agentClass: 'invoice-bot',
|
|
20
|
+
* domains: ['A', 'B', 'F'],
|
|
21
|
+
* level: 3,
|
|
22
|
+
* version: '1.0.0',
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Get trust score
|
|
26
|
+
* const score = await anchor.getTrustScore(agent.car);
|
|
27
|
+
* console.log(`Trust: ${score.score} (${score.tier})`);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export class AgentAnchor {
|
|
31
|
+
config;
|
|
32
|
+
constructor(config) {
|
|
33
|
+
if (!config.apiKey) {
|
|
34
|
+
throw new AgentAnchorError(SDKErrorCode.AUTH_FAILED, 'API key is required');
|
|
35
|
+
}
|
|
36
|
+
this.config = {
|
|
37
|
+
apiKey: config.apiKey,
|
|
38
|
+
baseUrl: config.baseUrl ?? DEFAULT_CONFIG.baseUrl,
|
|
39
|
+
timeout: config.timeout ?? DEFAULT_CONFIG.timeout,
|
|
40
|
+
retries: config.retries ?? DEFAULT_CONFIG.retries,
|
|
41
|
+
debug: config.debug ?? DEFAULT_CONFIG.debug,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
// ==========================================================================
|
|
45
|
+
// Agent Registration & Management
|
|
46
|
+
// ==========================================================================
|
|
47
|
+
/**
|
|
48
|
+
* Register a new agent with Agent Anchor
|
|
49
|
+
*
|
|
50
|
+
* @param options - Registration options
|
|
51
|
+
* @returns The registered agent with assigned CAR ID
|
|
52
|
+
*/
|
|
53
|
+
async registerAgent(options) {
|
|
54
|
+
return this.request('POST', '/v1/agents', options);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Get agent details by CAR ID
|
|
58
|
+
*
|
|
59
|
+
* @param car - CAR ID string
|
|
60
|
+
* @returns Agent details including current trust score
|
|
61
|
+
*/
|
|
62
|
+
async getAgent(car) {
|
|
63
|
+
this.validateCAROrThrow(car);
|
|
64
|
+
return this.request('GET', `/v1/agents/${encodeURIComponent(car)}`);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Update agent metadata
|
|
68
|
+
*
|
|
69
|
+
* @param car - CAR ID string
|
|
70
|
+
* @param updates - Fields to update
|
|
71
|
+
* @returns Updated agent
|
|
72
|
+
*/
|
|
73
|
+
async updateAgent(car, updates) {
|
|
74
|
+
this.validateCAROrThrow(car);
|
|
75
|
+
return this.request('PATCH', `/v1/agents/${encodeURIComponent(car)}`, updates);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Deregister an agent
|
|
79
|
+
*
|
|
80
|
+
* @param car - CAR ID string
|
|
81
|
+
* @param reason - Reason for deregistration
|
|
82
|
+
*/
|
|
83
|
+
async deregisterAgent(car, reason) {
|
|
84
|
+
this.validateCAROrThrow(car);
|
|
85
|
+
await this.request('DELETE', `/v1/agents/${encodeURIComponent(car)}`, { reason });
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Query agents with filters
|
|
89
|
+
*
|
|
90
|
+
* @param filter - Query filters
|
|
91
|
+
* @returns Paginated list of agents
|
|
92
|
+
*/
|
|
93
|
+
async queryAgents(filter = {}) {
|
|
94
|
+
return this.request('POST', '/v1/query', filter);
|
|
95
|
+
}
|
|
96
|
+
// ==========================================================================
|
|
97
|
+
// Trust Scoring
|
|
98
|
+
// ==========================================================================
|
|
99
|
+
/**
|
|
100
|
+
* Get current trust score for an agent
|
|
101
|
+
*
|
|
102
|
+
* @param car - CAR ID string
|
|
103
|
+
* @param forceRefresh - Bypass cache and recalculate
|
|
104
|
+
* @returns Trust score with factor breakdown
|
|
105
|
+
*/
|
|
106
|
+
async getTrustScore(car, forceRefresh = false) {
|
|
107
|
+
this.validateCAROrThrow(car);
|
|
108
|
+
const params = forceRefresh ? '?refresh=true' : '';
|
|
109
|
+
return this.request('GET', `/v1/agents/${encodeURIComponent(car)}/trust${params}`);
|
|
110
|
+
}
|
|
111
|
+
// ==========================================================================
|
|
112
|
+
// Attestations
|
|
113
|
+
// ==========================================================================
|
|
114
|
+
/**
|
|
115
|
+
* Submit an attestation for an agent
|
|
116
|
+
*
|
|
117
|
+
* @param options - Attestation details
|
|
118
|
+
* @returns The created attestation record
|
|
119
|
+
*/
|
|
120
|
+
async submitAttestation(options) {
|
|
121
|
+
this.validateCAROrThrow(options.car);
|
|
122
|
+
return this.request('POST', `/v1/agents/${encodeURIComponent(options.car)}/attestations`, options);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get attestations for an agent
|
|
126
|
+
*
|
|
127
|
+
* @param car - CAR ID string
|
|
128
|
+
* @param limit - Maximum number to return (default 50)
|
|
129
|
+
* @returns List of attestations
|
|
130
|
+
*/
|
|
131
|
+
async getAttestations(car, limit = 50) {
|
|
132
|
+
this.validateCAROrThrow(car);
|
|
133
|
+
return this.request('GET', `/v1/agents/${encodeURIComponent(car)}/attestations?limit=${limit}`);
|
|
134
|
+
}
|
|
135
|
+
// ==========================================================================
|
|
136
|
+
// Lifecycle Management
|
|
137
|
+
// ==========================================================================
|
|
138
|
+
/**
|
|
139
|
+
* Trigger a lifecycle state transition
|
|
140
|
+
*
|
|
141
|
+
* @param request - Transition request
|
|
142
|
+
* @returns Transition result
|
|
143
|
+
*/
|
|
144
|
+
async transitionState(request) {
|
|
145
|
+
this.validateCAROrThrow(request.car);
|
|
146
|
+
return this.request('POST', `/v1/agents/${encodeURIComponent(request.car)}/lifecycle`, request);
|
|
147
|
+
}
|
|
148
|
+
// ==========================================================================
|
|
149
|
+
// Validation
|
|
150
|
+
// ==========================================================================
|
|
151
|
+
/**
|
|
152
|
+
* Validate a CAR ID string
|
|
153
|
+
*
|
|
154
|
+
* @param car - CAR ID string to validate
|
|
155
|
+
* @returns Validation result with parsed components
|
|
156
|
+
*/
|
|
157
|
+
validateCAR(car) {
|
|
158
|
+
return validateCAR(car);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Parse a CAR ID string (throws on invalid)
|
|
162
|
+
*
|
|
163
|
+
* @param car - CAR ID string to parse
|
|
164
|
+
* @returns Parsed CAR ID components
|
|
165
|
+
*/
|
|
166
|
+
parseCAR(car) {
|
|
167
|
+
return parseCAR(car);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Check if a CAR ID is registered with Agent Anchor
|
|
171
|
+
*
|
|
172
|
+
* @param car - CAR ID string to check
|
|
173
|
+
* @returns Whether the CAR ID is registered
|
|
174
|
+
*/
|
|
175
|
+
async isRegistered(car) {
|
|
176
|
+
try {
|
|
177
|
+
await this.getAgent(car);
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
if (error instanceof AgentAnchorError && error.code === SDKErrorCode.AGENT_NOT_FOUND) {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
throw error;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
// ==========================================================================
|
|
188
|
+
// Agent-to-Agent Communication
|
|
189
|
+
// ==========================================================================
|
|
190
|
+
/**
|
|
191
|
+
* Invoke an action on another agent
|
|
192
|
+
*
|
|
193
|
+
* @param callerCarId - Your agent's CAR ID (the caller)
|
|
194
|
+
* @param options - Invoke options
|
|
195
|
+
* @returns Invoke result with response data and metrics
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```typescript
|
|
199
|
+
* const result = await anchor.a2aInvoke('a3i.acme.invoice-bot:ABF-L3@1.0.0', {
|
|
200
|
+
* targetCarId: 'a3i.acme.payment-processor:AF-L4@2.0.0',
|
|
201
|
+
* action: 'processPayment',
|
|
202
|
+
* params: { invoiceId: '12345', amount: 100 },
|
|
203
|
+
* });
|
|
204
|
+
*
|
|
205
|
+
* if (result.success) {
|
|
206
|
+
* console.log('Payment processed:', result.result);
|
|
207
|
+
* }
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
async a2aInvoke(callerCarId, options) {
|
|
211
|
+
this.validateCAROrThrow(callerCarId);
|
|
212
|
+
this.validateCAROrThrow(options.targetCarId);
|
|
213
|
+
return this.request('POST', '/v1/a2a/invoke', options, { 'X-Agent-CAR': callerCarId });
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Discover available agents for A2A communication
|
|
217
|
+
*
|
|
218
|
+
* @param options - Discovery filters
|
|
219
|
+
* @returns List of available endpoints
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* // Find agents that can process payments
|
|
224
|
+
* const endpoints = await anchor.a2aDiscover({
|
|
225
|
+
* capabilities: ['payments'],
|
|
226
|
+
* minTier: 4,
|
|
227
|
+
* });
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
async a2aDiscover(options = {}) {
|
|
231
|
+
const params = new URLSearchParams();
|
|
232
|
+
if (options.capabilities) {
|
|
233
|
+
params.set('capabilities', options.capabilities.join(','));
|
|
234
|
+
}
|
|
235
|
+
if (options.minTier !== undefined) {
|
|
236
|
+
params.set('minTier', options.minTier.toString());
|
|
237
|
+
}
|
|
238
|
+
if (options.action) {
|
|
239
|
+
params.set('action', options.action);
|
|
240
|
+
}
|
|
241
|
+
const queryString = params.toString();
|
|
242
|
+
const path = `/v1/a2a/discover${queryString ? `?${queryString}` : ''}`;
|
|
243
|
+
const result = await this.request('GET', path);
|
|
244
|
+
return result.endpoints;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Ping another agent to check availability
|
|
248
|
+
*
|
|
249
|
+
* @param targetCarId - Target agent CAR ID
|
|
250
|
+
* @returns Ping result with availability status
|
|
251
|
+
*/
|
|
252
|
+
async a2aPing(targetCarId) {
|
|
253
|
+
this.validateCAROrThrow(targetCarId);
|
|
254
|
+
return this.request('POST', '/v1/a2a/ping', { targetCarId });
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Get chain-of-trust information for an A2A request
|
|
258
|
+
*
|
|
259
|
+
* @param requestId - A2A request ID
|
|
260
|
+
* @returns Chain information and validation
|
|
261
|
+
*/
|
|
262
|
+
async a2aGetChain(requestId) {
|
|
263
|
+
const result = await this.request('GET', `/v1/a2a/chain/${encodeURIComponent(requestId)}`);
|
|
264
|
+
return result.chain;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Register this agent as an A2A endpoint
|
|
268
|
+
*
|
|
269
|
+
* @param endpoint - Endpoint configuration
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```typescript
|
|
273
|
+
* await anchor.a2aRegisterEndpoint({
|
|
274
|
+
* car: 'a3i.acme.my-agent:ABF-L3@1.0.0',
|
|
275
|
+
* url: 'https://my-agent.example.com/a2a',
|
|
276
|
+
* capabilities: ['data-processing'],
|
|
277
|
+
* actions: [{
|
|
278
|
+
* name: 'processData',
|
|
279
|
+
* description: 'Process incoming data',
|
|
280
|
+
* minTier: 3,
|
|
281
|
+
* streaming: false,
|
|
282
|
+
* }],
|
|
283
|
+
* });
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
async a2aRegisterEndpoint(endpoint) {
|
|
287
|
+
this.validateCAROrThrow(endpoint.car);
|
|
288
|
+
await this.request('POST', '/v1/a2a/register', endpoint);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Unregister this agent from A2A
|
|
292
|
+
*
|
|
293
|
+
* @param car - Agent CAR ID to unregister
|
|
294
|
+
*/
|
|
295
|
+
async a2aUnregisterEndpoint(car) {
|
|
296
|
+
this.validateCAROrThrow(car);
|
|
297
|
+
await this.request('DELETE', `/v1/a2a/register/${encodeURIComponent(car)}`);
|
|
298
|
+
}
|
|
299
|
+
// ==========================================================================
|
|
300
|
+
// Private Methods
|
|
301
|
+
// ==========================================================================
|
|
302
|
+
/**
|
|
303
|
+
* Make an authenticated API request
|
|
304
|
+
*/
|
|
305
|
+
async request(method, path, body, additionalHeaders) {
|
|
306
|
+
const url = `${this.config.baseUrl}${path}`;
|
|
307
|
+
const headers = {
|
|
308
|
+
'Content-Type': 'application/json',
|
|
309
|
+
Authorization: `Bearer ${this.config.apiKey}`,
|
|
310
|
+
'User-Agent': '@vorionsys/agentanchor-sdk/0.1.0',
|
|
311
|
+
...additionalHeaders,
|
|
312
|
+
};
|
|
313
|
+
let lastError;
|
|
314
|
+
for (let attempt = 0; attempt <= this.config.retries; attempt++) {
|
|
315
|
+
try {
|
|
316
|
+
const controller = new AbortController();
|
|
317
|
+
const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
|
|
318
|
+
const response = await fetch(url, {
|
|
319
|
+
method,
|
|
320
|
+
headers,
|
|
321
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
322
|
+
signal: controller.signal,
|
|
323
|
+
});
|
|
324
|
+
clearTimeout(timeoutId);
|
|
325
|
+
const json = (await response.json());
|
|
326
|
+
if (!response.ok || !json.success) {
|
|
327
|
+
throw this.createErrorFromResponse(response, json);
|
|
328
|
+
}
|
|
329
|
+
return json.data;
|
|
330
|
+
}
|
|
331
|
+
catch (error) {
|
|
332
|
+
lastError = error;
|
|
333
|
+
if (this.config.debug) {
|
|
334
|
+
console.error(`[AgentAnchor] Request failed (attempt ${attempt + 1}):`, error);
|
|
335
|
+
}
|
|
336
|
+
// Don't retry on certain errors
|
|
337
|
+
if (error instanceof AgentAnchorError) {
|
|
338
|
+
const noRetry = [
|
|
339
|
+
SDKErrorCode.AUTH_FAILED,
|
|
340
|
+
SDKErrorCode.AGENT_NOT_FOUND,
|
|
341
|
+
SDKErrorCode.INVALID_CAR,
|
|
342
|
+
SDKErrorCode.VALIDATION_ERROR,
|
|
343
|
+
];
|
|
344
|
+
if (noRetry.includes(error.code)) {
|
|
345
|
+
throw error;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
// Exponential backoff
|
|
349
|
+
if (attempt < this.config.retries) {
|
|
350
|
+
await this.sleep(Math.pow(2, attempt) * 100);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
throw lastError ?? new AgentAnchorError(SDKErrorCode.NETWORK_ERROR, 'Request failed after retries');
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Create SDK error from API response
|
|
358
|
+
*/
|
|
359
|
+
createErrorFromResponse(response, json) {
|
|
360
|
+
const code = this.mapStatusToErrorCode(response.status, json.error?.code);
|
|
361
|
+
return new AgentAnchorError(code, json.error?.message ?? `Request failed with status ${response.status}`, json.error?.details, json.meta?.requestId);
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Map HTTP status to SDK error code
|
|
365
|
+
*/
|
|
366
|
+
mapStatusToErrorCode(status, apiCode) {
|
|
367
|
+
if (apiCode) {
|
|
368
|
+
const mapping = {
|
|
369
|
+
AGENT_NOT_FOUND: SDKErrorCode.AGENT_NOT_FOUND,
|
|
370
|
+
INVALID_CAR: SDKErrorCode.INVALID_CAR,
|
|
371
|
+
TRUST_INSUFFICIENT: SDKErrorCode.TRUST_INSUFFICIENT,
|
|
372
|
+
LIFECYCLE_BLOCKED: SDKErrorCode.LIFECYCLE_BLOCKED,
|
|
373
|
+
QUOTA_EXCEEDED: SDKErrorCode.RATE_LIMITED,
|
|
374
|
+
};
|
|
375
|
+
if (mapping[apiCode])
|
|
376
|
+
return mapping[apiCode];
|
|
377
|
+
}
|
|
378
|
+
switch (status) {
|
|
379
|
+
case 401:
|
|
380
|
+
case 403:
|
|
381
|
+
return SDKErrorCode.AUTH_FAILED;
|
|
382
|
+
case 404:
|
|
383
|
+
return SDKErrorCode.AGENT_NOT_FOUND;
|
|
384
|
+
case 400:
|
|
385
|
+
return SDKErrorCode.VALIDATION_ERROR;
|
|
386
|
+
case 429:
|
|
387
|
+
return SDKErrorCode.RATE_LIMITED;
|
|
388
|
+
default:
|
|
389
|
+
return status >= 500 ? SDKErrorCode.SERVER_ERROR : SDKErrorCode.NETWORK_ERROR;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Validate CAR ID or throw
|
|
394
|
+
*/
|
|
395
|
+
validateCAROrThrow(car) {
|
|
396
|
+
const result = validateCAR(car);
|
|
397
|
+
if (!result.valid) {
|
|
398
|
+
throw new AgentAnchorError(SDKErrorCode.INVALID_CAR, `Invalid CAR ID: ${result.errors.map((e) => e.message).join(', ')}`, { errors: result.errors });
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Sleep for specified milliseconds
|
|
403
|
+
*/
|
|
404
|
+
sleep(ms) {
|
|
405
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAkBL,cAAc,EACd,YAAY,EACZ,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAA4B,MAAM,gBAAgB,CAAC;AAEjF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,WAAW;IACL,MAAM,CAA8B;IAErD,YAAY,MAAyB;QACnC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,IAAI,gBAAgB,CACxB,YAAY,CAAC,WAAW,EACxB,qBAAqB,CACtB,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,MAAM,GAAG;YACZ,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,cAAc,CAAC,OAAO;YACjD,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,cAAc,CAAC,OAAO;YACjD,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,cAAc,CAAC,OAAO;YACjD,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,cAAc,CAAC,KAAK;SAC5C,CAAC;IACJ,CAAC;IAED,6EAA6E;IAC7E,kCAAkC;IAClC,6EAA6E;IAE7E;;;;;OAKG;IACH,KAAK,CAAC,aAAa,CAAC,OAA6B;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAQ,MAAM,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,QAAQ,CAAC,GA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,CAAC,CAAC;IACzD,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vorionsys/agentanchor-sdk
|
|
3
|
+
*
|
|
4
|
+
* Official SDK for Agent Anchor - AI agent registry, trust scoring, and attestations.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { AgentAnchor, CapabilityLevel } from '@vorionsys/agentanchor-sdk';
|
|
9
|
+
*
|
|
10
|
+
* // Initialize client
|
|
11
|
+
* const anchor = new AgentAnchor({ apiKey: 'your-api-key' });
|
|
12
|
+
*
|
|
13
|
+
* // Register an agent
|
|
14
|
+
* const agent = await anchor.registerAgent({
|
|
15
|
+
* organization: 'acme',
|
|
16
|
+
* agentClass: 'invoice-bot',
|
|
17
|
+
* domains: ['A', 'B', 'F'],
|
|
18
|
+
* level: CapabilityLevel.L3_EXECUTE,
|
|
19
|
+
* version: '1.0.0',
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* console.log(`Registered: ${agent.car}`);
|
|
23
|
+
*
|
|
24
|
+
* // Get trust score
|
|
25
|
+
* const score = await anchor.getTrustScore(agent.car);
|
|
26
|
+
* console.log(`Trust: ${score.score}/1000 (Tier ${score.tier})`);
|
|
27
|
+
*
|
|
28
|
+
* // Submit attestation
|
|
29
|
+
* await anchor.submitAttestation({
|
|
30
|
+
* car: agent.car,
|
|
31
|
+
* type: AttestationType.BEHAVIORAL,
|
|
32
|
+
* outcome: 'success',
|
|
33
|
+
* action: 'process_invoice',
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @packageDocumentation
|
|
38
|
+
*/
|
|
39
|
+
export { AgentAnchor } from './client.js';
|
|
40
|
+
export { type AgentAnchorConfig, DEFAULT_CONFIG, type DomainCode, CapabilityLevel, TrustTier, TRUST_TIER_RANGES, type ParsedCAR, AgentState, type RegisterAgentOptions, type Agent, type TrustScore, type TrustFactorBreakdown, AttestationType, type SubmitAttestationOptions, type Attestation, StateAction, type StateTransitionRequest, type StateTransitionResult, type AgentQueryFilter, type PaginatedResult, type APIResponse, type APIError, type ResponseMeta, SDKErrorCode, AgentAnchorError, type A2AInvokeOptions, type A2AInvokeResult, type A2AError, type A2AMetrics, type A2AChainLink, type A2AAttestationData, type A2AEndpoint, type A2AAction, type A2ADiscoverOptions, type A2AChainInfo, type A2APingResult, } from './types.js';
|
|
41
|
+
export { parseCAR, tryParseCAR, parseDomainString, validateCAR, isValidCAR, type CARValidationResult, type CARValidationError, type CARValidationWarning, generateCAR, type GenerateCAROptions, DOMAIN_CODES, DOMAIN_NAMES, DOMAIN_BITS, isDomainCode, encodeDomains, decodeDomains, satisfiesDomainRequirements, getDomainName, LEVEL_NAMES, meetsLevelRequirement, getLevelName, CAR_REGEX, SEMVER_REGEX, domainCodeSchema, capabilityLevelSchema, carIdStringSchema, generateCAROptionsSchema, } from './car/index.js';
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAMH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1C,OAAO,EAEL,KAAK,iBAAiB,EACtB,cAAc,EAGd,KAAK,UAAU,EACf,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,KAAK,SAAS,EAGd,UAAU,EACV,KAAK,oBAAoB,EACzB,KAAK,KAAK,EAGV,KAAK,UAAU,EACf,KAAK,oBAAoB,EAGzB,eAAe,EACf,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAGhB,WAAW,EACX,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAG1B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAGpB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,YAAY,EAGjB,YAAY,EACZ,gBAAgB,EAGhB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,YAAY,CAAC;AAMpB,OAAO,EAEL,QAAQ,EACR,WAAW,EACX,iBAAiB,EAGjB,WAAW,EACX,UAAU,EACV,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAGzB,WAAW,EACX,KAAK,kBAAkB,EAGvB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,aAAa,EACb,aAAa,EACb,2BAA2B,EAC3B,aAAa,EAGb,WAAW,EACX,qBAAqB,EACrB,YAAY,EAGZ,SAAS,EACT,YAAY,EAGZ,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vorionsys/agentanchor-sdk
|
|
3
|
+
*
|
|
4
|
+
* Official SDK for Agent Anchor - AI agent registry, trust scoring, and attestations.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { AgentAnchor, CapabilityLevel } from '@vorionsys/agentanchor-sdk';
|
|
9
|
+
*
|
|
10
|
+
* // Initialize client
|
|
11
|
+
* const anchor = new AgentAnchor({ apiKey: 'your-api-key' });
|
|
12
|
+
*
|
|
13
|
+
* // Register an agent
|
|
14
|
+
* const agent = await anchor.registerAgent({
|
|
15
|
+
* organization: 'acme',
|
|
16
|
+
* agentClass: 'invoice-bot',
|
|
17
|
+
* domains: ['A', 'B', 'F'],
|
|
18
|
+
* level: CapabilityLevel.L3_EXECUTE,
|
|
19
|
+
* version: '1.0.0',
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* console.log(`Registered: ${agent.car}`);
|
|
23
|
+
*
|
|
24
|
+
* // Get trust score
|
|
25
|
+
* const score = await anchor.getTrustScore(agent.car);
|
|
26
|
+
* console.log(`Trust: ${score.score}/1000 (Tier ${score.tier})`);
|
|
27
|
+
*
|
|
28
|
+
* // Submit attestation
|
|
29
|
+
* await anchor.submitAttestation({
|
|
30
|
+
* car: agent.car,
|
|
31
|
+
* type: AttestationType.BEHAVIORAL,
|
|
32
|
+
* outcome: 'success',
|
|
33
|
+
* action: 'process_invoice',
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @packageDocumentation
|
|
38
|
+
*/
|
|
39
|
+
// ============================================================================
|
|
40
|
+
// Client
|
|
41
|
+
// ============================================================================
|
|
42
|
+
export { AgentAnchor } from './client.js';
|
|
43
|
+
// ============================================================================
|
|
44
|
+
// Types
|
|
45
|
+
// ============================================================================
|
|
46
|
+
export { DEFAULT_CONFIG, CapabilityLevel, TrustTier, TRUST_TIER_RANGES,
|
|
47
|
+
// Agent Types
|
|
48
|
+
AgentState,
|
|
49
|
+
// Attestation Types
|
|
50
|
+
AttestationType,
|
|
51
|
+
// Lifecycle Types
|
|
52
|
+
StateAction,
|
|
53
|
+
// Error Types
|
|
54
|
+
SDKErrorCode, AgentAnchorError, } from './types.js';
|
|
55
|
+
// ============================================================================
|
|
56
|
+
// CAR ID Utilities
|
|
57
|
+
// ============================================================================
|
|
58
|
+
export {
|
|
59
|
+
// Parsing
|
|
60
|
+
parseCAR, tryParseCAR, parseDomainString,
|
|
61
|
+
// Validation
|
|
62
|
+
validateCAR, isValidCAR,
|
|
63
|
+
// Generation
|
|
64
|
+
generateCAR,
|
|
65
|
+
// Domain Utilities
|
|
66
|
+
DOMAIN_CODES, DOMAIN_NAMES, DOMAIN_BITS, isDomainCode, encodeDomains, decodeDomains, satisfiesDomainRequirements, getDomainName,
|
|
67
|
+
// Level Utilities
|
|
68
|
+
LEVEL_NAMES, meetsLevelRequirement, getLevelName,
|
|
69
|
+
// Regex
|
|
70
|
+
CAR_REGEX, SEMVER_REGEX,
|
|
71
|
+
// Zod Schemas
|
|
72
|
+
domainCodeSchema, capabilityLevelSchema, carIdStringSchema, generateCAROptionsSchema, } from './car/index.js';
|
|
73
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,+EAA+E;AAC/E,SAAS;AACT,+EAA+E;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,+EAA+E;AAC/E,QAAQ;AACR,+EAA+E;AAE/E,OAAO,EAGL,cAAc,EAId,eAAe,EACf,SAAS,EACT,iBAAiB;AAGjB,cAAc;AACd,UAAU;AAQV,oBAAoB;AACpB,eAAe;AAIf,kBAAkB;AAClB,WAAW;AAaX,cAAc;AACd,YAAY,EACZ,gBAAgB,GAcjB,MAAM,YAAY,CAAC;AAEpB,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E,OAAO;AACL,UAAU;AACV,QAAQ,EACR,WAAW,EACX,iBAAiB;AAEjB,aAAa;AACb,WAAW,EACX,UAAU;AAKV,aAAa;AACb,WAAW;AAGX,mBAAmB;AACnB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,aAAa,EACb,aAAa,EACb,2BAA2B,EAC3B,aAAa;AAEb,kBAAkB;AAClB,WAAW,EACX,qBAAqB,EACrB,YAAY;AAEZ,QAAQ;AACR,SAAS,EACT,YAAY;AAEZ,cAAc;AACd,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC"}
|