@sekuire/sdk 0.1.9 → 0.1.10
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/a2a-client.d.ts +95 -0
- package/dist/a2a-delegator.d.ts +58 -0
- package/dist/a2a-server.d.ts +84 -0
- package/dist/agent.d.ts +1 -1
- package/dist/beacon.d.ts +65 -0
- package/dist/compliance.d.ts +3 -3
- package/dist/crypto.d.ts +0 -3
- package/dist/http/base-client.d.ts +25 -0
- package/dist/http/index.d.ts +2 -0
- package/dist/identity.d.ts +11 -2
- package/dist/index.d.ts +1035 -172
- package/dist/index.esm.js +14379 -4687
- package/dist/index.js +15233 -5256
- package/dist/llm/anthropic.d.ts +4 -12
- package/dist/llm/base-provider.d.ts +13 -0
- package/dist/llm/google.d.ts +4 -12
- package/dist/llm/index.d.ts +0 -12
- package/dist/llm/ollama.d.ts +4 -11
- package/dist/llm/openai.d.ts +4 -12
- package/dist/llm/types.d.ts +19 -12
- package/dist/logger.d.ts +4 -0
- package/dist/memory/index.d.ts +1 -1
- package/dist/new-agent.d.ts +2 -2
- package/dist/platform-url.d.ts +1 -0
- package/dist/registry-client.d.ts +171 -0
- package/dist/sdk.d.ts +112 -0
- package/dist/telemetry/exporter.d.ts +21 -0
- package/dist/telemetry/index.d.ts +22 -0
- package/dist/tools/agent-invocation.d.ts +16 -68
- package/dist/tools/remote.d.ts +1 -1
- package/dist/types/a2a-types.d.ts +194 -0
- package/dist/types.d.ts +1 -0
- package/dist/utils.d.ts +0 -4
- package/dist/worker.d.ts +104 -0
- package/package.json +8 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,92 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
+
import { Tracer } from '@opentelemetry/api';
|
|
3
|
+
import { ExportResult } from '@opentelemetry/core';
|
|
4
|
+
import { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Sekuire Beacon - Deployment Registration & Heartbeat
|
|
8
|
+
*
|
|
9
|
+
* Automatically registers the agent with Sekuire and sends periodic heartbeats
|
|
10
|
+
* to show online status in the Dashboard.
|
|
11
|
+
*/
|
|
12
|
+
interface BeaconConfig {
|
|
13
|
+
/** Sekuire Core API base URL */
|
|
14
|
+
apiBaseUrl: string;
|
|
15
|
+
/** API key for authentication (reads from SEKUIRE_API_KEY if not set) */
|
|
16
|
+
apiKey?: string;
|
|
17
|
+
/** Agent ID to register */
|
|
18
|
+
agentId: string;
|
|
19
|
+
/** Heartbeat interval in milliseconds (default: 60000 = 60 seconds) */
|
|
20
|
+
heartbeatIntervalMs?: number;
|
|
21
|
+
/** Optional explicit deployment URL (auto-detected if not set) */
|
|
22
|
+
deploymentUrl?: string;
|
|
23
|
+
/** Optional callback to build a custom heartbeat payload (e.g. signed payloads) */
|
|
24
|
+
onHeartbeat?: (deploymentUrl: string | undefined) => Promise<Record<string, unknown>>;
|
|
25
|
+
/** Optional callback invoked on status changes */
|
|
26
|
+
onStatusChange?: (status: BeaconStatus) => void;
|
|
27
|
+
}
|
|
28
|
+
interface BeaconStatus {
|
|
29
|
+
isRunning: boolean;
|
|
30
|
+
installationId?: string;
|
|
31
|
+
deploymentUrl?: string;
|
|
32
|
+
lastHeartbeat?: Date;
|
|
33
|
+
failedHeartbeats: number;
|
|
34
|
+
}
|
|
35
|
+
declare class Beacon {
|
|
36
|
+
private config;
|
|
37
|
+
private intervalId;
|
|
38
|
+
private installationId;
|
|
39
|
+
private lastHeartbeat;
|
|
40
|
+
private failedHeartbeats;
|
|
41
|
+
constructor(config: BeaconConfig);
|
|
42
|
+
/**
|
|
43
|
+
* Start the beacon - registers with Sekuire and begins heartbeat loop
|
|
44
|
+
*/
|
|
45
|
+
start(): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Stop the beacon
|
|
48
|
+
*/
|
|
49
|
+
stop(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Get current beacon status
|
|
52
|
+
*/
|
|
53
|
+
getStatus(): BeaconStatus;
|
|
54
|
+
/**
|
|
55
|
+
* Bootstrap registration with Sekuire
|
|
56
|
+
*/
|
|
57
|
+
private bootstrap;
|
|
58
|
+
/**
|
|
59
|
+
* Send heartbeat to Sekuire
|
|
60
|
+
*/
|
|
61
|
+
private heartbeat;
|
|
62
|
+
/**
|
|
63
|
+
* Get API key from environment
|
|
64
|
+
*/
|
|
65
|
+
private getApiKey;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Create a new beacon instance
|
|
69
|
+
*/
|
|
70
|
+
declare function createBeacon(config: BeaconConfig): Beacon;
|
|
71
|
+
|
|
72
|
+
declare class AgentIdentity {
|
|
73
|
+
readonly name: string;
|
|
74
|
+
readonly sekuireId: string;
|
|
75
|
+
private readonly privateKey?;
|
|
76
|
+
readonly publicKey?: string | undefined;
|
|
77
|
+
constructor(name: string, sekuireId: string, privateKey?: string | undefined, publicKey?: string | undefined);
|
|
78
|
+
static load(manifestPath?: string): Promise<AgentIdentity>;
|
|
79
|
+
/**
|
|
80
|
+
* Sign a message using Ed25519
|
|
81
|
+
* @param message The message string to sign
|
|
82
|
+
* @returns Hex-encoded signature
|
|
83
|
+
*/
|
|
84
|
+
sign(message: string): Promise<string>;
|
|
85
|
+
/**
|
|
86
|
+
* Verify a signature (useful for testing)
|
|
87
|
+
*/
|
|
88
|
+
verify(message: string, signatureHex: string): boolean;
|
|
89
|
+
}
|
|
2
90
|
|
|
3
91
|
/**
|
|
4
92
|
* 🛡️ Sekuire Logger - Asynchronous Event Logging for TypeScript SDK
|
|
@@ -17,6 +105,10 @@ interface LoggerConfig$1 {
|
|
|
17
105
|
enabled?: boolean;
|
|
18
106
|
batchSize?: number;
|
|
19
107
|
flushInterval?: number;
|
|
108
|
+
onError?: (error: Error, context: {
|
|
109
|
+
operation: string;
|
|
110
|
+
eventsLost?: number;
|
|
111
|
+
}) => void;
|
|
20
112
|
}
|
|
21
113
|
interface EventLog {
|
|
22
114
|
sekuire_id: string;
|
|
@@ -92,6 +184,117 @@ declare class SekuireLogger {
|
|
|
92
184
|
setEnabled(enabled: boolean): void;
|
|
93
185
|
}
|
|
94
186
|
|
|
187
|
+
/**
|
|
188
|
+
* SekuireSDK - Main SDK entry point for TypeScript agents
|
|
189
|
+
*
|
|
190
|
+
* Combines identity, logging, and heartbeat functionality with a simple API.
|
|
191
|
+
*/
|
|
192
|
+
|
|
193
|
+
declare const DEFAULT_API_URL = "https://api.sekuire.ai";
|
|
194
|
+
interface SekuireSDKConfig {
|
|
195
|
+
privateKey?: string;
|
|
196
|
+
agentId: string;
|
|
197
|
+
agentName?: string;
|
|
198
|
+
apiUrl?: string;
|
|
199
|
+
apiKey?: string;
|
|
200
|
+
workspaceId?: string;
|
|
201
|
+
environment?: string;
|
|
202
|
+
autoHeartbeat?: boolean;
|
|
203
|
+
heartbeatInterval?: number;
|
|
204
|
+
loggingEnabled?: boolean;
|
|
205
|
+
}
|
|
206
|
+
declare class SekuireSDK {
|
|
207
|
+
private config;
|
|
208
|
+
private identity;
|
|
209
|
+
private logger;
|
|
210
|
+
private client;
|
|
211
|
+
private beacon;
|
|
212
|
+
private isRunning;
|
|
213
|
+
constructor(config: SekuireSDKConfig);
|
|
214
|
+
/**
|
|
215
|
+
* Create SDK instance from environment variables.
|
|
216
|
+
*
|
|
217
|
+
* Required env vars:
|
|
218
|
+
* SEKUIRE_AGENT_ID - The agent's sekuire_id
|
|
219
|
+
*
|
|
220
|
+
* Optional env vars:
|
|
221
|
+
* SEKUIRE_API_KEY - API key for authentication (X-API-Key header)
|
|
222
|
+
* SEKUIRE_PRIVATE_KEY - Private key for signing (required for heartbeat)
|
|
223
|
+
* SEKUIRE_AGENT_NAME - Human-readable agent name
|
|
224
|
+
* SEKUIRE_API_URL - API base URL (default: https://api.sekuire.ai)
|
|
225
|
+
* SEKUIRE_WORKSPACE_ID - Workspace ID for policy enforcement
|
|
226
|
+
* SEKUIRE_ENVIRONMENT - Environment name (default: production)
|
|
227
|
+
*/
|
|
228
|
+
static fromEnv(options?: {
|
|
229
|
+
autoHeartbeat?: boolean;
|
|
230
|
+
loggingEnabled?: boolean;
|
|
231
|
+
}): SekuireSDK;
|
|
232
|
+
/**
|
|
233
|
+
* Start the SDK.
|
|
234
|
+
*
|
|
235
|
+
* - Sends initial heartbeat
|
|
236
|
+
* - Starts auto-heartbeat loop if enabled
|
|
237
|
+
*/
|
|
238
|
+
start(): Promise<void>;
|
|
239
|
+
/**
|
|
240
|
+
* Send a signed heartbeat to the registry.
|
|
241
|
+
*
|
|
242
|
+
* The heartbeat proves the agent is running and has access to the private key.
|
|
243
|
+
*
|
|
244
|
+
* @param url Optional public URL where the agent can be reached
|
|
245
|
+
* @returns True if heartbeat was acknowledged, False otherwise
|
|
246
|
+
*/
|
|
247
|
+
heartbeat(url?: string): Promise<boolean>;
|
|
248
|
+
/**
|
|
249
|
+
* Log an event to Sekuire.
|
|
250
|
+
*
|
|
251
|
+
* @param eventType Type of event (tool_execution, model_call, policy_check, etc.)
|
|
252
|
+
* @param data Event-specific data
|
|
253
|
+
* @param severity Severity level (debug, info, warn, error)
|
|
254
|
+
*/
|
|
255
|
+
log(eventType: EventType, data: Record<string, unknown>, severity?: Severity): void;
|
|
256
|
+
/**
|
|
257
|
+
* Check if an action is allowed by the workspace policy.
|
|
258
|
+
*
|
|
259
|
+
* @param action The action to check (e.g., "read_file", "network_access")
|
|
260
|
+
* @param context Context for the action (e.g., {path: "/etc/passwd"})
|
|
261
|
+
* @returns True if allowed, False if denied
|
|
262
|
+
*/
|
|
263
|
+
checkPolicy(action: string, context: Record<string, unknown>): Promise<boolean>;
|
|
264
|
+
/**
|
|
265
|
+
* Shutdown the SDK gracefully.
|
|
266
|
+
*/
|
|
267
|
+
shutdown(): Promise<void>;
|
|
268
|
+
/**
|
|
269
|
+
* Get the current beacon status (heartbeat health, connection info).
|
|
270
|
+
*/
|
|
271
|
+
getBeaconStatus(): BeaconStatus;
|
|
272
|
+
/**
|
|
273
|
+
* Get the agent ID.
|
|
274
|
+
*/
|
|
275
|
+
get agentId(): string;
|
|
276
|
+
/**
|
|
277
|
+
* Get the agent's public key.
|
|
278
|
+
*/
|
|
279
|
+
get publicKey(): string | undefined;
|
|
280
|
+
/**
|
|
281
|
+
* Sign a message with the agent's private key.
|
|
282
|
+
*/
|
|
283
|
+
sign(message: string): Promise<string>;
|
|
284
|
+
/**
|
|
285
|
+
* Verify a signature using the agent's public key.
|
|
286
|
+
*/
|
|
287
|
+
verify(message: string, signature: string): boolean;
|
|
288
|
+
/**
|
|
289
|
+
* Get the underlying identity object.
|
|
290
|
+
*/
|
|
291
|
+
getIdentity(): AgentIdentity;
|
|
292
|
+
/**
|
|
293
|
+
* Get the underlying logger object.
|
|
294
|
+
*/
|
|
295
|
+
getLogger(): SekuireLogger;
|
|
296
|
+
}
|
|
297
|
+
|
|
95
298
|
/**
|
|
96
299
|
* 🛡️ Sekuire Compliance Enforcement System for TypeScript
|
|
97
300
|
*
|
|
@@ -203,21 +406,21 @@ declare class ComplianceMonitor {
|
|
|
203
406
|
* @param codeSnippet Code snippet for pattern checking
|
|
204
407
|
* @throws ToolUsageError If tool usage is blocked
|
|
205
408
|
*/
|
|
206
|
-
checkToolUsage(toolName: string, codeSnippet?: string):
|
|
409
|
+
checkToolUsage(toolName: string, codeSnippet?: string): void;
|
|
207
410
|
/**
|
|
208
411
|
* 💬 Check input content for policy violations
|
|
209
412
|
*
|
|
210
413
|
* @param content Input content to check
|
|
211
414
|
* @throws ContentPolicyError If content violates policy
|
|
212
415
|
*/
|
|
213
|
-
checkInputContent(content: string):
|
|
416
|
+
checkInputContent(content: string): void;
|
|
214
417
|
/**
|
|
215
418
|
* 📤 Check output content for policy violations
|
|
216
419
|
*
|
|
217
420
|
* @param content Output content to check
|
|
218
421
|
* @throws ContentPolicyError If content violates policy
|
|
219
422
|
*/
|
|
220
|
-
checkOutputContent(content: string):
|
|
423
|
+
checkOutputContent(content: string): void;
|
|
221
424
|
private checkContent;
|
|
222
425
|
/**
|
|
223
426
|
* 🤖 Check AI model usage compliance
|
|
@@ -266,16 +469,6 @@ declare class ComplianceMonitor {
|
|
|
266
469
|
preWarmCaches(): void;
|
|
267
470
|
}
|
|
268
471
|
|
|
269
|
-
declare class AgentIdentity {
|
|
270
|
-
readonly name: string;
|
|
271
|
-
readonly sekuireId: string;
|
|
272
|
-
private readonly privateKey?;
|
|
273
|
-
private readonly publicKey?;
|
|
274
|
-
constructor(name: string, sekuireId: string, privateKey?: string | undefined, publicKey?: string | undefined);
|
|
275
|
-
static load(manifestPath?: string): Promise<AgentIdentity>;
|
|
276
|
-
sign(payload: any): Promise<string>;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
472
|
/**
|
|
280
473
|
* Sekuire Agent Framework
|
|
281
474
|
*
|
|
@@ -297,7 +490,7 @@ interface SekuireAgentConfig {
|
|
|
297
490
|
/** Optional custom compliance monitor */
|
|
298
491
|
compliance?: ComplianceMonitor;
|
|
299
492
|
}
|
|
300
|
-
interface ToolDefinition$
|
|
493
|
+
interface ToolDefinition$2<T extends z.ZodObject<any> = any> {
|
|
301
494
|
/** Unique tool name */
|
|
302
495
|
name: string;
|
|
303
496
|
/** Human-readable description */
|
|
@@ -305,7 +498,7 @@ interface ToolDefinition$1<T extends z.ZodObject<any> = any> {
|
|
|
305
498
|
/** Zod schema for input validation */
|
|
306
499
|
schema: T;
|
|
307
500
|
/** Tool execution function */
|
|
308
|
-
execute: (input: z.infer<T>) => Promise<
|
|
501
|
+
execute: (input: z.infer<T>) => Promise<unknown> | unknown;
|
|
309
502
|
/** Optional: Additional compliance checks */
|
|
310
503
|
beforeExecute?: (input: z.infer<T>) => Promise<void> | void;
|
|
311
504
|
}
|
|
@@ -354,15 +547,15 @@ declare class SekuireAgent$1 {
|
|
|
354
547
|
/**
|
|
355
548
|
* Register a tool with the agent
|
|
356
549
|
*/
|
|
357
|
-
registerTool<T extends z.ZodObject<any>>(tool: ToolDefinition$
|
|
550
|
+
registerTool<T extends z.ZodObject<any>>(tool: ToolDefinition$2<T>): this;
|
|
358
551
|
/**
|
|
359
552
|
* Register multiple tools at once
|
|
360
553
|
*/
|
|
361
|
-
registerTools(tools: ToolDefinition$
|
|
554
|
+
registerTools(tools: ToolDefinition$2[]): this;
|
|
362
555
|
/**
|
|
363
556
|
* Get registered tools
|
|
364
557
|
*/
|
|
365
|
-
getTools(names?: string[]): ToolDefinition$
|
|
558
|
+
getTools(names?: string[]): ToolDefinition$2[];
|
|
366
559
|
/**
|
|
367
560
|
* Execute a tool by name
|
|
368
561
|
*/
|
|
@@ -398,11 +591,11 @@ declare class SekuireAgentBuilder {
|
|
|
398
591
|
/**
|
|
399
592
|
* Add a tool
|
|
400
593
|
*/
|
|
401
|
-
withTool<T extends z.ZodObject<any>>(tool: ToolDefinition$
|
|
594
|
+
withTool<T extends z.ZodObject<any>>(tool: ToolDefinition$2<T>): this;
|
|
402
595
|
/**
|
|
403
596
|
* Add multiple tools
|
|
404
597
|
*/
|
|
405
|
-
withTools(tools: ToolDefinition$
|
|
598
|
+
withTools(tools: ToolDefinition$2[]): this;
|
|
406
599
|
/**
|
|
407
600
|
* Build the agent
|
|
408
601
|
*/
|
|
@@ -422,7 +615,7 @@ declare class SekuireAgentBuilder {
|
|
|
422
615
|
declare function createAgent(config?: {
|
|
423
616
|
identity?: AgentIdentity;
|
|
424
617
|
configPath?: string;
|
|
425
|
-
tools?: ToolDefinition$
|
|
618
|
+
tools?: ToolDefinition$2[];
|
|
426
619
|
logger?: SekuireAgentConfig["logger"];
|
|
427
620
|
}): Promise<SekuireAgent$1>;
|
|
428
621
|
/**
|
|
@@ -442,7 +635,7 @@ declare function createAgent(config?: {
|
|
|
442
635
|
* });
|
|
443
636
|
* ```
|
|
444
637
|
*/
|
|
445
|
-
declare function tool<T extends z.ZodObject<any>>(definition: ToolDefinition$
|
|
638
|
+
declare function tool<T extends z.ZodObject<any>>(definition: ToolDefinition$2<T>): ToolDefinition$2<T>;
|
|
446
639
|
/**
|
|
447
640
|
* Create multiple tools at once
|
|
448
641
|
*
|
|
@@ -454,11 +647,11 @@ declare function tool<T extends z.ZodObject<any>>(definition: ToolDefinition$1<T
|
|
|
454
647
|
* );
|
|
455
648
|
* ```
|
|
456
649
|
*/
|
|
457
|
-
declare function tools<T extends ToolDefinition$
|
|
650
|
+
declare function tools<T extends ToolDefinition$2[]>(...definitions: T): T;
|
|
458
651
|
/**
|
|
459
652
|
* Get tools registered with an agent
|
|
460
653
|
*/
|
|
461
|
-
declare function getTools$1(agent: SekuireAgent$1, names?: string[]): ToolDefinition$
|
|
654
|
+
declare function getTools$1(agent: SekuireAgent$1, names?: string[]): ToolDefinition$2[];
|
|
462
655
|
|
|
463
656
|
interface ActivePolicyResponse {
|
|
464
657
|
policy_id: string;
|
|
@@ -610,6 +803,7 @@ interface WorkspaceSummary {
|
|
|
610
803
|
}
|
|
611
804
|
interface SekuireClientConfig {
|
|
612
805
|
registryUrl: string;
|
|
806
|
+
apiKey?: string;
|
|
613
807
|
timeout?: number;
|
|
614
808
|
retries?: number;
|
|
615
809
|
}
|
|
@@ -682,6 +876,177 @@ declare class SekuireClient {
|
|
|
682
876
|
getPublicKey(): string;
|
|
683
877
|
}
|
|
684
878
|
|
|
879
|
+
interface RegistryClientConfig {
|
|
880
|
+
apiUrl: string;
|
|
881
|
+
apiKey?: string;
|
|
882
|
+
timeout?: number;
|
|
883
|
+
retries?: number;
|
|
884
|
+
}
|
|
885
|
+
interface PublishAgentOptions {
|
|
886
|
+
manifest: Manifest;
|
|
887
|
+
privateKeyHex: string;
|
|
888
|
+
systemPrompt: string;
|
|
889
|
+
tools: string;
|
|
890
|
+
publisherOrgId?: string;
|
|
891
|
+
visibility?: "public" | "private" | "internal";
|
|
892
|
+
}
|
|
893
|
+
interface UpdateAgentOptions {
|
|
894
|
+
manifest?: Partial<Manifest>;
|
|
895
|
+
visibility?: "public" | "private" | "internal";
|
|
896
|
+
gitRepository?: string;
|
|
897
|
+
}
|
|
898
|
+
interface SearchAgentsOptions {
|
|
899
|
+
query?: string;
|
|
900
|
+
tags?: string[];
|
|
901
|
+
verificationStatus?: VerificationStatus;
|
|
902
|
+
category?: string;
|
|
903
|
+
limit?: number;
|
|
904
|
+
offset?: number;
|
|
905
|
+
}
|
|
906
|
+
interface TaskCompletion {
|
|
907
|
+
taskId: string;
|
|
908
|
+
taskHash: string;
|
|
909
|
+
rating: number;
|
|
910
|
+
comment?: string;
|
|
911
|
+
evidence?: string;
|
|
912
|
+
}
|
|
913
|
+
interface LeaderboardEntry {
|
|
914
|
+
sekuireId: string;
|
|
915
|
+
name: string;
|
|
916
|
+
reputationScore: number;
|
|
917
|
+
taskCount: number;
|
|
918
|
+
verificationStatus: VerificationStatus;
|
|
919
|
+
rank: number;
|
|
920
|
+
}
|
|
921
|
+
interface PublishResponse {
|
|
922
|
+
sekuireId: string;
|
|
923
|
+
name: string;
|
|
924
|
+
version: string;
|
|
925
|
+
verificationStatus: VerificationStatus;
|
|
926
|
+
createdAt: string;
|
|
927
|
+
}
|
|
928
|
+
interface DisputeResponse {
|
|
929
|
+
id: string;
|
|
930
|
+
sekuireId: string;
|
|
931
|
+
status: "pending" | "reviewing" | "resolved" | "rejected";
|
|
932
|
+
createdAt: string;
|
|
933
|
+
}
|
|
934
|
+
interface VerificationRequest {
|
|
935
|
+
sekuireId: string;
|
|
936
|
+
repositoryUrl?: string;
|
|
937
|
+
commitHash?: string;
|
|
938
|
+
complianceFramework?: string;
|
|
939
|
+
}
|
|
940
|
+
interface VerificationResult {
|
|
941
|
+
passed: boolean;
|
|
942
|
+
securityScore: number;
|
|
943
|
+
complianceScore: number;
|
|
944
|
+
issues: VerificationIssue[];
|
|
945
|
+
timestamp: string;
|
|
946
|
+
}
|
|
947
|
+
interface VerificationIssue {
|
|
948
|
+
severity: "critical" | "high" | "medium" | "low";
|
|
949
|
+
category: string;
|
|
950
|
+
message: string;
|
|
951
|
+
file?: string;
|
|
952
|
+
line?: number;
|
|
953
|
+
}
|
|
954
|
+
interface TrustHeadersRequest {
|
|
955
|
+
agentId: string;
|
|
956
|
+
action?: string;
|
|
957
|
+
context?: Record<string, unknown>;
|
|
958
|
+
}
|
|
959
|
+
interface TrustHeaders {
|
|
960
|
+
"X-Sekuire-Agent-ID": string;
|
|
961
|
+
"X-Sekuire-Reputation": string;
|
|
962
|
+
"X-Sekuire-Verification": string;
|
|
963
|
+
"X-Sekuire-Badges": string;
|
|
964
|
+
"X-Sekuire-Timestamp": string;
|
|
965
|
+
"X-Sekuire-Signature": string;
|
|
966
|
+
}
|
|
967
|
+
declare class SekuireRegistryClient {
|
|
968
|
+
private readonly http;
|
|
969
|
+
constructor(config: RegistryClientConfig | string, authToken?: string);
|
|
970
|
+
setAuthToken(token: string): void;
|
|
971
|
+
setApiKey(apiKey: string): void;
|
|
972
|
+
publishAgent(options: PublishAgentOptions): Promise<PublishResponse>;
|
|
973
|
+
getAgent(sekuireId: string): Promise<AgentResponse>;
|
|
974
|
+
updateAgent(sekuireId: string, options: UpdateAgentOptions): Promise<AgentResponse>;
|
|
975
|
+
deleteAgent(sekuireId: string): Promise<void>;
|
|
976
|
+
listAgents(options?: SearchAgentsOptions): Promise<AgentResponse[]>;
|
|
977
|
+
searchAgents(query: string, options?: Omit<SearchAgentsOptions, "query">): Promise<AgentResponse[]>;
|
|
978
|
+
getMyAgents(): Promise<AgentResponse[]>;
|
|
979
|
+
getReputation(sekuireId: string): Promise<ReputationResponse>;
|
|
980
|
+
recordTaskCompletion(sekuireId: string, task: TaskCompletion, privateKeyHex: string): Promise<void>;
|
|
981
|
+
getLeaderboard(limit?: number): Promise<LeaderboardEntry[]>;
|
|
982
|
+
fileDispute(sekuireId: string, reason: string, evidenceLog: string, accuserId: string): Promise<DisputeResponse>;
|
|
983
|
+
verifyAgentQuick(sekuireId: string): Promise<VerificationResult>;
|
|
984
|
+
verifyAgentComprehensive(request: VerificationRequest): Promise<VerificationResult>;
|
|
985
|
+
getVerificationHistory(sekuireId: string): Promise<VerificationResult[]>;
|
|
986
|
+
getLatestVerification(sekuireId: string): Promise<VerificationResult | null>;
|
|
987
|
+
generateTrustHeaders(request: TrustHeadersRequest): Promise<TrustHeaders>;
|
|
988
|
+
getTrustProfile(agentDid: string): Promise<Record<string, unknown>>;
|
|
989
|
+
getTransactionHistory(agentDid: string): Promise<unknown[]>;
|
|
990
|
+
createTask(task: {
|
|
991
|
+
description: string;
|
|
992
|
+
capabilities: string[];
|
|
993
|
+
priority?: number;
|
|
994
|
+
callbackUrl?: string;
|
|
995
|
+
}): Promise<{
|
|
996
|
+
taskId: string;
|
|
997
|
+
status: string;
|
|
998
|
+
}>;
|
|
999
|
+
getTask(taskId: string): Promise<{
|
|
1000
|
+
taskId: string;
|
|
1001
|
+
status: string;
|
|
1002
|
+
result?: unknown;
|
|
1003
|
+
error?: string;
|
|
1004
|
+
}>;
|
|
1005
|
+
completeTask(taskId: string, result: unknown, privateKeyHex: string): Promise<void>;
|
|
1006
|
+
getRegistryStats(): Promise<{
|
|
1007
|
+
totalAgents: number;
|
|
1008
|
+
verifiedAgents: number;
|
|
1009
|
+
totalTasks: number;
|
|
1010
|
+
categories: string[];
|
|
1011
|
+
}>;
|
|
1012
|
+
getCategories(): Promise<Array<{
|
|
1013
|
+
slug: string;
|
|
1014
|
+
name: string;
|
|
1015
|
+
agentCount: number;
|
|
1016
|
+
}>>;
|
|
1017
|
+
getAgentsByCategory(categorySlug: string): Promise<AgentResponse[]>;
|
|
1018
|
+
getWorkspace(workspaceId: string): Promise<Record<string, unknown>>;
|
|
1019
|
+
getWorkspacePolicies(workspaceId: string): Promise<unknown[]>;
|
|
1020
|
+
getActivePolicy(workspaceId: string): Promise<unknown>;
|
|
1021
|
+
getPolicyTemplates(): Promise<unknown[]>;
|
|
1022
|
+
evaluatePolicy(workspaceId: string, action: {
|
|
1023
|
+
type: string;
|
|
1024
|
+
resource: string;
|
|
1025
|
+
context?: Record<string, unknown>;
|
|
1026
|
+
}): Promise<{
|
|
1027
|
+
allowed: boolean;
|
|
1028
|
+
violations: string[];
|
|
1029
|
+
}>;
|
|
1030
|
+
logAgentEvents(sekuireId: string, events: Array<{
|
|
1031
|
+
type: string;
|
|
1032
|
+
severity: string;
|
|
1033
|
+
data: Record<string, unknown>;
|
|
1034
|
+
timestamp?: string;
|
|
1035
|
+
}>): Promise<void>;
|
|
1036
|
+
logAgentHealth(sekuireId: string, health: {
|
|
1037
|
+
status: "healthy" | "degraded" | "unhealthy";
|
|
1038
|
+
uptime: number;
|
|
1039
|
+
memoryMb?: number;
|
|
1040
|
+
cpuPercent?: number;
|
|
1041
|
+
}): Promise<void>;
|
|
1042
|
+
getAgentLogs(sekuireId: string, options?: {
|
|
1043
|
+
limit?: number;
|
|
1044
|
+
offset?: number;
|
|
1045
|
+
type?: string;
|
|
1046
|
+
}): Promise<unknown[]>;
|
|
1047
|
+
}
|
|
1048
|
+
declare function createRegistryClient(apiUrl: string, authToken?: string, apiKey?: string): SekuireRegistryClient;
|
|
1049
|
+
|
|
685
1050
|
interface SekuireConfig {
|
|
686
1051
|
project: {
|
|
687
1052
|
name: string;
|
|
@@ -788,9 +1153,9 @@ interface LoggerConfig {
|
|
|
788
1153
|
}
|
|
789
1154
|
interface ToolsSchema {
|
|
790
1155
|
version: string;
|
|
791
|
-
tools: ToolDefinition[];
|
|
1156
|
+
tools: ToolDefinition$1[];
|
|
792
1157
|
}
|
|
793
|
-
interface ToolDefinition {
|
|
1158
|
+
interface ToolDefinition$1 {
|
|
794
1159
|
name: string;
|
|
795
1160
|
description: string;
|
|
796
1161
|
category?: string;
|
|
@@ -821,9 +1186,6 @@ declare function loadTools(toolsPath: string, basePath?: string): Promise<ToolsS
|
|
|
821
1186
|
*/
|
|
822
1187
|
declare function getAgentConfig(config: SekuireConfig, agentName?: string): AgentConfig;
|
|
823
1188
|
|
|
824
|
-
/**
|
|
825
|
-
* Cryptographic utilities for Sekuire protocol
|
|
826
|
-
*/
|
|
827
1189
|
declare class SekuireCrypto {
|
|
828
1190
|
/**
|
|
829
1191
|
* Generate a new Ed25519 keypair
|
|
@@ -881,19 +1243,29 @@ declare class SekuireCrypto {
|
|
|
881
1243
|
static isValidNonce(hex: string): boolean;
|
|
882
1244
|
}
|
|
883
1245
|
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
1246
|
+
interface ToolDefinition {
|
|
1247
|
+
type: 'function';
|
|
1248
|
+
function: {
|
|
1249
|
+
name: string;
|
|
1250
|
+
description?: string;
|
|
1251
|
+
parameters?: Record<string, unknown>;
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
interface ToolCallFunction {
|
|
1255
|
+
id: string;
|
|
1256
|
+
type: 'function';
|
|
1257
|
+
function: {
|
|
1258
|
+
name: string;
|
|
1259
|
+
arguments: string;
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
887
1262
|
interface Message {
|
|
888
1263
|
role: 'system' | 'user' | 'assistant' | 'function' | 'tool';
|
|
889
1264
|
content: string | null;
|
|
890
1265
|
name?: string;
|
|
891
1266
|
tool_call_id?: string;
|
|
892
|
-
tool_calls?:
|
|
1267
|
+
tool_calls?: ToolCallFunction[];
|
|
893
1268
|
}
|
|
894
|
-
/**
|
|
895
|
-
* Options for chat completion
|
|
896
|
-
*/
|
|
897
1269
|
interface ChatOptions {
|
|
898
1270
|
temperature?: number;
|
|
899
1271
|
max_tokens?: number;
|
|
@@ -902,16 +1274,13 @@ interface ChatOptions {
|
|
|
902
1274
|
presence_penalty?: number;
|
|
903
1275
|
stop?: string[];
|
|
904
1276
|
stream?: boolean;
|
|
905
|
-
tools?:
|
|
1277
|
+
tools?: ToolDefinition[];
|
|
906
1278
|
}
|
|
907
|
-
/**
|
|
908
|
-
* Response from chat completion
|
|
909
|
-
*/
|
|
910
1279
|
interface ChatResponse {
|
|
911
1280
|
content: string;
|
|
912
1281
|
model: string;
|
|
913
1282
|
finish_reason?: string;
|
|
914
|
-
tool_calls?:
|
|
1283
|
+
tool_calls?: ToolCallFunction[];
|
|
915
1284
|
usage?: {
|
|
916
1285
|
prompt_tokens: number;
|
|
917
1286
|
completion_tokens: number;
|
|
@@ -966,75 +1335,53 @@ interface LLMProviderConfig {
|
|
|
966
1335
|
maxTokens?: number;
|
|
967
1336
|
}
|
|
968
1337
|
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
1338
|
+
declare abstract class BaseLLMProvider implements LLMProvider {
|
|
1339
|
+
protected model: string;
|
|
1340
|
+
protected maxTokens: number;
|
|
1341
|
+
constructor(config: LLMProviderConfig);
|
|
1342
|
+
abstract chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
1343
|
+
abstract chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
1344
|
+
abstract getProviderName(): string;
|
|
1345
|
+
protected abstract getMaxTokensForModel(model: string): number;
|
|
1346
|
+
countTokens(text: string): number;
|
|
1347
|
+
getMaxTokens(): number;
|
|
1348
|
+
getModelName(): string;
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
declare class AnthropicProvider extends BaseLLMProvider {
|
|
974
1352
|
private client;
|
|
975
|
-
private model;
|
|
976
|
-
private maxTokens;
|
|
977
1353
|
constructor(config: LLMProviderConfig);
|
|
978
1354
|
chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
979
1355
|
chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
980
|
-
countTokens(text: string): number;
|
|
981
|
-
getMaxTokens(): number;
|
|
982
1356
|
getProviderName(): string;
|
|
983
|
-
|
|
984
|
-
private getMaxTokensForModel;
|
|
1357
|
+
protected getMaxTokensForModel(model: string): number;
|
|
985
1358
|
}
|
|
986
1359
|
|
|
987
|
-
|
|
988
|
-
* Google Gemini LLM Provider
|
|
989
|
-
* Supports Gemini Pro, Gemini Pro Vision, and other Google models
|
|
990
|
-
*/
|
|
991
|
-
declare class GoogleProvider implements LLMProvider {
|
|
1360
|
+
declare class GoogleProvider extends BaseLLMProvider {
|
|
992
1361
|
private client;
|
|
993
|
-
private model;
|
|
994
|
-
private maxTokens;
|
|
995
1362
|
constructor(config: LLMProviderConfig);
|
|
996
1363
|
chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
997
1364
|
chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
998
|
-
countTokens(text: string): number;
|
|
999
|
-
getMaxTokens(): number;
|
|
1000
1365
|
getProviderName(): string;
|
|
1001
|
-
|
|
1002
|
-
private getMaxTokensForModel;
|
|
1366
|
+
protected getMaxTokensForModel(model: string): number;
|
|
1003
1367
|
}
|
|
1004
1368
|
|
|
1005
|
-
|
|
1006
|
-
* Ollama LLM Provider
|
|
1007
|
-
* Supports local models via Ollama (Llama 2, Mistral, CodeLlama, etc.)
|
|
1008
|
-
*/
|
|
1009
|
-
declare class OllamaProvider implements LLMProvider {
|
|
1369
|
+
declare class OllamaProvider extends BaseLLMProvider {
|
|
1010
1370
|
private baseUrl;
|
|
1011
|
-
private model;
|
|
1012
|
-
private maxTokens;
|
|
1013
1371
|
constructor(config: LLMProviderConfig);
|
|
1014
1372
|
chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
1015
1373
|
chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
1016
|
-
countTokens(text: string): number;
|
|
1017
|
-
getMaxTokens(): number;
|
|
1018
1374
|
getProviderName(): string;
|
|
1019
|
-
|
|
1375
|
+
protected getMaxTokensForModel(_model: string): number;
|
|
1020
1376
|
}
|
|
1021
1377
|
|
|
1022
|
-
|
|
1023
|
-
* OpenAI LLM Provider
|
|
1024
|
-
* Supports GPT-3.5, GPT-4, and other OpenAI models
|
|
1025
|
-
*/
|
|
1026
|
-
declare class OpenAIProvider implements LLMProvider {
|
|
1378
|
+
declare class OpenAIProvider extends BaseLLMProvider {
|
|
1027
1379
|
private client;
|
|
1028
|
-
private model;
|
|
1029
|
-
private maxTokens;
|
|
1030
1380
|
constructor(config: LLMProviderConfig);
|
|
1031
1381
|
chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
1032
1382
|
chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
1033
|
-
countTokens(text: string): number;
|
|
1034
|
-
getMaxTokens(): number;
|
|
1035
1383
|
getProviderName(): string;
|
|
1036
|
-
|
|
1037
|
-
private getMaxTokensForModel;
|
|
1384
|
+
protected getMaxTokensForModel(model: string): number;
|
|
1038
1385
|
}
|
|
1039
1386
|
|
|
1040
1387
|
/**
|
|
@@ -1045,27 +1392,15 @@ declare function createLLMProvider(provider: string, config: LLMProviderConfig):
|
|
|
1045
1392
|
* Factory functions for easy LLM instantiation
|
|
1046
1393
|
*/
|
|
1047
1394
|
declare const llm: {
|
|
1048
|
-
/**
|
|
1049
|
-
* Create OpenAI provider (GPT-4, GPT-3.5, etc.)
|
|
1050
|
-
*/
|
|
1051
1395
|
openai: (config: Omit<LLMProviderConfig, "model"> & {
|
|
1052
1396
|
model?: string;
|
|
1053
1397
|
}) => OpenAIProvider;
|
|
1054
|
-
/**
|
|
1055
|
-
* Create Anthropic provider (Claude 3, Claude 3.5, etc.)
|
|
1056
|
-
*/
|
|
1057
1398
|
anthropic: (config: Omit<LLMProviderConfig, "model"> & {
|
|
1058
1399
|
model?: string;
|
|
1059
1400
|
}) => AnthropicProvider;
|
|
1060
|
-
/**
|
|
1061
|
-
* Create Google provider (Gemini Pro, Gemini 1.5, etc.)
|
|
1062
|
-
*/
|
|
1063
1401
|
google: (config: Omit<LLMProviderConfig, "model"> & {
|
|
1064
1402
|
model?: string;
|
|
1065
1403
|
}) => GoogleProvider;
|
|
1066
|
-
/**
|
|
1067
|
-
* Create Ollama provider (local models: Llama 2, Mistral, etc.)
|
|
1068
|
-
*/
|
|
1069
1404
|
ollama: (config: Omit<LLMProviderConfig, "model"> & {
|
|
1070
1405
|
model?: string;
|
|
1071
1406
|
}) => OllamaProvider;
|
|
@@ -1148,7 +1483,7 @@ declare class RedisStorage extends BaseMemoryStorage {
|
|
|
1148
1483
|
disconnect(): Promise<void>;
|
|
1149
1484
|
}
|
|
1150
1485
|
|
|
1151
|
-
type MemoryType = 'in-memory' | 'redis' | 'postgres';
|
|
1486
|
+
type MemoryType = 'in-memory' | 'redis' | 'postgres' | 'buffer';
|
|
1152
1487
|
interface MemoryFactoryConfig {
|
|
1153
1488
|
type: MemoryType;
|
|
1154
1489
|
redis?: RedisConfig;
|
|
@@ -1201,7 +1536,7 @@ declare class PolicyEnforcer {
|
|
|
1201
1536
|
*/
|
|
1202
1537
|
interface AgentOptions {
|
|
1203
1538
|
llm?: LLMProvider;
|
|
1204
|
-
tools?: ToolDefinition[];
|
|
1539
|
+
tools?: ToolDefinition$1[];
|
|
1205
1540
|
memory?: MemoryStorage;
|
|
1206
1541
|
systemPrompt?: string;
|
|
1207
1542
|
policyPath?: string;
|
|
@@ -1222,7 +1557,7 @@ declare class SekuireAgent {
|
|
|
1222
1557
|
name: string;
|
|
1223
1558
|
llm: LLMProvider;
|
|
1224
1559
|
systemPrompt: string;
|
|
1225
|
-
tools: ToolDefinition[];
|
|
1560
|
+
tools: ToolDefinition$1[];
|
|
1226
1561
|
memory?: MemoryStorage;
|
|
1227
1562
|
maxHistoryMessages?: number;
|
|
1228
1563
|
policyEnforcer?: PolicyEnforcer;
|
|
@@ -1259,7 +1594,7 @@ declare class SekuireAgent {
|
|
|
1259
1594
|
/**
|
|
1260
1595
|
* Get available tools
|
|
1261
1596
|
*/
|
|
1262
|
-
getTools(): ToolDefinition[];
|
|
1597
|
+
getTools(): ToolDefinition$1[];
|
|
1263
1598
|
/**
|
|
1264
1599
|
* Get the active policy enforcer
|
|
1265
1600
|
*/
|
|
@@ -1325,7 +1660,7 @@ declare function getSystemPrompt(agentName?: string, configPath?: string): Promi
|
|
|
1325
1660
|
* console.log(toolsSchema.tools);
|
|
1326
1661
|
* ```
|
|
1327
1662
|
*/
|
|
1328
|
-
declare function getTools(agentName?: string, configPath?: string): Promise<ToolDefinition[]>;
|
|
1663
|
+
declare function getTools(agentName?: string, configPath?: string): Promise<ToolDefinition$1[]>;
|
|
1329
1664
|
|
|
1330
1665
|
/**
|
|
1331
1666
|
* Base class for implementing Sekuire protocol servers
|
|
@@ -1430,90 +1765,38 @@ declare class AgentStatusTool extends Tool {
|
|
|
1430
1765
|
* Tool for invoking other Sekuire agents
|
|
1431
1766
|
* Performs handshake and sends requests to verified agents
|
|
1432
1767
|
*/
|
|
1433
|
-
declare class InvokeAgentTool
|
|
1768
|
+
declare class InvokeAgentTool extends Tool {
|
|
1769
|
+
metadata: ToolMetadata;
|
|
1770
|
+
private client;
|
|
1434
1771
|
private readonly privateKey?;
|
|
1435
1772
|
private readonly publicKey?;
|
|
1436
1773
|
private readonly registryUrl;
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
parameters: {
|
|
1440
|
-
type: "object";
|
|
1441
|
-
properties: {
|
|
1442
|
-
agent_url: {
|
|
1443
|
-
type: "string";
|
|
1444
|
-
description: string;
|
|
1445
|
-
};
|
|
1446
|
-
agent_id: {
|
|
1447
|
-
type: "string";
|
|
1448
|
-
description: string;
|
|
1449
|
-
};
|
|
1450
|
-
request: {
|
|
1451
|
-
type: "string";
|
|
1452
|
-
description: string;
|
|
1453
|
-
};
|
|
1454
|
-
parameters: {
|
|
1455
|
-
type: "object";
|
|
1456
|
-
description: string;
|
|
1457
|
-
};
|
|
1458
|
-
};
|
|
1459
|
-
required: string[];
|
|
1460
|
-
};
|
|
1461
|
-
metadata: ToolMetadata;
|
|
1462
|
-
private client;
|
|
1463
|
-
constructor(privateKey?: string | undefined, publicKey?: string | undefined, registryUrl?: string);
|
|
1464
|
-
execute(args: Record<string, any>): Promise<string>;
|
|
1774
|
+
constructor(privateKey?: string, publicKey?: string, registryUrl?: string);
|
|
1775
|
+
execute(input: ToolInput): Promise<string>;
|
|
1465
1776
|
}
|
|
1466
1777
|
/**
|
|
1467
1778
|
* Tool for searching the Sekuire registry for agents
|
|
1468
1779
|
*/
|
|
1469
|
-
declare class SearchAgentsTool
|
|
1780
|
+
declare class SearchAgentsTool extends Tool {
|
|
1781
|
+
metadata: ToolMetadata;
|
|
1782
|
+
private client;
|
|
1470
1783
|
private readonly privateKey?;
|
|
1471
1784
|
private readonly publicKey?;
|
|
1472
1785
|
private readonly registryUrl;
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
parameters: {
|
|
1476
|
-
type: "object";
|
|
1477
|
-
properties: {
|
|
1478
|
-
query: {
|
|
1479
|
-
type: "string";
|
|
1480
|
-
description: string;
|
|
1481
|
-
};
|
|
1482
|
-
limit: {
|
|
1483
|
-
type: "number";
|
|
1484
|
-
description: string;
|
|
1485
|
-
};
|
|
1486
|
-
};
|
|
1487
|
-
required: string[];
|
|
1488
|
-
};
|
|
1489
|
-
metadata: ToolMetadata;
|
|
1490
|
-
private client;
|
|
1491
|
-
constructor(privateKey?: string | undefined, publicKey?: string | undefined, registryUrl?: string);
|
|
1492
|
-
execute(args: Record<string, any>): Promise<string>;
|
|
1786
|
+
constructor(privateKey?: string, publicKey?: string, registryUrl?: string);
|
|
1787
|
+
execute(input: ToolInput): Promise<string>;
|
|
1493
1788
|
}
|
|
1494
1789
|
/**
|
|
1495
1790
|
* Tool for getting detailed information about a specific agent
|
|
1496
1791
|
*/
|
|
1497
|
-
declare class GetAgentInfoTool
|
|
1792
|
+
declare class GetAgentInfoTool extends Tool {
|
|
1793
|
+
metadata: ToolMetadata;
|
|
1794
|
+
private client;
|
|
1498
1795
|
private readonly privateKey?;
|
|
1499
1796
|
private readonly publicKey?;
|
|
1500
1797
|
private readonly registryUrl;
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
parameters: {
|
|
1504
|
-
type: "object";
|
|
1505
|
-
properties: {
|
|
1506
|
-
agent_id: {
|
|
1507
|
-
type: "string";
|
|
1508
|
-
description: string;
|
|
1509
|
-
};
|
|
1510
|
-
};
|
|
1511
|
-
required: string[];
|
|
1512
|
-
};
|
|
1513
|
-
metadata: ToolMetadata;
|
|
1514
|
-
private client;
|
|
1515
|
-
constructor(privateKey?: string | undefined, publicKey?: string | undefined, registryUrl?: string);
|
|
1516
|
-
execute(args: Record<string, any>): Promise<string>;
|
|
1798
|
+
constructor(privateKey?: string, publicKey?: string, registryUrl?: string);
|
|
1799
|
+
execute(input: ToolInput): Promise<string>;
|
|
1517
1800
|
}
|
|
1518
1801
|
|
|
1519
1802
|
declare class CalculatorTool extends Tool {
|
|
@@ -1980,11 +2263,11 @@ declare const builtInTools: {
|
|
|
1980
2263
|
/**
|
|
1981
2264
|
* Create a tool for discovering other agents in the Sekuire network
|
|
1982
2265
|
*/
|
|
1983
|
-
declare function createDiscoveryTool(client: SekuireClient): ToolDefinition$
|
|
2266
|
+
declare function createDiscoveryTool(client: SekuireClient): ToolDefinition$2;
|
|
1984
2267
|
/**
|
|
1985
2268
|
* Create a tool for delegating tasks to other agents
|
|
1986
2269
|
*/
|
|
1987
|
-
declare function createDelegationTool(client: SekuireClient): ToolDefinition$
|
|
2270
|
+
declare function createDelegationTool(client: SekuireClient): ToolDefinition$2;
|
|
1988
2271
|
|
|
1989
2272
|
/**
|
|
1990
2273
|
* Generate a new Ed25519 keypair for Sekuire operations
|
|
@@ -2005,5 +2288,585 @@ declare function calculateSekuireId(params: {
|
|
|
2005
2288
|
*/
|
|
2006
2289
|
declare function createSekuireClient(keyPair: KeyPair, registryUrl?: string, options?: Partial<SekuireClientConfig>): SekuireClient;
|
|
2007
2290
|
|
|
2008
|
-
|
|
2009
|
-
|
|
2291
|
+
/**
|
|
2292
|
+
* Sekuire Task Worker
|
|
2293
|
+
*
|
|
2294
|
+
* Handles SSE connection to Core for real-time task delivery.
|
|
2295
|
+
* Provides `onTask()` API for agents to register task handlers.
|
|
2296
|
+
*/
|
|
2297
|
+
interface TaskEvent {
|
|
2298
|
+
task_id: string;
|
|
2299
|
+
capability?: string;
|
|
2300
|
+
tool?: string;
|
|
2301
|
+
input: Record<string, unknown>;
|
|
2302
|
+
workspace_id: string;
|
|
2303
|
+
requester_agent_id?: string;
|
|
2304
|
+
parent_task_id?: string;
|
|
2305
|
+
trace_id?: string;
|
|
2306
|
+
workflow_id?: string;
|
|
2307
|
+
}
|
|
2308
|
+
interface TaskContext {
|
|
2309
|
+
taskId: string;
|
|
2310
|
+
workspaceId: string;
|
|
2311
|
+
requesterId?: string;
|
|
2312
|
+
parentTaskId?: string;
|
|
2313
|
+
traceId?: string;
|
|
2314
|
+
workflowId?: string;
|
|
2315
|
+
}
|
|
2316
|
+
type TaskHandler = (ctx: TaskContext, input: Record<string, unknown>) => Promise<unknown>;
|
|
2317
|
+
interface WorkerConfig {
|
|
2318
|
+
apiBaseUrl: string;
|
|
2319
|
+
token: string;
|
|
2320
|
+
agentId?: string;
|
|
2321
|
+
apiKey?: string;
|
|
2322
|
+
heartbeatIntervalMs?: number;
|
|
2323
|
+
reconnectDelayMs?: number;
|
|
2324
|
+
maxReconnectDelayMs?: number;
|
|
2325
|
+
deploymentUrl?: string;
|
|
2326
|
+
}
|
|
2327
|
+
declare class TaskWorker {
|
|
2328
|
+
private eventSource;
|
|
2329
|
+
private handlers;
|
|
2330
|
+
private config;
|
|
2331
|
+
private heartbeatInterval;
|
|
2332
|
+
private reconnectDelay;
|
|
2333
|
+
private isConnected;
|
|
2334
|
+
private isPaused;
|
|
2335
|
+
private installationId;
|
|
2336
|
+
private onCommandCallback?;
|
|
2337
|
+
constructor(config: WorkerConfig);
|
|
2338
|
+
/**
|
|
2339
|
+
* Register a handler for a specific capability
|
|
2340
|
+
*/
|
|
2341
|
+
onTask(capability: string, handler: TaskHandler): this;
|
|
2342
|
+
/**
|
|
2343
|
+
* Start the worker (connects to SSE stream and starts heartbeat)
|
|
2344
|
+
*/
|
|
2345
|
+
start(): Promise<void>;
|
|
2346
|
+
/**
|
|
2347
|
+
* Stop the worker gracefully
|
|
2348
|
+
*/
|
|
2349
|
+
stop(): Promise<void>;
|
|
2350
|
+
/**
|
|
2351
|
+
* Check if the worker is currently paused
|
|
2352
|
+
*/
|
|
2353
|
+
getIsPaused(): boolean;
|
|
2354
|
+
/**
|
|
2355
|
+
* Register a callback for control commands
|
|
2356
|
+
*/
|
|
2357
|
+
onCommand(callback: (cmd: {
|
|
2358
|
+
type: string;
|
|
2359
|
+
reason?: string;
|
|
2360
|
+
}) => void): this;
|
|
2361
|
+
/**
|
|
2362
|
+
* Handle control commands from SSE or heartbeat fallback
|
|
2363
|
+
*/
|
|
2364
|
+
private handleCommand;
|
|
2365
|
+
/**
|
|
2366
|
+
* Get API key from config or environment
|
|
2367
|
+
*/
|
|
2368
|
+
private getApiKey;
|
|
2369
|
+
/**
|
|
2370
|
+
* Connect to SSE stream
|
|
2371
|
+
*/
|
|
2372
|
+
private connect;
|
|
2373
|
+
/**
|
|
2374
|
+
* Schedule reconnection with exponential backoff
|
|
2375
|
+
*/
|
|
2376
|
+
private scheduleReconnect;
|
|
2377
|
+
/**
|
|
2378
|
+
* Handle incoming task
|
|
2379
|
+
*/
|
|
2380
|
+
private handleTask;
|
|
2381
|
+
/**
|
|
2382
|
+
* Report task completion to Core
|
|
2383
|
+
*/
|
|
2384
|
+
private completeTask;
|
|
2385
|
+
/**
|
|
2386
|
+
* Register this agent installation with Sekuire
|
|
2387
|
+
*/
|
|
2388
|
+
private bootstrap;
|
|
2389
|
+
/**
|
|
2390
|
+
* Start heartbeat loop
|
|
2391
|
+
*/
|
|
2392
|
+
private startHeartbeat;
|
|
2393
|
+
}
|
|
2394
|
+
declare function createWorker(config: WorkerConfig): TaskWorker;
|
|
2395
|
+
|
|
2396
|
+
interface SekuireExporterConfig {
|
|
2397
|
+
apiUrl: string;
|
|
2398
|
+
agentId: string;
|
|
2399
|
+
authToken?: string;
|
|
2400
|
+
workspaceId?: string;
|
|
2401
|
+
}
|
|
2402
|
+
declare class SekuireSpanExporter implements SpanExporter {
|
|
2403
|
+
private config;
|
|
2404
|
+
private pendingExport;
|
|
2405
|
+
constructor(config: SekuireExporterConfig);
|
|
2406
|
+
export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
|
|
2407
|
+
private spanToEvent;
|
|
2408
|
+
private mapSpanToEventType;
|
|
2409
|
+
private getDurationMs;
|
|
2410
|
+
private extractAttributes;
|
|
2411
|
+
private sendEvents;
|
|
2412
|
+
shutdown(): Promise<void>;
|
|
2413
|
+
forceFlush(): Promise<void>;
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
type ExporterType = 'otlp' | 'sekuire' | 'console' | 'none';
|
|
2417
|
+
interface TelemetryConfig {
|
|
2418
|
+
enabled?: boolean;
|
|
2419
|
+
agentId: string;
|
|
2420
|
+
exporter?: ExporterType;
|
|
2421
|
+
otlpEndpoint?: string;
|
|
2422
|
+
sekuireApiUrl?: string;
|
|
2423
|
+
authToken?: string;
|
|
2424
|
+
workspaceId?: string;
|
|
2425
|
+
debug?: boolean;
|
|
2426
|
+
batchConfig?: {
|
|
2427
|
+
maxQueueSize?: number;
|
|
2428
|
+
maxExportBatchSize?: number;
|
|
2429
|
+
scheduledDelayMillis?: number;
|
|
2430
|
+
};
|
|
2431
|
+
}
|
|
2432
|
+
declare function initTelemetry(config: TelemetryConfig): Tracer;
|
|
2433
|
+
declare function getTracer(): Tracer;
|
|
2434
|
+
declare function shutdownTelemetry(): Promise<void>;
|
|
2435
|
+
|
|
2436
|
+
declare function detectDeploymentUrl(): string | undefined;
|
|
2437
|
+
|
|
2438
|
+
/**
|
|
2439
|
+
* A2A Protocol Type Definitions
|
|
2440
|
+
*
|
|
2441
|
+
* Types implementing the A2A Protocol specification for agent interoperability.
|
|
2442
|
+
* See: https://github.com/a2aproject/A2A
|
|
2443
|
+
*/
|
|
2444
|
+
/** Full A2A-compliant Agent Card */
|
|
2445
|
+
interface AgentCard {
|
|
2446
|
+
/** Unique agent identifier (e.g., "sekuire:workspace:agent-name") */
|
|
2447
|
+
agentId: string;
|
|
2448
|
+
/** Human-readable agent name */
|
|
2449
|
+
name: string;
|
|
2450
|
+
/** Agent description */
|
|
2451
|
+
description: string;
|
|
2452
|
+
/** Semantic version */
|
|
2453
|
+
version: string;
|
|
2454
|
+
/** Provider information */
|
|
2455
|
+
provider?: AgentProvider;
|
|
2456
|
+
/** Supported A2A protocol versions */
|
|
2457
|
+
protocolVersions: string[];
|
|
2458
|
+
/** Agent capabilities */
|
|
2459
|
+
capabilities: AgentCapabilities;
|
|
2460
|
+
/** Skills the agent provides */
|
|
2461
|
+
skills: AgentSkill[];
|
|
2462
|
+
/** Default input MIME types accepted */
|
|
2463
|
+
defaultInputModes?: string[];
|
|
2464
|
+
/** Default output MIME types produced */
|
|
2465
|
+
defaultOutputModes?: string[];
|
|
2466
|
+
/** Security schemes supported */
|
|
2467
|
+
securitySchemes?: Record<string, SecurityScheme>;
|
|
2468
|
+
/** Required security scheme names */
|
|
2469
|
+
security?: string[];
|
|
2470
|
+
/** Base URL for A2A endpoints */
|
|
2471
|
+
url: string;
|
|
2472
|
+
}
|
|
2473
|
+
/** Provider information */
|
|
2474
|
+
interface AgentProvider {
|
|
2475
|
+
name: string;
|
|
2476
|
+
url?: string;
|
|
2477
|
+
}
|
|
2478
|
+
/** Agent capabilities */
|
|
2479
|
+
interface AgentCapabilities {
|
|
2480
|
+
/** Supports streaming responses via SSE */
|
|
2481
|
+
streaming: boolean;
|
|
2482
|
+
/** Supports push notifications */
|
|
2483
|
+
pushNotifications: boolean;
|
|
2484
|
+
/** Supports extended agent card endpoint */
|
|
2485
|
+
extendedAgentCard: boolean;
|
|
2486
|
+
}
|
|
2487
|
+
/** Security scheme definition */
|
|
2488
|
+
interface SecurityScheme {
|
|
2489
|
+
type: string;
|
|
2490
|
+
scheme?: string;
|
|
2491
|
+
bearerFormat?: string;
|
|
2492
|
+
}
|
|
2493
|
+
/** Structured skill definition */
|
|
2494
|
+
interface AgentSkill {
|
|
2495
|
+
/** Skill identifier (e.g., "document:summarize") */
|
|
2496
|
+
id: string;
|
|
2497
|
+
/** Human-readable skill name */
|
|
2498
|
+
name: string;
|
|
2499
|
+
/** Skill description */
|
|
2500
|
+
description?: string;
|
|
2501
|
+
/** Tags for categorization */
|
|
2502
|
+
tags?: string[];
|
|
2503
|
+
/** Input MIME types accepted */
|
|
2504
|
+
inputModes?: string[];
|
|
2505
|
+
/** Output MIME types produced */
|
|
2506
|
+
outputModes?: string[];
|
|
2507
|
+
/** Example prompts */
|
|
2508
|
+
examples?: string[];
|
|
2509
|
+
}
|
|
2510
|
+
/** A2A message with role and parts */
|
|
2511
|
+
interface A2AMessage {
|
|
2512
|
+
/** Message role: "user" or "agent" */
|
|
2513
|
+
role: "user" | "agent";
|
|
2514
|
+
/** Message content parts */
|
|
2515
|
+
parts: A2AMessagePart[];
|
|
2516
|
+
}
|
|
2517
|
+
/** Message part content */
|
|
2518
|
+
type A2AMessagePart = {
|
|
2519
|
+
type: "text";
|
|
2520
|
+
text: string;
|
|
2521
|
+
} | {
|
|
2522
|
+
type: "file";
|
|
2523
|
+
uri: string;
|
|
2524
|
+
mimeType?: string;
|
|
2525
|
+
} | {
|
|
2526
|
+
type: "data";
|
|
2527
|
+
data: unknown;
|
|
2528
|
+
};
|
|
2529
|
+
/** A2A task states */
|
|
2530
|
+
type A2ATaskState = "pending" | "working" | "input-required" | "completed" | "failed" | "cancelled";
|
|
2531
|
+
/** A2A task status with timestamp */
|
|
2532
|
+
interface A2ATaskStatus {
|
|
2533
|
+
state: A2ATaskState;
|
|
2534
|
+
timestamp: string;
|
|
2535
|
+
}
|
|
2536
|
+
/** Full A2A task */
|
|
2537
|
+
interface A2ATask {
|
|
2538
|
+
taskId: string;
|
|
2539
|
+
contextId?: string;
|
|
2540
|
+
status: A2ATaskStatus;
|
|
2541
|
+
artifacts: A2AArtifact[];
|
|
2542
|
+
history: A2AMessage[];
|
|
2543
|
+
/** ID of the task that delegated to this task */
|
|
2544
|
+
parentTaskId?: string;
|
|
2545
|
+
/** Trace ID shared across the delegation chain */
|
|
2546
|
+
traceId?: string;
|
|
2547
|
+
}
|
|
2548
|
+
/** Task artifact output */
|
|
2549
|
+
interface A2AArtifact {
|
|
2550
|
+
name?: string;
|
|
2551
|
+
parts: A2AMessagePart[];
|
|
2552
|
+
index?: number;
|
|
2553
|
+
}
|
|
2554
|
+
/** Request for skill-based auto-discovery routing */
|
|
2555
|
+
interface A2ARouteRequest {
|
|
2556
|
+
/** Required skill (e.g., "document:summarize") */
|
|
2557
|
+
skill: string;
|
|
2558
|
+
/** Message to send to the agent */
|
|
2559
|
+
message: A2AMessage;
|
|
2560
|
+
/** Optional conversation context ID */
|
|
2561
|
+
contextId?: string;
|
|
2562
|
+
/** Parent task ID for delegation tracking */
|
|
2563
|
+
parentTaskId?: string;
|
|
2564
|
+
/** Trace ID for the entire delegation chain */
|
|
2565
|
+
traceId?: string;
|
|
2566
|
+
}
|
|
2567
|
+
/** Response from skill-based routing */
|
|
2568
|
+
interface A2ARouteResponse {
|
|
2569
|
+
/** Created task ID */
|
|
2570
|
+
taskId: string;
|
|
2571
|
+
/** Current task status */
|
|
2572
|
+
status: A2ATaskState;
|
|
2573
|
+
/** ID of the selected agent */
|
|
2574
|
+
agentId: string;
|
|
2575
|
+
/** Initial response message (if any) */
|
|
2576
|
+
message?: A2AMessage;
|
|
2577
|
+
/** Trace ID for the delegation chain */
|
|
2578
|
+
traceId?: string;
|
|
2579
|
+
}
|
|
2580
|
+
/** JSON-RPC 2.0 Request */
|
|
2581
|
+
interface JsonRpcRequest {
|
|
2582
|
+
jsonrpc: "2.0";
|
|
2583
|
+
method: string;
|
|
2584
|
+
id: string | number;
|
|
2585
|
+
params?: unknown;
|
|
2586
|
+
}
|
|
2587
|
+
/** JSON-RPC 2.0 Response */
|
|
2588
|
+
interface JsonRpcResponse<T = unknown> {
|
|
2589
|
+
jsonrpc: "2.0";
|
|
2590
|
+
id: string | number;
|
|
2591
|
+
result?: T;
|
|
2592
|
+
error?: JsonRpcError;
|
|
2593
|
+
}
|
|
2594
|
+
/** JSON-RPC 2.0 Error */
|
|
2595
|
+
interface JsonRpcError {
|
|
2596
|
+
code: number;
|
|
2597
|
+
message: string;
|
|
2598
|
+
data?: unknown;
|
|
2599
|
+
}
|
|
2600
|
+
/** Parameters for tasks/send method */
|
|
2601
|
+
interface TasksSendParams {
|
|
2602
|
+
/** Optional existing task ID to continue */
|
|
2603
|
+
taskId?: string;
|
|
2604
|
+
/** Message to send */
|
|
2605
|
+
message: A2AMessage;
|
|
2606
|
+
/** Optional context ID for grouping tasks */
|
|
2607
|
+
contextId?: string;
|
|
2608
|
+
}
|
|
2609
|
+
/** Parameters for tasks/get method */
|
|
2610
|
+
interface TasksGetParams {
|
|
2611
|
+
taskId: string;
|
|
2612
|
+
}
|
|
2613
|
+
/** Parameters for tasks/cancel method */
|
|
2614
|
+
interface TasksCancelParams {
|
|
2615
|
+
taskId: string;
|
|
2616
|
+
}
|
|
2617
|
+
/** Parameters for tasks/sendSubscribe method */
|
|
2618
|
+
interface TasksSendSubscribeParams {
|
|
2619
|
+
/** Optional existing task ID to continue */
|
|
2620
|
+
taskId?: string;
|
|
2621
|
+
/** Message to send */
|
|
2622
|
+
message: A2AMessage;
|
|
2623
|
+
}
|
|
2624
|
+
/** SSE task update event */
|
|
2625
|
+
interface TaskUpdateEvent {
|
|
2626
|
+
taskId: string;
|
|
2627
|
+
status: A2ATaskState;
|
|
2628
|
+
updatedAt: string;
|
|
2629
|
+
message?: A2AMessage;
|
|
2630
|
+
artifacts?: A2AArtifact[];
|
|
2631
|
+
}
|
|
2632
|
+
|
|
2633
|
+
/**
|
|
2634
|
+
* A2A Protocol Client
|
|
2635
|
+
*
|
|
2636
|
+
* Client for interacting with A2A-compliant agents via the Sekuire API.
|
|
2637
|
+
*/
|
|
2638
|
+
|
|
2639
|
+
interface A2AClientOptions {
|
|
2640
|
+
/** Base URL for the Sekuire API */
|
|
2641
|
+
baseUrl: string;
|
|
2642
|
+
/** Authentication token */
|
|
2643
|
+
authToken: string;
|
|
2644
|
+
/** Optional timeout in milliseconds (default: 30000) */
|
|
2645
|
+
timeout?: number;
|
|
2646
|
+
}
|
|
2647
|
+
/**
|
|
2648
|
+
* A2A Protocol Client
|
|
2649
|
+
*
|
|
2650
|
+
* @example
|
|
2651
|
+
* ```typescript
|
|
2652
|
+
* const client = new A2AClient({
|
|
2653
|
+
* baseUrl: "https://api.sekuire.ai",
|
|
2654
|
+
* authToken: "your-token",
|
|
2655
|
+
* });
|
|
2656
|
+
*
|
|
2657
|
+
* // Auto-discover and send task by skill
|
|
2658
|
+
* const result = await client.sendBySkill({
|
|
2659
|
+
* skill: "document:summarize",
|
|
2660
|
+
* message: {
|
|
2661
|
+
* role: "user",
|
|
2662
|
+
* parts: [{ type: "text", text: "Summarize this document" }],
|
|
2663
|
+
* },
|
|
2664
|
+
* });
|
|
2665
|
+
*
|
|
2666
|
+
* // Stream task updates
|
|
2667
|
+
* for await (const event of client.subscribe(result.taskId)) {
|
|
2668
|
+
* console.log(event.status, event.artifacts);
|
|
2669
|
+
* }
|
|
2670
|
+
* ```
|
|
2671
|
+
*/
|
|
2672
|
+
declare class A2AClient {
|
|
2673
|
+
private baseUrl;
|
|
2674
|
+
private authToken;
|
|
2675
|
+
private timeout;
|
|
2676
|
+
constructor(options: A2AClientOptions);
|
|
2677
|
+
/**
|
|
2678
|
+
* Send a task by skill using auto-discovery routing.
|
|
2679
|
+
* The API will find an agent with the matching skill and forward the task.
|
|
2680
|
+
*/
|
|
2681
|
+
sendBySkill(request: A2ARouteRequest): Promise<A2ARouteResponse>;
|
|
2682
|
+
/**
|
|
2683
|
+
* Send a message directly to a specific agent.
|
|
2684
|
+
*/
|
|
2685
|
+
send(agentUrl: string, message: A2AMessage, taskId?: string): Promise<A2ATask>;
|
|
2686
|
+
/**
|
|
2687
|
+
* Send a task via JSON-RPC to the Sekuire API.
|
|
2688
|
+
*/
|
|
2689
|
+
sendTask(params: TasksSendParams): Promise<A2ATask>;
|
|
2690
|
+
/**
|
|
2691
|
+
* Get task status and details.
|
|
2692
|
+
*/
|
|
2693
|
+
getTask(taskId: string): Promise<A2ATask>;
|
|
2694
|
+
/**
|
|
2695
|
+
* Cancel a running task.
|
|
2696
|
+
*/
|
|
2697
|
+
cancelTask(taskId: string): Promise<A2ATask>;
|
|
2698
|
+
/**
|
|
2699
|
+
* Subscribe to task updates via SSE.
|
|
2700
|
+
*
|
|
2701
|
+
* @example
|
|
2702
|
+
* ```typescript
|
|
2703
|
+
* for await (const event of client.subscribe(taskId)) {
|
|
2704
|
+
* console.log(event.status);
|
|
2705
|
+
* if (event.status === "completed") break;
|
|
2706
|
+
* }
|
|
2707
|
+
* ```
|
|
2708
|
+
*/
|
|
2709
|
+
subscribe(taskId: string): AsyncGenerator<TaskUpdateEvent>;
|
|
2710
|
+
/**
|
|
2711
|
+
* Get an agent's card (capabilities, skills).
|
|
2712
|
+
*/
|
|
2713
|
+
getAgentCard(agentId: string): Promise<AgentCard>;
|
|
2714
|
+
/**
|
|
2715
|
+
* Make a JSON-RPC call to the A2A endpoint.
|
|
2716
|
+
*/
|
|
2717
|
+
private jsonRpc;
|
|
2718
|
+
private fetch;
|
|
2719
|
+
}
|
|
2720
|
+
/**
|
|
2721
|
+
* A2A Protocol Error
|
|
2722
|
+
*/
|
|
2723
|
+
declare class A2AError extends Error {
|
|
2724
|
+
readonly code: string;
|
|
2725
|
+
readonly jsonRpcCode?: number | undefined;
|
|
2726
|
+
constructor(message: string, code: string, jsonRpcCode?: number | undefined);
|
|
2727
|
+
}
|
|
2728
|
+
|
|
2729
|
+
/**
|
|
2730
|
+
* A2A Protocol Server
|
|
2731
|
+
*
|
|
2732
|
+
* Server implementation for creating A2A-compliant agents with streaming support.
|
|
2733
|
+
*/
|
|
2734
|
+
|
|
2735
|
+
interface A2AServerOptions {
|
|
2736
|
+
card: AgentCard;
|
|
2737
|
+
identity?: AgentIdentity;
|
|
2738
|
+
port?: number;
|
|
2739
|
+
handlers: Record<string, SkillHandler>;
|
|
2740
|
+
streamingHandlers?: Record<string, StreamingSkillHandler>;
|
|
2741
|
+
}
|
|
2742
|
+
type SkillHandler = (message: A2AMessage, context: SkillContext) => Promise<A2AMessage | A2AArtifact[]>;
|
|
2743
|
+
type StreamingSkillHandler = (message: A2AMessage, context: StreamingSkillContext) => AsyncGenerator<StreamingUpdate>;
|
|
2744
|
+
interface SkillContext {
|
|
2745
|
+
taskId: string;
|
|
2746
|
+
contextId?: string;
|
|
2747
|
+
history: A2AMessage[];
|
|
2748
|
+
}
|
|
2749
|
+
interface StreamingSkillContext extends SkillContext {
|
|
2750
|
+
emit: (update: StreamingUpdate) => void;
|
|
2751
|
+
}
|
|
2752
|
+
type StreamingUpdate = {
|
|
2753
|
+
type: "progress";
|
|
2754
|
+
message: string;
|
|
2755
|
+
percent?: number;
|
|
2756
|
+
} | {
|
|
2757
|
+
type: "artifact";
|
|
2758
|
+
artifact: A2AArtifact;
|
|
2759
|
+
} | {
|
|
2760
|
+
type: "message";
|
|
2761
|
+
message: A2AMessage;
|
|
2762
|
+
} | {
|
|
2763
|
+
type: "status";
|
|
2764
|
+
status: A2ATaskState;
|
|
2765
|
+
};
|
|
2766
|
+
interface TaskState {
|
|
2767
|
+
id: string;
|
|
2768
|
+
contextId?: string;
|
|
2769
|
+
status: A2ATaskState;
|
|
2770
|
+
history: A2AMessage[];
|
|
2771
|
+
artifacts: A2AArtifact[];
|
|
2772
|
+
createdAt: Date;
|
|
2773
|
+
updatedAt: Date;
|
|
2774
|
+
subscribers: Set<(event: TaskUpdateEvent) => void>;
|
|
2775
|
+
}
|
|
2776
|
+
declare class A2AServer {
|
|
2777
|
+
private card;
|
|
2778
|
+
private identity?;
|
|
2779
|
+
private handlers;
|
|
2780
|
+
private streamingHandlers;
|
|
2781
|
+
private tasks;
|
|
2782
|
+
private heartbeatInterval?;
|
|
2783
|
+
constructor(options: A2AServerOptions);
|
|
2784
|
+
/**
|
|
2785
|
+
* Start sending heartbeats to the registry
|
|
2786
|
+
* @param publicUrl The public URL where this agent is reachable
|
|
2787
|
+
* @param registryUrl The registry API base URL (default: http://localhost:3000)
|
|
2788
|
+
*/
|
|
2789
|
+
startHeartbeat(publicUrl: string, registryUrl?: string): Promise<void>;
|
|
2790
|
+
stopHeartbeat(): void;
|
|
2791
|
+
getAgentCard(): AgentCard;
|
|
2792
|
+
getTask(taskId: string): TaskState | undefined;
|
|
2793
|
+
handleRequest(request: JsonRpcRequest): Promise<JsonRpcResponse>;
|
|
2794
|
+
handleStreamingRequest(request: JsonRpcRequest): AsyncGenerator<TaskUpdateEvent>;
|
|
2795
|
+
subscribeToTask(taskId: string): AsyncGenerator<TaskUpdateEvent> | null;
|
|
2796
|
+
formatSSE(event: TaskUpdateEvent): string;
|
|
2797
|
+
notifySubscribers(taskId: string): void;
|
|
2798
|
+
private handleTasksSend;
|
|
2799
|
+
private handleTasksGet;
|
|
2800
|
+
private handleTasksCancel;
|
|
2801
|
+
private findHandler;
|
|
2802
|
+
private findStreamingHandler;
|
|
2803
|
+
private findHandlerInMap;
|
|
2804
|
+
private extractText;
|
|
2805
|
+
private createUpdateEvent;
|
|
2806
|
+
private taskToResponse;
|
|
2807
|
+
private success;
|
|
2808
|
+
private error;
|
|
2809
|
+
private generateId;
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
/**
|
|
2813
|
+
* A2A Task Delegator
|
|
2814
|
+
*
|
|
2815
|
+
* Enables agents to delegate tasks to other agents and receive completion callbacks.
|
|
2816
|
+
* Provides a complete feedback loop for multi-agent orchestration.
|
|
2817
|
+
*/
|
|
2818
|
+
|
|
2819
|
+
interface DelegatorConfig {
|
|
2820
|
+
apiUrl: string;
|
|
2821
|
+
authToken: string;
|
|
2822
|
+
workspaceId: string;
|
|
2823
|
+
agentId: string;
|
|
2824
|
+
timeout?: number;
|
|
2825
|
+
pollInterval?: number;
|
|
2826
|
+
}
|
|
2827
|
+
interface DelegationRequest {
|
|
2828
|
+
skill: string;
|
|
2829
|
+
message: string | A2AMessage;
|
|
2830
|
+
contextId?: string;
|
|
2831
|
+
parentTaskId?: string;
|
|
2832
|
+
traceId?: string;
|
|
2833
|
+
timeout?: number;
|
|
2834
|
+
onProgress?: (event: TaskUpdateEvent) => void;
|
|
2835
|
+
}
|
|
2836
|
+
interface DelegationResult {
|
|
2837
|
+
taskId: string;
|
|
2838
|
+
agentId: string;
|
|
2839
|
+
traceId?: string;
|
|
2840
|
+
status: A2ATaskState;
|
|
2841
|
+
result?: A2AMessage;
|
|
2842
|
+
artifacts?: Array<{
|
|
2843
|
+
name?: string;
|
|
2844
|
+
parts: Array<{
|
|
2845
|
+
type: string;
|
|
2846
|
+
text?: string;
|
|
2847
|
+
}>;
|
|
2848
|
+
}>;
|
|
2849
|
+
error?: string;
|
|
2850
|
+
executionTimeMs: number;
|
|
2851
|
+
}
|
|
2852
|
+
declare class A2ATaskDelegator {
|
|
2853
|
+
private client;
|
|
2854
|
+
private config;
|
|
2855
|
+
private activeDelegations;
|
|
2856
|
+
constructor(config: DelegatorConfig);
|
|
2857
|
+
delegate(request: DelegationRequest): Promise<DelegationResult>;
|
|
2858
|
+
delegateWithStreaming(request: DelegationRequest): AsyncGenerator<TaskUpdateEvent, DelegationResult>;
|
|
2859
|
+
cancelDelegation(taskId: string): void;
|
|
2860
|
+
cancelAllDelegations(): void;
|
|
2861
|
+
discoverAgents(skill: string): Promise<Array<{
|
|
2862
|
+
agentId: string;
|
|
2863
|
+
name: string;
|
|
2864
|
+
}>>;
|
|
2865
|
+
private waitForCompletion;
|
|
2866
|
+
private pollForCompletion;
|
|
2867
|
+
private sleep;
|
|
2868
|
+
}
|
|
2869
|
+
declare function createDelegator(config: DelegatorConfig): A2ATaskDelegator;
|
|
2870
|
+
|
|
2871
|
+
export { A2AClient, A2AError, A2AServer, A2ATaskDelegator, SekuireAgent as Agent, AgentIdentity, AnthropicProvider, Beacon, ComplianceError, ComplianceMonitor, ContentPolicyError, CryptoError, DEFAULT_API_URL, FileAccessError, GoogleProvider, InMemoryStorage, NetworkComplianceError, NetworkError, OllamaProvider, OpenAIProvider, PolicyClient, PolicyEnforcer, PolicyViolationError, PostgresStorage, ProtocolError, RedisStorage, SekuireAgent$1 as SekuireAgent, SekuireAgentBuilder, SekuireClient, SekuireCrypto, SekuireError, SekuireLogger, SekuireRegistryClient, SekuireSDK, SekuireServer, SekuireSpanExporter, TaskWorker, Tool, ToolPatternParser, ToolRegistry, ToolUsageError, builtInTools, calculateSekuireId, createAgent, createBeacon, createDefaultToolRegistry, createDelegationTool, createDelegator, createDiscoveryTool, createLLMProvider, createMemoryStorage, createRegistryClient, createSekuireClient, createSekuireExpressMiddleware, createSekuireFastifyPlugin, createWorker, detectDeploymentUrl, generateKeyPair, getAgent, getAgentConfig, getAgents, getTools$1 as getLegacyTools, getSystemPrompt, getTools, getTracer, initTelemetry, llm, loadConfig, loadSystemPrompt, loadTools, shutdownTelemetry, tool, tools };
|
|
2872
|
+
export type { A2AArtifact, A2AClientOptions, A2AMessage, A2AMessagePart, A2ARouteRequest, A2ARouteResponse, A2AServerOptions, A2ATask, A2ATaskState, A2ATaskStatus, ActivePolicy, ActivePolicyResponse, AgentCapabilities, AgentCard, AgentConfig, AgentId, AgentInvokeOptions, AgentOptions, AgentProvider, AgentResponse$1 as AgentResponse, AgentSkill, BeaconConfig, BeaconStatus, ChatChunk, ChatOptions, ChatResponse, ComplianceConfig, ComplianceViolation, ToolDefinition$1 as ConfigToolDefinition, CreateOrgRequest, CreateWorkspaceRequest, DelegationRequest, DelegationResult, DelegatorConfig, DisputeRequest, DisputeResponse, EventLog, EventType, ExporterType, HandshakeAuth, HandshakeHello, HandshakeResult, HandshakeWelcome, HexString, IdentityConfig, InviteRequest, InviteResponse, JsonRpcError, JsonRpcRequest, JsonRpcResponse, KeyPair, LLMConfig, Message as LLMMessage, LLMProvider, LLMProviderConfig, ToolCallFunction as LLMToolCall, ToolDefinition as LLMToolDefinition, LeaderboardEntry, LoggerConfig$1 as LoggerConfig, Manifest, MemoryConfig, MemoryFactoryConfig, MemoryMessage, MemoryStorage, MemoryType, Message$1 as Message, OrgResponse, OrgSummary, PostgresConfig, ProjectMetadata, PublishAgentOptions, PublishRequest, PublishResponse, RedisConfig, RegistryClientConfig, ReputationLog, ReputationResponse, SearchAgentsOptions, SekuireAgentConfig, SekuireClientConfig, SekuireConfig, SekuireExporterConfig, SekuireSDKConfig, Severity, SkillContext, SkillHandler, StreamingSkillContext, StreamingSkillHandler, StreamingUpdate, SubmitReputationRequest, TaskCompletion, TaskContext, TaskEvent, TaskHandler, TaskState, TaskUpdateEvent, TasksCancelParams, TasksGetParams, TasksSendParams, TasksSendSubscribeParams, TelemetryConfig, ToolCall, ToolDefinition$2 as ToolDefinition, ToolInput, ToolMetadata, ToolParameter, ToolsSchema, TrustHeaders, TrustHeadersRequest, UpdateAgentOptions, UserContextResponse, VerificationIssue, VerificationRequest, VerificationResult, VerificationStatus, VerifyAgentRequest, WorkerConfig, WorkspaceResponse, WorkspaceSummary };
|