@sekuire/sdk 0.1.9 → 0.1.11
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/README.md +69 -5
- 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 +100 -0
- package/dist/compliance.d.ts +3 -3
- package/dist/config/loader.d.ts +38 -1
- 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 +1315 -175
- package/dist/index.esm.js +16151 -5209
- package/dist/index.js +16178 -5207
- 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/base.d.ts +7 -0
- package/dist/memory/cloudflare-d1.d.ts +24 -0
- package/dist/memory/cloudflare-kv.d.ts +25 -0
- package/dist/memory/convex.d.ts +21 -0
- package/dist/memory/dynamodb.d.ts +28 -0
- package/dist/memory/in-memory.d.ts +1 -0
- package/dist/memory/index.d.ts +28 -1
- package/dist/memory/postgres.d.ts +5 -1
- package/dist/memory/redis.d.ts +5 -1
- package/dist/memory/registry.d.ts +12 -0
- package/dist/memory/sqlite.d.ts +22 -0
- package/dist/memory/turso.d.ts +23 -0
- package/dist/memory/upstash.d.ts +22 -0
- 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 +117 -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 +40 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,127 @@
|
|
|
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
|
+
* Supports two authentication modes:
|
|
13
|
+
* 1. Install Token (recommended): Use an install token from the dashboard
|
|
14
|
+
* 2. API Key: Use an API key for SDK-initiated bootstrap (requires workspace)
|
|
15
|
+
*/
|
|
16
|
+
interface BeaconConfig {
|
|
17
|
+
/** Sekuire Core API base URL */
|
|
18
|
+
apiBaseUrl: string;
|
|
19
|
+
/** Install token from dashboard (preferred for BYOC deployments) */
|
|
20
|
+
installToken?: string;
|
|
21
|
+
/** API key for authentication (reads from SEKUIRE_API_KEY if not set) */
|
|
22
|
+
apiKey?: string;
|
|
23
|
+
/** Agent ID to register */
|
|
24
|
+
agentId: string;
|
|
25
|
+
/** Workspace ID (required when using API key without install token) */
|
|
26
|
+
workspaceId?: string;
|
|
27
|
+
/** Heartbeat interval in seconds (default: 60) */
|
|
28
|
+
heartbeatIntervalSeconds?: number;
|
|
29
|
+
/** Optional explicit deployment URL (auto-detected if not set) */
|
|
30
|
+
deploymentUrl?: string;
|
|
31
|
+
/** Optional capabilities this agent provides */
|
|
32
|
+
capabilities?: string[];
|
|
33
|
+
/** Optional callback invoked on status changes */
|
|
34
|
+
onStatusChange?: (status: BeaconStatus) => void;
|
|
35
|
+
}
|
|
36
|
+
interface BeaconStatus {
|
|
37
|
+
isRunning: boolean;
|
|
38
|
+
installationId?: string;
|
|
39
|
+
runtimeToken?: string;
|
|
40
|
+
deploymentUrl?: string;
|
|
41
|
+
lastHeartbeat?: Date;
|
|
42
|
+
failedHeartbeats: number;
|
|
43
|
+
}
|
|
44
|
+
interface BootstrapResponse {
|
|
45
|
+
installation_id: string;
|
|
46
|
+
runtime_token: string;
|
|
47
|
+
refresh_token: string;
|
|
48
|
+
expires_at: string;
|
|
49
|
+
heartbeat_interval: number;
|
|
50
|
+
}
|
|
51
|
+
declare class Beacon {
|
|
52
|
+
private config;
|
|
53
|
+
private intervalId;
|
|
54
|
+
private installationId;
|
|
55
|
+
private runtimeToken;
|
|
56
|
+
private refreshToken;
|
|
57
|
+
private lastHeartbeat;
|
|
58
|
+
private failedHeartbeats;
|
|
59
|
+
constructor(config: BeaconConfig);
|
|
60
|
+
/**
|
|
61
|
+
* Start the beacon - registers with Sekuire and begins heartbeat loop
|
|
62
|
+
*/
|
|
63
|
+
start(): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Stop the beacon
|
|
66
|
+
*/
|
|
67
|
+
stop(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Get current beacon status
|
|
70
|
+
*/
|
|
71
|
+
getStatus(): BeaconStatus;
|
|
72
|
+
/**
|
|
73
|
+
* Bootstrap registration with Sekuire
|
|
74
|
+
*
|
|
75
|
+
* Exchanges an install token for runtime credentials (installation_id + runtime_token).
|
|
76
|
+
* The install token is obtained from the dashboard or CLI.
|
|
77
|
+
*/
|
|
78
|
+
private bootstrap;
|
|
79
|
+
/**
|
|
80
|
+
* Send heartbeat (lease renewal) to Sekuire
|
|
81
|
+
*
|
|
82
|
+
* Uses the installation-based lease endpoint with runtime token authentication.
|
|
83
|
+
*/
|
|
84
|
+
private heartbeat;
|
|
85
|
+
/**
|
|
86
|
+
* Refresh the runtime token using the refresh token
|
|
87
|
+
*/
|
|
88
|
+
private refreshRuntimeToken;
|
|
89
|
+
/**
|
|
90
|
+
* Notify status change callback
|
|
91
|
+
*/
|
|
92
|
+
private notifyStatusChange;
|
|
93
|
+
/**
|
|
94
|
+
* Get API key from environment
|
|
95
|
+
*/
|
|
96
|
+
private getApiKey;
|
|
97
|
+
/**
|
|
98
|
+
* Get install token from environment
|
|
99
|
+
*/
|
|
100
|
+
private getInstallToken;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Create a new beacon instance
|
|
104
|
+
*/
|
|
105
|
+
declare function createBeacon(config: BeaconConfig): Beacon;
|
|
106
|
+
|
|
107
|
+
declare class AgentIdentity {
|
|
108
|
+
readonly name: string;
|
|
109
|
+
readonly sekuireId: string;
|
|
110
|
+
private readonly privateKey?;
|
|
111
|
+
readonly publicKey?: string | undefined;
|
|
112
|
+
constructor(name: string, sekuireId: string, privateKey?: string | undefined, publicKey?: string | undefined);
|
|
113
|
+
static load(manifestPath?: string): Promise<AgentIdentity>;
|
|
114
|
+
/**
|
|
115
|
+
* Sign a message using Ed25519
|
|
116
|
+
* @param message The message string to sign
|
|
117
|
+
* @returns Hex-encoded signature
|
|
118
|
+
*/
|
|
119
|
+
sign(message: string): Promise<string>;
|
|
120
|
+
/**
|
|
121
|
+
* Verify a signature (useful for testing)
|
|
122
|
+
*/
|
|
123
|
+
verify(message: string, signatureHex: string): boolean;
|
|
124
|
+
}
|
|
2
125
|
|
|
3
126
|
/**
|
|
4
127
|
* 🛡️ Sekuire Logger - Asynchronous Event Logging for TypeScript SDK
|
|
@@ -17,6 +140,10 @@ interface LoggerConfig$1 {
|
|
|
17
140
|
enabled?: boolean;
|
|
18
141
|
batchSize?: number;
|
|
19
142
|
flushInterval?: number;
|
|
143
|
+
onError?: (error: Error, context: {
|
|
144
|
+
operation: string;
|
|
145
|
+
eventsLost?: number;
|
|
146
|
+
}) => void;
|
|
20
147
|
}
|
|
21
148
|
interface EventLog {
|
|
22
149
|
sekuire_id: string;
|
|
@@ -92,6 +219,122 @@ declare class SekuireLogger {
|
|
|
92
219
|
setEnabled(enabled: boolean): void;
|
|
93
220
|
}
|
|
94
221
|
|
|
222
|
+
/**
|
|
223
|
+
* SekuireSDK - Main SDK entry point for TypeScript agents
|
|
224
|
+
*
|
|
225
|
+
* Combines identity, logging, and heartbeat functionality with a simple API.
|
|
226
|
+
*/
|
|
227
|
+
|
|
228
|
+
declare const DEFAULT_API_URL = "https://api.sekuire.ai";
|
|
229
|
+
interface SekuireSDKConfig {
|
|
230
|
+
privateKey?: string;
|
|
231
|
+
agentId: string;
|
|
232
|
+
agentName?: string;
|
|
233
|
+
apiUrl?: string;
|
|
234
|
+
apiKey?: string;
|
|
235
|
+
/** Install token from dashboard (preferred for BYOC deployments) */
|
|
236
|
+
installToken?: string;
|
|
237
|
+
workspaceId?: string;
|
|
238
|
+
environment?: string;
|
|
239
|
+
autoHeartbeat?: boolean;
|
|
240
|
+
/** Heartbeat interval in seconds (default: 60) */
|
|
241
|
+
heartbeatIntervalSeconds?: number;
|
|
242
|
+
loggingEnabled?: boolean;
|
|
243
|
+
/** Capabilities this agent provides */
|
|
244
|
+
capabilities?: string[];
|
|
245
|
+
}
|
|
246
|
+
declare class SekuireSDK {
|
|
247
|
+
private config;
|
|
248
|
+
private identity;
|
|
249
|
+
private logger;
|
|
250
|
+
private client;
|
|
251
|
+
private beacon;
|
|
252
|
+
private isRunning;
|
|
253
|
+
constructor(config: SekuireSDKConfig);
|
|
254
|
+
/**
|
|
255
|
+
* Create SDK instance from environment variables.
|
|
256
|
+
*
|
|
257
|
+
* Required env vars:
|
|
258
|
+
* SEKUIRE_AGENT_ID - The agent's sekuire_id
|
|
259
|
+
* SEKUIRE_INSTALL_TOKEN - Install token from dashboard (required for heartbeat)
|
|
260
|
+
*
|
|
261
|
+
* Optional env vars:
|
|
262
|
+
* SEKUIRE_API_KEY - API key for authentication (X-API-Key header)
|
|
263
|
+
* SEKUIRE_PRIVATE_KEY - Private key for signing
|
|
264
|
+
* SEKUIRE_AGENT_NAME - Human-readable agent name
|
|
265
|
+
* SEKUIRE_API_URL - API base URL (default: https://api.sekuire.ai)
|
|
266
|
+
* SEKUIRE_WORKSPACE_ID - Workspace ID for policy enforcement
|
|
267
|
+
* SEKUIRE_ENVIRONMENT - Environment name (default: production)
|
|
268
|
+
*/
|
|
269
|
+
static fromEnv(options?: {
|
|
270
|
+
autoHeartbeat?: boolean;
|
|
271
|
+
loggingEnabled?: boolean;
|
|
272
|
+
}): SekuireSDK;
|
|
273
|
+
/**
|
|
274
|
+
* Start the SDK.
|
|
275
|
+
*
|
|
276
|
+
* - Bootstraps with Sekuire using the install token
|
|
277
|
+
* - Starts auto-heartbeat loop if enabled
|
|
278
|
+
*
|
|
279
|
+
* Requires SEKUIRE_INSTALL_TOKEN to be set (from dashboard or CLI).
|
|
280
|
+
*/
|
|
281
|
+
start(): Promise<void>;
|
|
282
|
+
/**
|
|
283
|
+
* Check if the beacon is connected and sending heartbeats.
|
|
284
|
+
*
|
|
285
|
+
* @returns True if the beacon has successfully bootstrapped
|
|
286
|
+
*/
|
|
287
|
+
isConnected(): boolean;
|
|
288
|
+
/**
|
|
289
|
+
* Log an event to Sekuire.
|
|
290
|
+
*
|
|
291
|
+
* @param eventType Type of event (tool_execution, model_call, policy_check, etc.)
|
|
292
|
+
* @param data Event-specific data
|
|
293
|
+
* @param severity Severity level (debug, info, warn, error)
|
|
294
|
+
*/
|
|
295
|
+
log(eventType: EventType, data: Record<string, unknown>, severity?: Severity): void;
|
|
296
|
+
/**
|
|
297
|
+
* Check if an action is allowed by the workspace policy.
|
|
298
|
+
*
|
|
299
|
+
* @param action The action to check (e.g., "read_file", "network_access")
|
|
300
|
+
* @param context Context for the action (e.g., {path: "/etc/passwd"})
|
|
301
|
+
* @returns True if allowed, False if denied
|
|
302
|
+
*/
|
|
303
|
+
checkPolicy(action: string, context: Record<string, unknown>): Promise<boolean>;
|
|
304
|
+
/**
|
|
305
|
+
* Shutdown the SDK gracefully.
|
|
306
|
+
*/
|
|
307
|
+
shutdown(): Promise<void>;
|
|
308
|
+
/**
|
|
309
|
+
* Get the current beacon status (heartbeat health, connection info).
|
|
310
|
+
*/
|
|
311
|
+
getBeaconStatus(): BeaconStatus;
|
|
312
|
+
/**
|
|
313
|
+
* Get the agent ID.
|
|
314
|
+
*/
|
|
315
|
+
get agentId(): string;
|
|
316
|
+
/**
|
|
317
|
+
* Get the agent's public key.
|
|
318
|
+
*/
|
|
319
|
+
get publicKey(): string | undefined;
|
|
320
|
+
/**
|
|
321
|
+
* Sign a message with the agent's private key.
|
|
322
|
+
*/
|
|
323
|
+
sign(message: string): Promise<string>;
|
|
324
|
+
/**
|
|
325
|
+
* Verify a signature using the agent's public key.
|
|
326
|
+
*/
|
|
327
|
+
verify(message: string, signature: string): boolean;
|
|
328
|
+
/**
|
|
329
|
+
* Get the underlying identity object.
|
|
330
|
+
*/
|
|
331
|
+
getIdentity(): AgentIdentity;
|
|
332
|
+
/**
|
|
333
|
+
* Get the underlying logger object.
|
|
334
|
+
*/
|
|
335
|
+
getLogger(): SekuireLogger;
|
|
336
|
+
}
|
|
337
|
+
|
|
95
338
|
/**
|
|
96
339
|
* 🛡️ Sekuire Compliance Enforcement System for TypeScript
|
|
97
340
|
*
|
|
@@ -203,21 +446,21 @@ declare class ComplianceMonitor {
|
|
|
203
446
|
* @param codeSnippet Code snippet for pattern checking
|
|
204
447
|
* @throws ToolUsageError If tool usage is blocked
|
|
205
448
|
*/
|
|
206
|
-
checkToolUsage(toolName: string, codeSnippet?: string):
|
|
449
|
+
checkToolUsage(toolName: string, codeSnippet?: string): void;
|
|
207
450
|
/**
|
|
208
451
|
* 💬 Check input content for policy violations
|
|
209
452
|
*
|
|
210
453
|
* @param content Input content to check
|
|
211
454
|
* @throws ContentPolicyError If content violates policy
|
|
212
455
|
*/
|
|
213
|
-
checkInputContent(content: string):
|
|
456
|
+
checkInputContent(content: string): void;
|
|
214
457
|
/**
|
|
215
458
|
* 📤 Check output content for policy violations
|
|
216
459
|
*
|
|
217
460
|
* @param content Output content to check
|
|
218
461
|
* @throws ContentPolicyError If content violates policy
|
|
219
462
|
*/
|
|
220
|
-
checkOutputContent(content: string):
|
|
463
|
+
checkOutputContent(content: string): void;
|
|
221
464
|
private checkContent;
|
|
222
465
|
/**
|
|
223
466
|
* 🤖 Check AI model usage compliance
|
|
@@ -266,16 +509,6 @@ declare class ComplianceMonitor {
|
|
|
266
509
|
preWarmCaches(): void;
|
|
267
510
|
}
|
|
268
511
|
|
|
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
512
|
/**
|
|
280
513
|
* Sekuire Agent Framework
|
|
281
514
|
*
|
|
@@ -297,7 +530,7 @@ interface SekuireAgentConfig {
|
|
|
297
530
|
/** Optional custom compliance monitor */
|
|
298
531
|
compliance?: ComplianceMonitor;
|
|
299
532
|
}
|
|
300
|
-
interface ToolDefinition$
|
|
533
|
+
interface ToolDefinition$2<T extends z.ZodObject<any> = any> {
|
|
301
534
|
/** Unique tool name */
|
|
302
535
|
name: string;
|
|
303
536
|
/** Human-readable description */
|
|
@@ -305,7 +538,7 @@ interface ToolDefinition$1<T extends z.ZodObject<any> = any> {
|
|
|
305
538
|
/** Zod schema for input validation */
|
|
306
539
|
schema: T;
|
|
307
540
|
/** Tool execution function */
|
|
308
|
-
execute: (input: z.infer<T>) => Promise<
|
|
541
|
+
execute: (input: z.infer<T>) => Promise<unknown> | unknown;
|
|
309
542
|
/** Optional: Additional compliance checks */
|
|
310
543
|
beforeExecute?: (input: z.infer<T>) => Promise<void> | void;
|
|
311
544
|
}
|
|
@@ -354,15 +587,15 @@ declare class SekuireAgent$1 {
|
|
|
354
587
|
/**
|
|
355
588
|
* Register a tool with the agent
|
|
356
589
|
*/
|
|
357
|
-
registerTool<T extends z.ZodObject<any>>(tool: ToolDefinition$
|
|
590
|
+
registerTool<T extends z.ZodObject<any>>(tool: ToolDefinition$2<T>): this;
|
|
358
591
|
/**
|
|
359
592
|
* Register multiple tools at once
|
|
360
593
|
*/
|
|
361
|
-
registerTools(tools: ToolDefinition$
|
|
594
|
+
registerTools(tools: ToolDefinition$2[]): this;
|
|
362
595
|
/**
|
|
363
596
|
* Get registered tools
|
|
364
597
|
*/
|
|
365
|
-
getTools(names?: string[]): ToolDefinition$
|
|
598
|
+
getTools(names?: string[]): ToolDefinition$2[];
|
|
366
599
|
/**
|
|
367
600
|
* Execute a tool by name
|
|
368
601
|
*/
|
|
@@ -398,11 +631,11 @@ declare class SekuireAgentBuilder {
|
|
|
398
631
|
/**
|
|
399
632
|
* Add a tool
|
|
400
633
|
*/
|
|
401
|
-
withTool<T extends z.ZodObject<any>>(tool: ToolDefinition$
|
|
634
|
+
withTool<T extends z.ZodObject<any>>(tool: ToolDefinition$2<T>): this;
|
|
402
635
|
/**
|
|
403
636
|
* Add multiple tools
|
|
404
637
|
*/
|
|
405
|
-
withTools(tools: ToolDefinition$
|
|
638
|
+
withTools(tools: ToolDefinition$2[]): this;
|
|
406
639
|
/**
|
|
407
640
|
* Build the agent
|
|
408
641
|
*/
|
|
@@ -422,7 +655,7 @@ declare class SekuireAgentBuilder {
|
|
|
422
655
|
declare function createAgent(config?: {
|
|
423
656
|
identity?: AgentIdentity;
|
|
424
657
|
configPath?: string;
|
|
425
|
-
tools?: ToolDefinition$
|
|
658
|
+
tools?: ToolDefinition$2[];
|
|
426
659
|
logger?: SekuireAgentConfig["logger"];
|
|
427
660
|
}): Promise<SekuireAgent$1>;
|
|
428
661
|
/**
|
|
@@ -442,7 +675,7 @@ declare function createAgent(config?: {
|
|
|
442
675
|
* });
|
|
443
676
|
* ```
|
|
444
677
|
*/
|
|
445
|
-
declare function tool<T extends z.ZodObject<any>>(definition: ToolDefinition$
|
|
678
|
+
declare function tool<T extends z.ZodObject<any>>(definition: ToolDefinition$2<T>): ToolDefinition$2<T>;
|
|
446
679
|
/**
|
|
447
680
|
* Create multiple tools at once
|
|
448
681
|
*
|
|
@@ -454,11 +687,11 @@ declare function tool<T extends z.ZodObject<any>>(definition: ToolDefinition$1<T
|
|
|
454
687
|
* );
|
|
455
688
|
* ```
|
|
456
689
|
*/
|
|
457
|
-
declare function tools<T extends ToolDefinition$
|
|
690
|
+
declare function tools<T extends ToolDefinition$2[]>(...definitions: T): T;
|
|
458
691
|
/**
|
|
459
692
|
* Get tools registered with an agent
|
|
460
693
|
*/
|
|
461
|
-
declare function getTools$1(agent: SekuireAgent$1, names?: string[]): ToolDefinition$
|
|
694
|
+
declare function getTools$1(agent: SekuireAgent$1, names?: string[]): ToolDefinition$2[];
|
|
462
695
|
|
|
463
696
|
interface ActivePolicyResponse {
|
|
464
697
|
policy_id: string;
|
|
@@ -610,6 +843,7 @@ interface WorkspaceSummary {
|
|
|
610
843
|
}
|
|
611
844
|
interface SekuireClientConfig {
|
|
612
845
|
registryUrl: string;
|
|
846
|
+
apiKey?: string;
|
|
613
847
|
timeout?: number;
|
|
614
848
|
retries?: number;
|
|
615
849
|
}
|
|
@@ -682,6 +916,177 @@ declare class SekuireClient {
|
|
|
682
916
|
getPublicKey(): string;
|
|
683
917
|
}
|
|
684
918
|
|
|
919
|
+
interface RegistryClientConfig {
|
|
920
|
+
apiUrl: string;
|
|
921
|
+
apiKey?: string;
|
|
922
|
+
timeout?: number;
|
|
923
|
+
retries?: number;
|
|
924
|
+
}
|
|
925
|
+
interface PublishAgentOptions {
|
|
926
|
+
manifest: Manifest;
|
|
927
|
+
privateKeyHex: string;
|
|
928
|
+
systemPrompt: string;
|
|
929
|
+
tools: string;
|
|
930
|
+
publisherOrgId?: string;
|
|
931
|
+
visibility?: "public" | "private" | "internal";
|
|
932
|
+
}
|
|
933
|
+
interface UpdateAgentOptions {
|
|
934
|
+
manifest?: Partial<Manifest>;
|
|
935
|
+
visibility?: "public" | "private" | "internal";
|
|
936
|
+
gitRepository?: string;
|
|
937
|
+
}
|
|
938
|
+
interface SearchAgentsOptions {
|
|
939
|
+
query?: string;
|
|
940
|
+
tags?: string[];
|
|
941
|
+
verificationStatus?: VerificationStatus;
|
|
942
|
+
category?: string;
|
|
943
|
+
limit?: number;
|
|
944
|
+
offset?: number;
|
|
945
|
+
}
|
|
946
|
+
interface TaskCompletion {
|
|
947
|
+
taskId: string;
|
|
948
|
+
taskHash: string;
|
|
949
|
+
rating: number;
|
|
950
|
+
comment?: string;
|
|
951
|
+
evidence?: string;
|
|
952
|
+
}
|
|
953
|
+
interface LeaderboardEntry {
|
|
954
|
+
sekuireId: string;
|
|
955
|
+
name: string;
|
|
956
|
+
reputationScore: number;
|
|
957
|
+
taskCount: number;
|
|
958
|
+
verificationStatus: VerificationStatus;
|
|
959
|
+
rank: number;
|
|
960
|
+
}
|
|
961
|
+
interface PublishResponse {
|
|
962
|
+
sekuireId: string;
|
|
963
|
+
name: string;
|
|
964
|
+
version: string;
|
|
965
|
+
verificationStatus: VerificationStatus;
|
|
966
|
+
createdAt: string;
|
|
967
|
+
}
|
|
968
|
+
interface DisputeResponse {
|
|
969
|
+
id: string;
|
|
970
|
+
sekuireId: string;
|
|
971
|
+
status: "pending" | "reviewing" | "resolved" | "rejected";
|
|
972
|
+
createdAt: string;
|
|
973
|
+
}
|
|
974
|
+
interface VerificationRequest {
|
|
975
|
+
sekuireId: string;
|
|
976
|
+
repositoryUrl?: string;
|
|
977
|
+
commitHash?: string;
|
|
978
|
+
complianceFramework?: string;
|
|
979
|
+
}
|
|
980
|
+
interface VerificationResult {
|
|
981
|
+
passed: boolean;
|
|
982
|
+
securityScore: number;
|
|
983
|
+
complianceScore: number;
|
|
984
|
+
issues: VerificationIssue[];
|
|
985
|
+
timestamp: string;
|
|
986
|
+
}
|
|
987
|
+
interface VerificationIssue {
|
|
988
|
+
severity: "critical" | "high" | "medium" | "low";
|
|
989
|
+
category: string;
|
|
990
|
+
message: string;
|
|
991
|
+
file?: string;
|
|
992
|
+
line?: number;
|
|
993
|
+
}
|
|
994
|
+
interface TrustHeadersRequest {
|
|
995
|
+
agentId: string;
|
|
996
|
+
action?: string;
|
|
997
|
+
context?: Record<string, unknown>;
|
|
998
|
+
}
|
|
999
|
+
interface TrustHeaders {
|
|
1000
|
+
"X-Sekuire-Agent-ID": string;
|
|
1001
|
+
"X-Sekuire-Reputation": string;
|
|
1002
|
+
"X-Sekuire-Verification": string;
|
|
1003
|
+
"X-Sekuire-Badges": string;
|
|
1004
|
+
"X-Sekuire-Timestamp": string;
|
|
1005
|
+
"X-Sekuire-Signature": string;
|
|
1006
|
+
}
|
|
1007
|
+
declare class SekuireRegistryClient {
|
|
1008
|
+
private readonly http;
|
|
1009
|
+
constructor(config: RegistryClientConfig | string, authToken?: string);
|
|
1010
|
+
setAuthToken(token: string): void;
|
|
1011
|
+
setApiKey(apiKey: string): void;
|
|
1012
|
+
publishAgent(options: PublishAgentOptions): Promise<PublishResponse>;
|
|
1013
|
+
getAgent(sekuireId: string): Promise<AgentResponse>;
|
|
1014
|
+
updateAgent(sekuireId: string, options: UpdateAgentOptions): Promise<AgentResponse>;
|
|
1015
|
+
deleteAgent(sekuireId: string): Promise<void>;
|
|
1016
|
+
listAgents(options?: SearchAgentsOptions): Promise<AgentResponse[]>;
|
|
1017
|
+
searchAgents(query: string, options?: Omit<SearchAgentsOptions, "query">): Promise<AgentResponse[]>;
|
|
1018
|
+
getMyAgents(): Promise<AgentResponse[]>;
|
|
1019
|
+
getReputation(sekuireId: string): Promise<ReputationResponse>;
|
|
1020
|
+
recordTaskCompletion(sekuireId: string, task: TaskCompletion, privateKeyHex: string): Promise<void>;
|
|
1021
|
+
getLeaderboard(limit?: number): Promise<LeaderboardEntry[]>;
|
|
1022
|
+
fileDispute(sekuireId: string, reason: string, evidenceLog: string, accuserId: string): Promise<DisputeResponse>;
|
|
1023
|
+
verifyAgentQuick(sekuireId: string): Promise<VerificationResult>;
|
|
1024
|
+
verifyAgentComprehensive(request: VerificationRequest): Promise<VerificationResult>;
|
|
1025
|
+
getVerificationHistory(sekuireId: string): Promise<VerificationResult[]>;
|
|
1026
|
+
getLatestVerification(sekuireId: string): Promise<VerificationResult | null>;
|
|
1027
|
+
generateTrustHeaders(request: TrustHeadersRequest): Promise<TrustHeaders>;
|
|
1028
|
+
getTrustProfile(agentDid: string): Promise<Record<string, unknown>>;
|
|
1029
|
+
getTransactionHistory(agentDid: string): Promise<unknown[]>;
|
|
1030
|
+
createTask(task: {
|
|
1031
|
+
description: string;
|
|
1032
|
+
capabilities: string[];
|
|
1033
|
+
priority?: number;
|
|
1034
|
+
callbackUrl?: string;
|
|
1035
|
+
}): Promise<{
|
|
1036
|
+
taskId: string;
|
|
1037
|
+
status: string;
|
|
1038
|
+
}>;
|
|
1039
|
+
getTask(taskId: string): Promise<{
|
|
1040
|
+
taskId: string;
|
|
1041
|
+
status: string;
|
|
1042
|
+
result?: unknown;
|
|
1043
|
+
error?: string;
|
|
1044
|
+
}>;
|
|
1045
|
+
completeTask(taskId: string, result: unknown, privateKeyHex: string): Promise<void>;
|
|
1046
|
+
getRegistryStats(): Promise<{
|
|
1047
|
+
totalAgents: number;
|
|
1048
|
+
verifiedAgents: number;
|
|
1049
|
+
totalTasks: number;
|
|
1050
|
+
categories: string[];
|
|
1051
|
+
}>;
|
|
1052
|
+
getCategories(): Promise<Array<{
|
|
1053
|
+
slug: string;
|
|
1054
|
+
name: string;
|
|
1055
|
+
agentCount: number;
|
|
1056
|
+
}>>;
|
|
1057
|
+
getAgentsByCategory(categorySlug: string): Promise<AgentResponse[]>;
|
|
1058
|
+
getWorkspace(workspaceId: string): Promise<Record<string, unknown>>;
|
|
1059
|
+
getWorkspacePolicies(workspaceId: string): Promise<unknown[]>;
|
|
1060
|
+
getActivePolicy(workspaceId: string): Promise<unknown>;
|
|
1061
|
+
getPolicyTemplates(): Promise<unknown[]>;
|
|
1062
|
+
evaluatePolicy(workspaceId: string, action: {
|
|
1063
|
+
type: string;
|
|
1064
|
+
resource: string;
|
|
1065
|
+
context?: Record<string, unknown>;
|
|
1066
|
+
}): Promise<{
|
|
1067
|
+
allowed: boolean;
|
|
1068
|
+
violations: string[];
|
|
1069
|
+
}>;
|
|
1070
|
+
logAgentEvents(sekuireId: string, events: Array<{
|
|
1071
|
+
type: string;
|
|
1072
|
+
severity: string;
|
|
1073
|
+
data: Record<string, unknown>;
|
|
1074
|
+
timestamp?: string;
|
|
1075
|
+
}>): Promise<void>;
|
|
1076
|
+
logAgentHealth(sekuireId: string, health: {
|
|
1077
|
+
status: "healthy" | "degraded" | "unhealthy";
|
|
1078
|
+
uptime: number;
|
|
1079
|
+
memoryMb?: number;
|
|
1080
|
+
cpuPercent?: number;
|
|
1081
|
+
}): Promise<void>;
|
|
1082
|
+
getAgentLogs(sekuireId: string, options?: {
|
|
1083
|
+
limit?: number;
|
|
1084
|
+
offset?: number;
|
|
1085
|
+
type?: string;
|
|
1086
|
+
}): Promise<unknown[]>;
|
|
1087
|
+
}
|
|
1088
|
+
declare function createRegistryClient(apiUrl: string, authToken?: string, apiKey?: string): SekuireRegistryClient;
|
|
1089
|
+
|
|
685
1090
|
interface SekuireConfig {
|
|
686
1091
|
project: {
|
|
687
1092
|
name: string;
|
|
@@ -755,7 +1160,7 @@ interface LLMConfig {
|
|
|
755
1160
|
base_url?: string;
|
|
756
1161
|
}
|
|
757
1162
|
interface MemoryConfig {
|
|
758
|
-
type: 'in-memory' | 'redis' | 'postgres';
|
|
1163
|
+
type: 'in-memory' | 'buffer' | 'redis' | 'postgres' | 'sqlite' | 'upstash' | 'cloudflare-kv' | 'cloudflare-d1' | 'dynamodb' | 'turso' | 'convex' | string;
|
|
759
1164
|
max_messages?: number;
|
|
760
1165
|
redis?: {
|
|
761
1166
|
url?: string;
|
|
@@ -774,6 +1179,43 @@ interface MemoryConfig {
|
|
|
774
1179
|
password?: string;
|
|
775
1180
|
tableName?: string;
|
|
776
1181
|
};
|
|
1182
|
+
sqlite?: {
|
|
1183
|
+
filename: string;
|
|
1184
|
+
tableName?: string;
|
|
1185
|
+
};
|
|
1186
|
+
upstash?: {
|
|
1187
|
+
url: string;
|
|
1188
|
+
token: string;
|
|
1189
|
+
keyPrefix?: string;
|
|
1190
|
+
};
|
|
1191
|
+
cloudflareKV?: {
|
|
1192
|
+
namespaceId?: string;
|
|
1193
|
+
accountId?: string;
|
|
1194
|
+
apiToken?: string;
|
|
1195
|
+
keyPrefix?: string;
|
|
1196
|
+
};
|
|
1197
|
+
cloudflareD1?: {
|
|
1198
|
+
databaseId?: string;
|
|
1199
|
+
accountId?: string;
|
|
1200
|
+
apiToken?: string;
|
|
1201
|
+
tableName?: string;
|
|
1202
|
+
};
|
|
1203
|
+
dynamodb?: {
|
|
1204
|
+
tableName: string;
|
|
1205
|
+
region?: string;
|
|
1206
|
+
endpoint?: string;
|
|
1207
|
+
createTable?: boolean;
|
|
1208
|
+
};
|
|
1209
|
+
turso?: {
|
|
1210
|
+
url: string;
|
|
1211
|
+
authToken?: string;
|
|
1212
|
+
tableName?: string;
|
|
1213
|
+
};
|
|
1214
|
+
convex?: {
|
|
1215
|
+
url: string;
|
|
1216
|
+
adminKey?: string;
|
|
1217
|
+
};
|
|
1218
|
+
config?: Record<string, unknown>;
|
|
777
1219
|
}
|
|
778
1220
|
interface ComplianceConfig {
|
|
779
1221
|
framework?: string;
|
|
@@ -788,9 +1230,9 @@ interface LoggerConfig {
|
|
|
788
1230
|
}
|
|
789
1231
|
interface ToolsSchema {
|
|
790
1232
|
version: string;
|
|
791
|
-
tools: ToolDefinition[];
|
|
1233
|
+
tools: ToolDefinition$1[];
|
|
792
1234
|
}
|
|
793
|
-
interface ToolDefinition {
|
|
1235
|
+
interface ToolDefinition$1 {
|
|
794
1236
|
name: string;
|
|
795
1237
|
description: string;
|
|
796
1238
|
category?: string;
|
|
@@ -821,9 +1263,6 @@ declare function loadTools(toolsPath: string, basePath?: string): Promise<ToolsS
|
|
|
821
1263
|
*/
|
|
822
1264
|
declare function getAgentConfig(config: SekuireConfig, agentName?: string): AgentConfig;
|
|
823
1265
|
|
|
824
|
-
/**
|
|
825
|
-
* Cryptographic utilities for Sekuire protocol
|
|
826
|
-
*/
|
|
827
1266
|
declare class SekuireCrypto {
|
|
828
1267
|
/**
|
|
829
1268
|
* Generate a new Ed25519 keypair
|
|
@@ -881,19 +1320,29 @@ declare class SekuireCrypto {
|
|
|
881
1320
|
static isValidNonce(hex: string): boolean;
|
|
882
1321
|
}
|
|
883
1322
|
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
1323
|
+
interface ToolDefinition {
|
|
1324
|
+
type: 'function';
|
|
1325
|
+
function: {
|
|
1326
|
+
name: string;
|
|
1327
|
+
description?: string;
|
|
1328
|
+
parameters?: Record<string, unknown>;
|
|
1329
|
+
};
|
|
1330
|
+
}
|
|
1331
|
+
interface ToolCallFunction {
|
|
1332
|
+
id: string;
|
|
1333
|
+
type: 'function';
|
|
1334
|
+
function: {
|
|
1335
|
+
name: string;
|
|
1336
|
+
arguments: string;
|
|
1337
|
+
};
|
|
1338
|
+
}
|
|
887
1339
|
interface Message {
|
|
888
1340
|
role: 'system' | 'user' | 'assistant' | 'function' | 'tool';
|
|
889
1341
|
content: string | null;
|
|
890
1342
|
name?: string;
|
|
891
1343
|
tool_call_id?: string;
|
|
892
|
-
tool_calls?:
|
|
1344
|
+
tool_calls?: ToolCallFunction[];
|
|
893
1345
|
}
|
|
894
|
-
/**
|
|
895
|
-
* Options for chat completion
|
|
896
|
-
*/
|
|
897
1346
|
interface ChatOptions {
|
|
898
1347
|
temperature?: number;
|
|
899
1348
|
max_tokens?: number;
|
|
@@ -902,16 +1351,13 @@ interface ChatOptions {
|
|
|
902
1351
|
presence_penalty?: number;
|
|
903
1352
|
stop?: string[];
|
|
904
1353
|
stream?: boolean;
|
|
905
|
-
tools?:
|
|
1354
|
+
tools?: ToolDefinition[];
|
|
906
1355
|
}
|
|
907
|
-
/**
|
|
908
|
-
* Response from chat completion
|
|
909
|
-
*/
|
|
910
1356
|
interface ChatResponse {
|
|
911
1357
|
content: string;
|
|
912
1358
|
model: string;
|
|
913
1359
|
finish_reason?: string;
|
|
914
|
-
tool_calls?:
|
|
1360
|
+
tool_calls?: ToolCallFunction[];
|
|
915
1361
|
usage?: {
|
|
916
1362
|
prompt_tokens: number;
|
|
917
1363
|
completion_tokens: number;
|
|
@@ -966,75 +1412,53 @@ interface LLMProviderConfig {
|
|
|
966
1412
|
maxTokens?: number;
|
|
967
1413
|
}
|
|
968
1414
|
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
1415
|
+
declare abstract class BaseLLMProvider implements LLMProvider {
|
|
1416
|
+
protected model: string;
|
|
1417
|
+
protected maxTokens: number;
|
|
1418
|
+
constructor(config: LLMProviderConfig);
|
|
1419
|
+
abstract chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
1420
|
+
abstract chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
1421
|
+
abstract getProviderName(): string;
|
|
1422
|
+
protected abstract getMaxTokensForModel(model: string): number;
|
|
1423
|
+
countTokens(text: string): number;
|
|
1424
|
+
getMaxTokens(): number;
|
|
1425
|
+
getModelName(): string;
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
declare class AnthropicProvider extends BaseLLMProvider {
|
|
974
1429
|
private client;
|
|
975
|
-
private model;
|
|
976
|
-
private maxTokens;
|
|
977
1430
|
constructor(config: LLMProviderConfig);
|
|
978
1431
|
chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
979
1432
|
chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
980
|
-
countTokens(text: string): number;
|
|
981
|
-
getMaxTokens(): number;
|
|
982
1433
|
getProviderName(): string;
|
|
983
|
-
|
|
984
|
-
private getMaxTokensForModel;
|
|
1434
|
+
protected getMaxTokensForModel(model: string): number;
|
|
985
1435
|
}
|
|
986
1436
|
|
|
987
|
-
|
|
988
|
-
* Google Gemini LLM Provider
|
|
989
|
-
* Supports Gemini Pro, Gemini Pro Vision, and other Google models
|
|
990
|
-
*/
|
|
991
|
-
declare class GoogleProvider implements LLMProvider {
|
|
1437
|
+
declare class GoogleProvider extends BaseLLMProvider {
|
|
992
1438
|
private client;
|
|
993
|
-
private model;
|
|
994
|
-
private maxTokens;
|
|
995
1439
|
constructor(config: LLMProviderConfig);
|
|
996
1440
|
chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
997
1441
|
chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
998
|
-
countTokens(text: string): number;
|
|
999
|
-
getMaxTokens(): number;
|
|
1000
1442
|
getProviderName(): string;
|
|
1001
|
-
|
|
1002
|
-
private getMaxTokensForModel;
|
|
1443
|
+
protected getMaxTokensForModel(model: string): number;
|
|
1003
1444
|
}
|
|
1004
1445
|
|
|
1005
|
-
|
|
1006
|
-
* Ollama LLM Provider
|
|
1007
|
-
* Supports local models via Ollama (Llama 2, Mistral, CodeLlama, etc.)
|
|
1008
|
-
*/
|
|
1009
|
-
declare class OllamaProvider implements LLMProvider {
|
|
1446
|
+
declare class OllamaProvider extends BaseLLMProvider {
|
|
1010
1447
|
private baseUrl;
|
|
1011
|
-
private model;
|
|
1012
|
-
private maxTokens;
|
|
1013
1448
|
constructor(config: LLMProviderConfig);
|
|
1014
1449
|
chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
1015
1450
|
chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
1016
|
-
countTokens(text: string): number;
|
|
1017
|
-
getMaxTokens(): number;
|
|
1018
1451
|
getProviderName(): string;
|
|
1019
|
-
|
|
1452
|
+
protected getMaxTokensForModel(_model: string): number;
|
|
1020
1453
|
}
|
|
1021
1454
|
|
|
1022
|
-
|
|
1023
|
-
* OpenAI LLM Provider
|
|
1024
|
-
* Supports GPT-3.5, GPT-4, and other OpenAI models
|
|
1025
|
-
*/
|
|
1026
|
-
declare class OpenAIProvider implements LLMProvider {
|
|
1455
|
+
declare class OpenAIProvider extends BaseLLMProvider {
|
|
1027
1456
|
private client;
|
|
1028
|
-
private model;
|
|
1029
|
-
private maxTokens;
|
|
1030
1457
|
constructor(config: LLMProviderConfig);
|
|
1031
1458
|
chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
1032
1459
|
chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
1033
|
-
countTokens(text: string): number;
|
|
1034
|
-
getMaxTokens(): number;
|
|
1035
1460
|
getProviderName(): string;
|
|
1036
|
-
|
|
1037
|
-
private getMaxTokensForModel;
|
|
1461
|
+
protected getMaxTokensForModel(model: string): number;
|
|
1038
1462
|
}
|
|
1039
1463
|
|
|
1040
1464
|
/**
|
|
@@ -1045,27 +1469,15 @@ declare function createLLMProvider(provider: string, config: LLMProviderConfig):
|
|
|
1045
1469
|
* Factory functions for easy LLM instantiation
|
|
1046
1470
|
*/
|
|
1047
1471
|
declare const llm: {
|
|
1048
|
-
/**
|
|
1049
|
-
* Create OpenAI provider (GPT-4, GPT-3.5, etc.)
|
|
1050
|
-
*/
|
|
1051
1472
|
openai: (config: Omit<LLMProviderConfig, "model"> & {
|
|
1052
1473
|
model?: string;
|
|
1053
1474
|
}) => OpenAIProvider;
|
|
1054
|
-
/**
|
|
1055
|
-
* Create Anthropic provider (Claude 3, Claude 3.5, etc.)
|
|
1056
|
-
*/
|
|
1057
1475
|
anthropic: (config: Omit<LLMProviderConfig, "model"> & {
|
|
1058
1476
|
model?: string;
|
|
1059
1477
|
}) => AnthropicProvider;
|
|
1060
|
-
/**
|
|
1061
|
-
* Create Google provider (Gemini Pro, Gemini 1.5, etc.)
|
|
1062
|
-
*/
|
|
1063
1478
|
google: (config: Omit<LLMProviderConfig, "model"> & {
|
|
1064
1479
|
model?: string;
|
|
1065
1480
|
}) => GoogleProvider;
|
|
1066
|
-
/**
|
|
1067
|
-
* Create Ollama provider (local models: Llama 2, Mistral, etc.)
|
|
1068
|
-
*/
|
|
1069
1481
|
ollama: (config: Omit<LLMProviderConfig, "model"> & {
|
|
1070
1482
|
model?: string;
|
|
1071
1483
|
}) => OllamaProvider;
|
|
@@ -1083,17 +1495,25 @@ interface MemoryStorage {
|
|
|
1083
1495
|
clear(sessionId: string): Promise<void>;
|
|
1084
1496
|
delete(sessionId: string): Promise<void>;
|
|
1085
1497
|
exists(sessionId: string): Promise<boolean>;
|
|
1498
|
+
connect?(): Promise<void>;
|
|
1499
|
+
disconnect?(): Promise<void>;
|
|
1500
|
+
isConnected?(): boolean;
|
|
1086
1501
|
}
|
|
1087
1502
|
declare abstract class BaseMemoryStorage implements MemoryStorage {
|
|
1503
|
+
protected _connected: boolean;
|
|
1088
1504
|
abstract add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
1089
1505
|
abstract get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
1090
1506
|
abstract clear(sessionId: string): Promise<void>;
|
|
1091
1507
|
abstract delete(sessionId: string): Promise<void>;
|
|
1092
1508
|
abstract exists(sessionId: string): Promise<boolean>;
|
|
1509
|
+
connect(): Promise<void>;
|
|
1510
|
+
disconnect(): Promise<void>;
|
|
1511
|
+
isConnected(): boolean;
|
|
1093
1512
|
}
|
|
1094
1513
|
|
|
1095
1514
|
declare class InMemoryStorage extends BaseMemoryStorage {
|
|
1096
1515
|
private storage;
|
|
1516
|
+
constructor();
|
|
1097
1517
|
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
1098
1518
|
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
1099
1519
|
clear(sessionId: string): Promise<void>;
|
|
@@ -1109,13 +1529,17 @@ interface PostgresConfig {
|
|
|
1109
1529
|
user?: string;
|
|
1110
1530
|
password?: string;
|
|
1111
1531
|
tableName?: string;
|
|
1532
|
+
lazyConnect?: boolean;
|
|
1112
1533
|
}
|
|
1113
1534
|
declare class PostgresStorage extends BaseMemoryStorage {
|
|
1114
1535
|
private pool;
|
|
1115
1536
|
private tableName;
|
|
1116
|
-
private
|
|
1537
|
+
private config;
|
|
1538
|
+
private connectionPromise;
|
|
1117
1539
|
constructor(config: PostgresConfig);
|
|
1540
|
+
connect(): Promise<void>;
|
|
1118
1541
|
private initPool;
|
|
1542
|
+
private ensureConnected;
|
|
1119
1543
|
private createTableIfNotExists;
|
|
1120
1544
|
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
1121
1545
|
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
@@ -1132,14 +1556,181 @@ interface RedisConfig {
|
|
|
1132
1556
|
db?: number;
|
|
1133
1557
|
url?: string;
|
|
1134
1558
|
keyPrefix?: string;
|
|
1559
|
+
lazyConnect?: boolean;
|
|
1135
1560
|
}
|
|
1136
1561
|
declare class RedisStorage extends BaseMemoryStorage {
|
|
1137
1562
|
private client;
|
|
1138
1563
|
private keyPrefix;
|
|
1139
|
-
private
|
|
1564
|
+
private config;
|
|
1565
|
+
private connectionPromise;
|
|
1140
1566
|
constructor(config: RedisConfig);
|
|
1567
|
+
connect(): Promise<void>;
|
|
1141
1568
|
private initClient;
|
|
1569
|
+
private ensureConnected;
|
|
1570
|
+
private getKey;
|
|
1571
|
+
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
1572
|
+
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
1573
|
+
clear(sessionId: string): Promise<void>;
|
|
1574
|
+
delete(sessionId: string): Promise<void>;
|
|
1575
|
+
exists(sessionId: string): Promise<boolean>;
|
|
1576
|
+
disconnect(): Promise<void>;
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
interface SQLiteConfig {
|
|
1580
|
+
filename: string;
|
|
1581
|
+
tableName?: string;
|
|
1582
|
+
readonly?: boolean;
|
|
1583
|
+
}
|
|
1584
|
+
declare class SQLiteStorage extends BaseMemoryStorage {
|
|
1585
|
+
private db;
|
|
1586
|
+
private config;
|
|
1587
|
+
private tableName;
|
|
1588
|
+
private connectionPromise;
|
|
1589
|
+
constructor(config: SQLiteConfig);
|
|
1590
|
+
connect(): Promise<void>;
|
|
1591
|
+
private ensureTableExists;
|
|
1592
|
+
private ensureConnected;
|
|
1593
|
+
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
1594
|
+
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
1595
|
+
clear(sessionId: string): Promise<void>;
|
|
1596
|
+
delete(sessionId: string): Promise<void>;
|
|
1597
|
+
exists(sessionId: string): Promise<boolean>;
|
|
1598
|
+
disconnect(): Promise<void>;
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
interface UpstashConfig {
|
|
1602
|
+
url: string;
|
|
1603
|
+
token: string;
|
|
1604
|
+
keyPrefix?: string;
|
|
1605
|
+
}
|
|
1606
|
+
declare class UpstashStorage extends BaseMemoryStorage {
|
|
1607
|
+
private client;
|
|
1608
|
+
private keyPrefix;
|
|
1609
|
+
private config;
|
|
1610
|
+
private connectionPromise;
|
|
1611
|
+
constructor(config: UpstashConfig);
|
|
1612
|
+
connect(): Promise<void>;
|
|
1613
|
+
private ensureConnected;
|
|
1614
|
+
private getKey;
|
|
1615
|
+
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
1616
|
+
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
1617
|
+
clear(sessionId: string): Promise<void>;
|
|
1618
|
+
delete(sessionId: string): Promise<void>;
|
|
1619
|
+
exists(sessionId: string): Promise<boolean>;
|
|
1620
|
+
disconnect(): Promise<void>;
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
interface CloudflareKVConfig {
|
|
1624
|
+
binding?: any;
|
|
1625
|
+
accountId?: string;
|
|
1626
|
+
namespaceId?: string;
|
|
1627
|
+
apiToken?: string;
|
|
1628
|
+
keyPrefix?: string;
|
|
1629
|
+
}
|
|
1630
|
+
declare class CloudflareKVStorage extends BaseMemoryStorage {
|
|
1631
|
+
private binding;
|
|
1632
|
+
private config;
|
|
1633
|
+
private keyPrefix;
|
|
1634
|
+
private useRestApi;
|
|
1635
|
+
constructor(config: CloudflareKVConfig);
|
|
1142
1636
|
private getKey;
|
|
1637
|
+
private kvGet;
|
|
1638
|
+
private kvPut;
|
|
1639
|
+
private kvDelete;
|
|
1640
|
+
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
1641
|
+
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
1642
|
+
clear(sessionId: string): Promise<void>;
|
|
1643
|
+
delete(sessionId: string): Promise<void>;
|
|
1644
|
+
exists(sessionId: string): Promise<boolean>;
|
|
1645
|
+
disconnect(): Promise<void>;
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
interface CloudflareD1Config {
|
|
1649
|
+
binding?: any;
|
|
1650
|
+
accountId?: string;
|
|
1651
|
+
databaseId?: string;
|
|
1652
|
+
apiToken?: string;
|
|
1653
|
+
tableName?: string;
|
|
1654
|
+
}
|
|
1655
|
+
declare class CloudflareD1Storage extends BaseMemoryStorage {
|
|
1656
|
+
private binding;
|
|
1657
|
+
private config;
|
|
1658
|
+
private tableName;
|
|
1659
|
+
private useRestApi;
|
|
1660
|
+
private tableInitialized;
|
|
1661
|
+
constructor(config: CloudflareD1Config);
|
|
1662
|
+
private executeQuery;
|
|
1663
|
+
private ensureTableExists;
|
|
1664
|
+
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
1665
|
+
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
1666
|
+
clear(sessionId: string): Promise<void>;
|
|
1667
|
+
delete(sessionId: string): Promise<void>;
|
|
1668
|
+
exists(sessionId: string): Promise<boolean>;
|
|
1669
|
+
disconnect(): Promise<void>;
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
interface DynamoDBConfig {
|
|
1673
|
+
tableName: string;
|
|
1674
|
+
region?: string;
|
|
1675
|
+
endpoint?: string;
|
|
1676
|
+
credentials?: {
|
|
1677
|
+
accessKeyId: string;
|
|
1678
|
+
secretAccessKey: string;
|
|
1679
|
+
};
|
|
1680
|
+
createTable?: boolean;
|
|
1681
|
+
}
|
|
1682
|
+
declare class DynamoDBStorage extends BaseMemoryStorage {
|
|
1683
|
+
private client;
|
|
1684
|
+
private docClient;
|
|
1685
|
+
private config;
|
|
1686
|
+
private connectionPromise;
|
|
1687
|
+
private tableReady;
|
|
1688
|
+
constructor(config: DynamoDBConfig);
|
|
1689
|
+
connect(): Promise<void>;
|
|
1690
|
+
private ensureTableExists;
|
|
1691
|
+
private ensureConnected;
|
|
1692
|
+
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
1693
|
+
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
1694
|
+
clear(sessionId: string): Promise<void>;
|
|
1695
|
+
delete(sessionId: string): Promise<void>;
|
|
1696
|
+
exists(sessionId: string): Promise<boolean>;
|
|
1697
|
+
disconnect(): Promise<void>;
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
interface TursoConfig {
|
|
1701
|
+
url: string;
|
|
1702
|
+
authToken?: string;
|
|
1703
|
+
tableName?: string;
|
|
1704
|
+
}
|
|
1705
|
+
declare class TursoStorage extends BaseMemoryStorage {
|
|
1706
|
+
private client;
|
|
1707
|
+
private config;
|
|
1708
|
+
private tableName;
|
|
1709
|
+
private connectionPromise;
|
|
1710
|
+
private tableInitialized;
|
|
1711
|
+
constructor(config: TursoConfig);
|
|
1712
|
+
connect(): Promise<void>;
|
|
1713
|
+
private ensureTableExists;
|
|
1714
|
+
private ensureConnected;
|
|
1715
|
+
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
1716
|
+
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
1717
|
+
clear(sessionId: string): Promise<void>;
|
|
1718
|
+
delete(sessionId: string): Promise<void>;
|
|
1719
|
+
exists(sessionId: string): Promise<boolean>;
|
|
1720
|
+
disconnect(): Promise<void>;
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
interface ConvexConfig {
|
|
1724
|
+
url: string;
|
|
1725
|
+
adminKey?: string;
|
|
1726
|
+
}
|
|
1727
|
+
declare class ConvexStorage extends BaseMemoryStorage {
|
|
1728
|
+
private client;
|
|
1729
|
+
private config;
|
|
1730
|
+
private connectionPromise;
|
|
1731
|
+
constructor(config: ConvexConfig);
|
|
1732
|
+
connect(): Promise<void>;
|
|
1733
|
+
private ensureConnected;
|
|
1143
1734
|
add(sessionId: string, message: MemoryMessage): Promise<void>;
|
|
1144
1735
|
get(sessionId: string, limit?: number): Promise<MemoryMessage[]>;
|
|
1145
1736
|
clear(sessionId: string): Promise<void>;
|
|
@@ -1147,12 +1738,33 @@ declare class RedisStorage extends BaseMemoryStorage {
|
|
|
1147
1738
|
exists(sessionId: string): Promise<boolean>;
|
|
1148
1739
|
disconnect(): Promise<void>;
|
|
1149
1740
|
}
|
|
1741
|
+
declare const CONVEX_SCHEMA_TEMPLATE = "\n// convex/schema.ts\nimport { defineSchema, defineTable } from \"convex/server\";\nimport { v } from \"convex/values\";\n\nexport default defineSchema({\n sekuireMemory: defineTable({\n sessionId: v.string(),\n role: v.union(v.literal(\"user\"), v.literal(\"assistant\"), v.literal(\"system\")),\n content: v.string(),\n timestamp: v.number(),\n metadata: v.optional(v.any()),\n }).index(\"by_session\", [\"sessionId\", \"timestamp\"]),\n});\n";
|
|
1742
|
+
declare const CONVEX_FUNCTIONS_TEMPLATE = "\n// convex/sekuireMemory.ts\nimport { mutation, query } from \"./_generated/server\";\nimport { v } from \"convex/values\";\n\nexport const add = mutation({\n args: {\n sessionId: v.string(),\n role: v.union(v.literal(\"user\"), v.literal(\"assistant\"), v.literal(\"system\")),\n content: v.string(),\n timestamp: v.number(),\n metadata: v.optional(v.any()),\n },\n handler: async (ctx, args) => {\n await ctx.db.insert(\"sekuireMemory\", args);\n },\n});\n\nexport const get = query({\n args: {\n sessionId: v.string(),\n limit: v.optional(v.number()),\n },\n handler: async (ctx, args) => {\n let query = ctx.db\n .query(\"sekuireMemory\")\n .withIndex(\"by_session\", (q) => q.eq(\"sessionId\", args.sessionId))\n .order(\"asc\");\n\n const messages = await query.collect();\n\n if (args.limit) {\n return messages.slice(-args.limit);\n }\n return messages;\n },\n});\n\nexport const clear = mutation({\n args: {\n sessionId: v.string(),\n },\n handler: async (ctx, args) => {\n const messages = await ctx.db\n .query(\"sekuireMemory\")\n .withIndex(\"by_session\", (q) => q.eq(\"sessionId\", args.sessionId))\n .collect();\n\n for (const message of messages) {\n await ctx.db.delete(message._id);\n }\n },\n});\n\nexport const exists = query({\n args: {\n sessionId: v.string(),\n },\n handler: async (ctx, args) => {\n const message = await ctx.db\n .query(\"sekuireMemory\")\n .withIndex(\"by_session\", (q) => q.eq(\"sessionId\", args.sessionId))\n .first();\n return message !== null;\n },\n});\n";
|
|
1743
|
+
|
|
1744
|
+
type StorageFactory = (config: any) => MemoryStorage;
|
|
1745
|
+
declare function registerStorage(type: string, factory: StorageFactory, description?: string): void;
|
|
1746
|
+
declare function hasStorage(type: string): boolean;
|
|
1747
|
+
declare function listStorageTypes(): string[];
|
|
1748
|
+
declare function getStorageInfo(): Array<{
|
|
1749
|
+
type: string;
|
|
1750
|
+
description?: string;
|
|
1751
|
+
}>;
|
|
1150
1752
|
|
|
1151
|
-
type
|
|
1753
|
+
type BuiltInMemoryType = 'in-memory' | 'buffer' | 'redis' | 'postgres' | 'sqlite' | 'upstash' | 'cloudflare-kv' | 'cloudflare-d1' | 'dynamodb' | 'turso' | 'convex';
|
|
1754
|
+
type MemoryType = BuiltInMemoryType | string;
|
|
1152
1755
|
interface MemoryFactoryConfig {
|
|
1153
1756
|
type: MemoryType;
|
|
1154
1757
|
redis?: RedisConfig;
|
|
1155
1758
|
postgres?: PostgresConfig;
|
|
1759
|
+
sqlite?: SQLiteConfig;
|
|
1760
|
+
upstash?: UpstashConfig;
|
|
1761
|
+
cloudflareKV?: CloudflareKVConfig;
|
|
1762
|
+
cloudflareD1?: CloudflareD1Config;
|
|
1763
|
+
dynamodb?: DynamoDBConfig;
|
|
1764
|
+
turso?: TursoConfig;
|
|
1765
|
+
convex?: ConvexConfig;
|
|
1766
|
+
options?: Record<string, unknown>;
|
|
1767
|
+
instance?: MemoryStorage;
|
|
1156
1768
|
}
|
|
1157
1769
|
declare function createMemoryStorage(config: MemoryFactoryConfig): MemoryStorage;
|
|
1158
1770
|
|
|
@@ -1201,7 +1813,7 @@ declare class PolicyEnforcer {
|
|
|
1201
1813
|
*/
|
|
1202
1814
|
interface AgentOptions {
|
|
1203
1815
|
llm?: LLMProvider;
|
|
1204
|
-
tools?: ToolDefinition[];
|
|
1816
|
+
tools?: ToolDefinition$1[];
|
|
1205
1817
|
memory?: MemoryStorage;
|
|
1206
1818
|
systemPrompt?: string;
|
|
1207
1819
|
policyPath?: string;
|
|
@@ -1222,7 +1834,7 @@ declare class SekuireAgent {
|
|
|
1222
1834
|
name: string;
|
|
1223
1835
|
llm: LLMProvider;
|
|
1224
1836
|
systemPrompt: string;
|
|
1225
|
-
tools: ToolDefinition[];
|
|
1837
|
+
tools: ToolDefinition$1[];
|
|
1226
1838
|
memory?: MemoryStorage;
|
|
1227
1839
|
maxHistoryMessages?: number;
|
|
1228
1840
|
policyEnforcer?: PolicyEnforcer;
|
|
@@ -1259,7 +1871,7 @@ declare class SekuireAgent {
|
|
|
1259
1871
|
/**
|
|
1260
1872
|
* Get available tools
|
|
1261
1873
|
*/
|
|
1262
|
-
getTools(): ToolDefinition[];
|
|
1874
|
+
getTools(): ToolDefinition$1[];
|
|
1263
1875
|
/**
|
|
1264
1876
|
* Get the active policy enforcer
|
|
1265
1877
|
*/
|
|
@@ -1325,7 +1937,7 @@ declare function getSystemPrompt(agentName?: string, configPath?: string): Promi
|
|
|
1325
1937
|
* console.log(toolsSchema.tools);
|
|
1326
1938
|
* ```
|
|
1327
1939
|
*/
|
|
1328
|
-
declare function getTools(agentName?: string, configPath?: string): Promise<ToolDefinition[]>;
|
|
1940
|
+
declare function getTools(agentName?: string, configPath?: string): Promise<ToolDefinition$1[]>;
|
|
1329
1941
|
|
|
1330
1942
|
/**
|
|
1331
1943
|
* Base class for implementing Sekuire protocol servers
|
|
@@ -1430,90 +2042,38 @@ declare class AgentStatusTool extends Tool {
|
|
|
1430
2042
|
* Tool for invoking other Sekuire agents
|
|
1431
2043
|
* Performs handshake and sends requests to verified agents
|
|
1432
2044
|
*/
|
|
1433
|
-
declare class InvokeAgentTool
|
|
2045
|
+
declare class InvokeAgentTool extends Tool {
|
|
2046
|
+
metadata: ToolMetadata;
|
|
2047
|
+
private client;
|
|
1434
2048
|
private readonly privateKey?;
|
|
1435
2049
|
private readonly publicKey?;
|
|
1436
2050
|
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>;
|
|
2051
|
+
constructor(privateKey?: string, publicKey?: string, registryUrl?: string);
|
|
2052
|
+
execute(input: ToolInput): Promise<string>;
|
|
1465
2053
|
}
|
|
1466
2054
|
/**
|
|
1467
2055
|
* Tool for searching the Sekuire registry for agents
|
|
1468
2056
|
*/
|
|
1469
|
-
declare class SearchAgentsTool
|
|
2057
|
+
declare class SearchAgentsTool extends Tool {
|
|
2058
|
+
metadata: ToolMetadata;
|
|
2059
|
+
private client;
|
|
1470
2060
|
private readonly privateKey?;
|
|
1471
2061
|
private readonly publicKey?;
|
|
1472
2062
|
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>;
|
|
2063
|
+
constructor(privateKey?: string, publicKey?: string, registryUrl?: string);
|
|
2064
|
+
execute(input: ToolInput): Promise<string>;
|
|
1493
2065
|
}
|
|
1494
2066
|
/**
|
|
1495
2067
|
* Tool for getting detailed information about a specific agent
|
|
1496
2068
|
*/
|
|
1497
|
-
declare class GetAgentInfoTool
|
|
2069
|
+
declare class GetAgentInfoTool extends Tool {
|
|
2070
|
+
metadata: ToolMetadata;
|
|
2071
|
+
private client;
|
|
1498
2072
|
private readonly privateKey?;
|
|
1499
2073
|
private readonly publicKey?;
|
|
1500
2074
|
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>;
|
|
2075
|
+
constructor(privateKey?: string, publicKey?: string, registryUrl?: string);
|
|
2076
|
+
execute(input: ToolInput): Promise<string>;
|
|
1517
2077
|
}
|
|
1518
2078
|
|
|
1519
2079
|
declare class CalculatorTool extends Tool {
|
|
@@ -1980,11 +2540,11 @@ declare const builtInTools: {
|
|
|
1980
2540
|
/**
|
|
1981
2541
|
* Create a tool for discovering other agents in the Sekuire network
|
|
1982
2542
|
*/
|
|
1983
|
-
declare function createDiscoveryTool(client: SekuireClient): ToolDefinition$
|
|
2543
|
+
declare function createDiscoveryTool(client: SekuireClient): ToolDefinition$2;
|
|
1984
2544
|
/**
|
|
1985
2545
|
* Create a tool for delegating tasks to other agents
|
|
1986
2546
|
*/
|
|
1987
|
-
declare function createDelegationTool(client: SekuireClient): ToolDefinition$
|
|
2547
|
+
declare function createDelegationTool(client: SekuireClient): ToolDefinition$2;
|
|
1988
2548
|
|
|
1989
2549
|
/**
|
|
1990
2550
|
* Generate a new Ed25519 keypair for Sekuire operations
|
|
@@ -2005,5 +2565,585 @@ declare function calculateSekuireId(params: {
|
|
|
2005
2565
|
*/
|
|
2006
2566
|
declare function createSekuireClient(keyPair: KeyPair, registryUrl?: string, options?: Partial<SekuireClientConfig>): SekuireClient;
|
|
2007
2567
|
|
|
2008
|
-
|
|
2009
|
-
|
|
2568
|
+
/**
|
|
2569
|
+
* Sekuire Task Worker
|
|
2570
|
+
*
|
|
2571
|
+
* Handles SSE connection to Core for real-time task delivery.
|
|
2572
|
+
* Provides `onTask()` API for agents to register task handlers.
|
|
2573
|
+
*/
|
|
2574
|
+
interface TaskEvent {
|
|
2575
|
+
task_id: string;
|
|
2576
|
+
capability?: string;
|
|
2577
|
+
tool?: string;
|
|
2578
|
+
input: Record<string, unknown>;
|
|
2579
|
+
workspace_id: string;
|
|
2580
|
+
requester_agent_id?: string;
|
|
2581
|
+
parent_task_id?: string;
|
|
2582
|
+
trace_id?: string;
|
|
2583
|
+
workflow_id?: string;
|
|
2584
|
+
}
|
|
2585
|
+
interface TaskContext {
|
|
2586
|
+
taskId: string;
|
|
2587
|
+
workspaceId: string;
|
|
2588
|
+
requesterId?: string;
|
|
2589
|
+
parentTaskId?: string;
|
|
2590
|
+
traceId?: string;
|
|
2591
|
+
workflowId?: string;
|
|
2592
|
+
}
|
|
2593
|
+
type TaskHandler = (ctx: TaskContext, input: Record<string, unknown>) => Promise<unknown>;
|
|
2594
|
+
interface WorkerConfig {
|
|
2595
|
+
apiBaseUrl: string;
|
|
2596
|
+
token: string;
|
|
2597
|
+
agentId?: string;
|
|
2598
|
+
apiKey?: string;
|
|
2599
|
+
heartbeatIntervalMs?: number;
|
|
2600
|
+
reconnectDelayMs?: number;
|
|
2601
|
+
maxReconnectDelayMs?: number;
|
|
2602
|
+
deploymentUrl?: string;
|
|
2603
|
+
}
|
|
2604
|
+
declare class TaskWorker {
|
|
2605
|
+
private eventSource;
|
|
2606
|
+
private handlers;
|
|
2607
|
+
private config;
|
|
2608
|
+
private heartbeatInterval;
|
|
2609
|
+
private reconnectDelay;
|
|
2610
|
+
private isConnected;
|
|
2611
|
+
private isPaused;
|
|
2612
|
+
private installationId;
|
|
2613
|
+
private onCommandCallback?;
|
|
2614
|
+
constructor(config: WorkerConfig);
|
|
2615
|
+
/**
|
|
2616
|
+
* Register a handler for a specific capability
|
|
2617
|
+
*/
|
|
2618
|
+
onTask(capability: string, handler: TaskHandler): this;
|
|
2619
|
+
/**
|
|
2620
|
+
* Start the worker (connects to SSE stream and starts heartbeat)
|
|
2621
|
+
*/
|
|
2622
|
+
start(): Promise<void>;
|
|
2623
|
+
/**
|
|
2624
|
+
* Stop the worker gracefully
|
|
2625
|
+
*/
|
|
2626
|
+
stop(): Promise<void>;
|
|
2627
|
+
/**
|
|
2628
|
+
* Check if the worker is currently paused
|
|
2629
|
+
*/
|
|
2630
|
+
getIsPaused(): boolean;
|
|
2631
|
+
/**
|
|
2632
|
+
* Register a callback for control commands
|
|
2633
|
+
*/
|
|
2634
|
+
onCommand(callback: (cmd: {
|
|
2635
|
+
type: string;
|
|
2636
|
+
reason?: string;
|
|
2637
|
+
}) => void): this;
|
|
2638
|
+
/**
|
|
2639
|
+
* Handle control commands from SSE or heartbeat fallback
|
|
2640
|
+
*/
|
|
2641
|
+
private handleCommand;
|
|
2642
|
+
/**
|
|
2643
|
+
* Get API key from config or environment
|
|
2644
|
+
*/
|
|
2645
|
+
private getApiKey;
|
|
2646
|
+
/**
|
|
2647
|
+
* Connect to SSE stream
|
|
2648
|
+
*/
|
|
2649
|
+
private connect;
|
|
2650
|
+
/**
|
|
2651
|
+
* Schedule reconnection with exponential backoff
|
|
2652
|
+
*/
|
|
2653
|
+
private scheduleReconnect;
|
|
2654
|
+
/**
|
|
2655
|
+
* Handle incoming task
|
|
2656
|
+
*/
|
|
2657
|
+
private handleTask;
|
|
2658
|
+
/**
|
|
2659
|
+
* Report task completion to Core
|
|
2660
|
+
*/
|
|
2661
|
+
private completeTask;
|
|
2662
|
+
/**
|
|
2663
|
+
* Register this agent installation with Sekuire
|
|
2664
|
+
*/
|
|
2665
|
+
private bootstrap;
|
|
2666
|
+
/**
|
|
2667
|
+
* Start heartbeat loop
|
|
2668
|
+
*/
|
|
2669
|
+
private startHeartbeat;
|
|
2670
|
+
}
|
|
2671
|
+
declare function createWorker(config: WorkerConfig): TaskWorker;
|
|
2672
|
+
|
|
2673
|
+
interface SekuireExporterConfig {
|
|
2674
|
+
apiUrl: string;
|
|
2675
|
+
agentId: string;
|
|
2676
|
+
authToken?: string;
|
|
2677
|
+
workspaceId?: string;
|
|
2678
|
+
}
|
|
2679
|
+
declare class SekuireSpanExporter implements SpanExporter {
|
|
2680
|
+
private config;
|
|
2681
|
+
private pendingExport;
|
|
2682
|
+
constructor(config: SekuireExporterConfig);
|
|
2683
|
+
export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
|
|
2684
|
+
private spanToEvent;
|
|
2685
|
+
private mapSpanToEventType;
|
|
2686
|
+
private getDurationMs;
|
|
2687
|
+
private extractAttributes;
|
|
2688
|
+
private sendEvents;
|
|
2689
|
+
shutdown(): Promise<void>;
|
|
2690
|
+
forceFlush(): Promise<void>;
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
type ExporterType = 'otlp' | 'sekuire' | 'console' | 'none';
|
|
2694
|
+
interface TelemetryConfig {
|
|
2695
|
+
enabled?: boolean;
|
|
2696
|
+
agentId: string;
|
|
2697
|
+
exporter?: ExporterType;
|
|
2698
|
+
otlpEndpoint?: string;
|
|
2699
|
+
sekuireApiUrl?: string;
|
|
2700
|
+
authToken?: string;
|
|
2701
|
+
workspaceId?: string;
|
|
2702
|
+
debug?: boolean;
|
|
2703
|
+
batchConfig?: {
|
|
2704
|
+
maxQueueSize?: number;
|
|
2705
|
+
maxExportBatchSize?: number;
|
|
2706
|
+
scheduledDelayMillis?: number;
|
|
2707
|
+
};
|
|
2708
|
+
}
|
|
2709
|
+
declare function initTelemetry(config: TelemetryConfig): Tracer;
|
|
2710
|
+
declare function getTracer(): Tracer;
|
|
2711
|
+
declare function shutdownTelemetry(): Promise<void>;
|
|
2712
|
+
|
|
2713
|
+
declare function detectDeploymentUrl(): string | undefined;
|
|
2714
|
+
|
|
2715
|
+
/**
|
|
2716
|
+
* A2A Protocol Type Definitions
|
|
2717
|
+
*
|
|
2718
|
+
* Types implementing the A2A Protocol specification for agent interoperability.
|
|
2719
|
+
* See: https://github.com/a2aproject/A2A
|
|
2720
|
+
*/
|
|
2721
|
+
/** Full A2A-compliant Agent Card */
|
|
2722
|
+
interface AgentCard {
|
|
2723
|
+
/** Unique agent identifier (e.g., "sekuire:workspace:agent-name") */
|
|
2724
|
+
agentId: string;
|
|
2725
|
+
/** Human-readable agent name */
|
|
2726
|
+
name: string;
|
|
2727
|
+
/** Agent description */
|
|
2728
|
+
description: string;
|
|
2729
|
+
/** Semantic version */
|
|
2730
|
+
version: string;
|
|
2731
|
+
/** Provider information */
|
|
2732
|
+
provider?: AgentProvider;
|
|
2733
|
+
/** Supported A2A protocol versions */
|
|
2734
|
+
protocolVersions: string[];
|
|
2735
|
+
/** Agent capabilities */
|
|
2736
|
+
capabilities: AgentCapabilities;
|
|
2737
|
+
/** Skills the agent provides */
|
|
2738
|
+
skills: AgentSkill[];
|
|
2739
|
+
/** Default input MIME types accepted */
|
|
2740
|
+
defaultInputModes?: string[];
|
|
2741
|
+
/** Default output MIME types produced */
|
|
2742
|
+
defaultOutputModes?: string[];
|
|
2743
|
+
/** Security schemes supported */
|
|
2744
|
+
securitySchemes?: Record<string, SecurityScheme>;
|
|
2745
|
+
/** Required security scheme names */
|
|
2746
|
+
security?: string[];
|
|
2747
|
+
/** Base URL for A2A endpoints */
|
|
2748
|
+
url: string;
|
|
2749
|
+
}
|
|
2750
|
+
/** Provider information */
|
|
2751
|
+
interface AgentProvider {
|
|
2752
|
+
name: string;
|
|
2753
|
+
url?: string;
|
|
2754
|
+
}
|
|
2755
|
+
/** Agent capabilities */
|
|
2756
|
+
interface AgentCapabilities {
|
|
2757
|
+
/** Supports streaming responses via SSE */
|
|
2758
|
+
streaming: boolean;
|
|
2759
|
+
/** Supports push notifications */
|
|
2760
|
+
pushNotifications: boolean;
|
|
2761
|
+
/** Supports extended agent card endpoint */
|
|
2762
|
+
extendedAgentCard: boolean;
|
|
2763
|
+
}
|
|
2764
|
+
/** Security scheme definition */
|
|
2765
|
+
interface SecurityScheme {
|
|
2766
|
+
type: string;
|
|
2767
|
+
scheme?: string;
|
|
2768
|
+
bearerFormat?: string;
|
|
2769
|
+
}
|
|
2770
|
+
/** Structured skill definition */
|
|
2771
|
+
interface AgentSkill {
|
|
2772
|
+
/** Skill identifier (e.g., "document:summarize") */
|
|
2773
|
+
id: string;
|
|
2774
|
+
/** Human-readable skill name */
|
|
2775
|
+
name: string;
|
|
2776
|
+
/** Skill description */
|
|
2777
|
+
description?: string;
|
|
2778
|
+
/** Tags for categorization */
|
|
2779
|
+
tags?: string[];
|
|
2780
|
+
/** Input MIME types accepted */
|
|
2781
|
+
inputModes?: string[];
|
|
2782
|
+
/** Output MIME types produced */
|
|
2783
|
+
outputModes?: string[];
|
|
2784
|
+
/** Example prompts */
|
|
2785
|
+
examples?: string[];
|
|
2786
|
+
}
|
|
2787
|
+
/** A2A message with role and parts */
|
|
2788
|
+
interface A2AMessage {
|
|
2789
|
+
/** Message role: "user" or "agent" */
|
|
2790
|
+
role: "user" | "agent";
|
|
2791
|
+
/** Message content parts */
|
|
2792
|
+
parts: A2AMessagePart[];
|
|
2793
|
+
}
|
|
2794
|
+
/** Message part content */
|
|
2795
|
+
type A2AMessagePart = {
|
|
2796
|
+
type: "text";
|
|
2797
|
+
text: string;
|
|
2798
|
+
} | {
|
|
2799
|
+
type: "file";
|
|
2800
|
+
uri: string;
|
|
2801
|
+
mimeType?: string;
|
|
2802
|
+
} | {
|
|
2803
|
+
type: "data";
|
|
2804
|
+
data: unknown;
|
|
2805
|
+
};
|
|
2806
|
+
/** A2A task states */
|
|
2807
|
+
type A2ATaskState = "pending" | "working" | "input-required" | "completed" | "failed" | "cancelled";
|
|
2808
|
+
/** A2A task status with timestamp */
|
|
2809
|
+
interface A2ATaskStatus {
|
|
2810
|
+
state: A2ATaskState;
|
|
2811
|
+
timestamp: string;
|
|
2812
|
+
}
|
|
2813
|
+
/** Full A2A task */
|
|
2814
|
+
interface A2ATask {
|
|
2815
|
+
taskId: string;
|
|
2816
|
+
contextId?: string;
|
|
2817
|
+
status: A2ATaskStatus;
|
|
2818
|
+
artifacts: A2AArtifact[];
|
|
2819
|
+
history: A2AMessage[];
|
|
2820
|
+
/** ID of the task that delegated to this task */
|
|
2821
|
+
parentTaskId?: string;
|
|
2822
|
+
/** Trace ID shared across the delegation chain */
|
|
2823
|
+
traceId?: string;
|
|
2824
|
+
}
|
|
2825
|
+
/** Task artifact output */
|
|
2826
|
+
interface A2AArtifact {
|
|
2827
|
+
name?: string;
|
|
2828
|
+
parts: A2AMessagePart[];
|
|
2829
|
+
index?: number;
|
|
2830
|
+
}
|
|
2831
|
+
/** Request for skill-based auto-discovery routing */
|
|
2832
|
+
interface A2ARouteRequest {
|
|
2833
|
+
/** Required skill (e.g., "document:summarize") */
|
|
2834
|
+
skill: string;
|
|
2835
|
+
/** Message to send to the agent */
|
|
2836
|
+
message: A2AMessage;
|
|
2837
|
+
/** Optional conversation context ID */
|
|
2838
|
+
contextId?: string;
|
|
2839
|
+
/** Parent task ID for delegation tracking */
|
|
2840
|
+
parentTaskId?: string;
|
|
2841
|
+
/** Trace ID for the entire delegation chain */
|
|
2842
|
+
traceId?: string;
|
|
2843
|
+
}
|
|
2844
|
+
/** Response from skill-based routing */
|
|
2845
|
+
interface A2ARouteResponse {
|
|
2846
|
+
/** Created task ID */
|
|
2847
|
+
taskId: string;
|
|
2848
|
+
/** Current task status */
|
|
2849
|
+
status: A2ATaskState;
|
|
2850
|
+
/** ID of the selected agent */
|
|
2851
|
+
agentId: string;
|
|
2852
|
+
/** Initial response message (if any) */
|
|
2853
|
+
message?: A2AMessage;
|
|
2854
|
+
/** Trace ID for the delegation chain */
|
|
2855
|
+
traceId?: string;
|
|
2856
|
+
}
|
|
2857
|
+
/** JSON-RPC 2.0 Request */
|
|
2858
|
+
interface JsonRpcRequest {
|
|
2859
|
+
jsonrpc: "2.0";
|
|
2860
|
+
method: string;
|
|
2861
|
+
id: string | number;
|
|
2862
|
+
params?: unknown;
|
|
2863
|
+
}
|
|
2864
|
+
/** JSON-RPC 2.0 Response */
|
|
2865
|
+
interface JsonRpcResponse<T = unknown> {
|
|
2866
|
+
jsonrpc: "2.0";
|
|
2867
|
+
id: string | number;
|
|
2868
|
+
result?: T;
|
|
2869
|
+
error?: JsonRpcError;
|
|
2870
|
+
}
|
|
2871
|
+
/** JSON-RPC 2.0 Error */
|
|
2872
|
+
interface JsonRpcError {
|
|
2873
|
+
code: number;
|
|
2874
|
+
message: string;
|
|
2875
|
+
data?: unknown;
|
|
2876
|
+
}
|
|
2877
|
+
/** Parameters for tasks/send method */
|
|
2878
|
+
interface TasksSendParams {
|
|
2879
|
+
/** Optional existing task ID to continue */
|
|
2880
|
+
taskId?: string;
|
|
2881
|
+
/** Message to send */
|
|
2882
|
+
message: A2AMessage;
|
|
2883
|
+
/** Optional context ID for grouping tasks */
|
|
2884
|
+
contextId?: string;
|
|
2885
|
+
}
|
|
2886
|
+
/** Parameters for tasks/get method */
|
|
2887
|
+
interface TasksGetParams {
|
|
2888
|
+
taskId: string;
|
|
2889
|
+
}
|
|
2890
|
+
/** Parameters for tasks/cancel method */
|
|
2891
|
+
interface TasksCancelParams {
|
|
2892
|
+
taskId: string;
|
|
2893
|
+
}
|
|
2894
|
+
/** Parameters for tasks/sendSubscribe method */
|
|
2895
|
+
interface TasksSendSubscribeParams {
|
|
2896
|
+
/** Optional existing task ID to continue */
|
|
2897
|
+
taskId?: string;
|
|
2898
|
+
/** Message to send */
|
|
2899
|
+
message: A2AMessage;
|
|
2900
|
+
}
|
|
2901
|
+
/** SSE task update event */
|
|
2902
|
+
interface TaskUpdateEvent {
|
|
2903
|
+
taskId: string;
|
|
2904
|
+
status: A2ATaskState;
|
|
2905
|
+
updatedAt: string;
|
|
2906
|
+
message?: A2AMessage;
|
|
2907
|
+
artifacts?: A2AArtifact[];
|
|
2908
|
+
}
|
|
2909
|
+
|
|
2910
|
+
/**
|
|
2911
|
+
* A2A Protocol Client
|
|
2912
|
+
*
|
|
2913
|
+
* Client for interacting with A2A-compliant agents via the Sekuire API.
|
|
2914
|
+
*/
|
|
2915
|
+
|
|
2916
|
+
interface A2AClientOptions {
|
|
2917
|
+
/** Base URL for the Sekuire API */
|
|
2918
|
+
baseUrl: string;
|
|
2919
|
+
/** Authentication token */
|
|
2920
|
+
authToken: string;
|
|
2921
|
+
/** Optional timeout in milliseconds (default: 30000) */
|
|
2922
|
+
timeout?: number;
|
|
2923
|
+
}
|
|
2924
|
+
/**
|
|
2925
|
+
* A2A Protocol Client
|
|
2926
|
+
*
|
|
2927
|
+
* @example
|
|
2928
|
+
* ```typescript
|
|
2929
|
+
* const client = new A2AClient({
|
|
2930
|
+
* baseUrl: "https://api.sekuire.ai",
|
|
2931
|
+
* authToken: "your-token",
|
|
2932
|
+
* });
|
|
2933
|
+
*
|
|
2934
|
+
* // Auto-discover and send task by skill
|
|
2935
|
+
* const result = await client.sendBySkill({
|
|
2936
|
+
* skill: "document:summarize",
|
|
2937
|
+
* message: {
|
|
2938
|
+
* role: "user",
|
|
2939
|
+
* parts: [{ type: "text", text: "Summarize this document" }],
|
|
2940
|
+
* },
|
|
2941
|
+
* });
|
|
2942
|
+
*
|
|
2943
|
+
* // Stream task updates
|
|
2944
|
+
* for await (const event of client.subscribe(result.taskId)) {
|
|
2945
|
+
* console.log(event.status, event.artifacts);
|
|
2946
|
+
* }
|
|
2947
|
+
* ```
|
|
2948
|
+
*/
|
|
2949
|
+
declare class A2AClient {
|
|
2950
|
+
private baseUrl;
|
|
2951
|
+
private authToken;
|
|
2952
|
+
private timeout;
|
|
2953
|
+
constructor(options: A2AClientOptions);
|
|
2954
|
+
/**
|
|
2955
|
+
* Send a task by skill using auto-discovery routing.
|
|
2956
|
+
* The API will find an agent with the matching skill and forward the task.
|
|
2957
|
+
*/
|
|
2958
|
+
sendBySkill(request: A2ARouteRequest): Promise<A2ARouteResponse>;
|
|
2959
|
+
/**
|
|
2960
|
+
* Send a message directly to a specific agent.
|
|
2961
|
+
*/
|
|
2962
|
+
send(agentUrl: string, message: A2AMessage, taskId?: string): Promise<A2ATask>;
|
|
2963
|
+
/**
|
|
2964
|
+
* Send a task via JSON-RPC to the Sekuire API.
|
|
2965
|
+
*/
|
|
2966
|
+
sendTask(params: TasksSendParams): Promise<A2ATask>;
|
|
2967
|
+
/**
|
|
2968
|
+
* Get task status and details.
|
|
2969
|
+
*/
|
|
2970
|
+
getTask(taskId: string): Promise<A2ATask>;
|
|
2971
|
+
/**
|
|
2972
|
+
* Cancel a running task.
|
|
2973
|
+
*/
|
|
2974
|
+
cancelTask(taskId: string): Promise<A2ATask>;
|
|
2975
|
+
/**
|
|
2976
|
+
* Subscribe to task updates via SSE.
|
|
2977
|
+
*
|
|
2978
|
+
* @example
|
|
2979
|
+
* ```typescript
|
|
2980
|
+
* for await (const event of client.subscribe(taskId)) {
|
|
2981
|
+
* console.log(event.status);
|
|
2982
|
+
* if (event.status === "completed") break;
|
|
2983
|
+
* }
|
|
2984
|
+
* ```
|
|
2985
|
+
*/
|
|
2986
|
+
subscribe(taskId: string): AsyncGenerator<TaskUpdateEvent>;
|
|
2987
|
+
/**
|
|
2988
|
+
* Get an agent's card (capabilities, skills).
|
|
2989
|
+
*/
|
|
2990
|
+
getAgentCard(agentId: string): Promise<AgentCard>;
|
|
2991
|
+
/**
|
|
2992
|
+
* Make a JSON-RPC call to the A2A endpoint.
|
|
2993
|
+
*/
|
|
2994
|
+
private jsonRpc;
|
|
2995
|
+
private fetch;
|
|
2996
|
+
}
|
|
2997
|
+
/**
|
|
2998
|
+
* A2A Protocol Error
|
|
2999
|
+
*/
|
|
3000
|
+
declare class A2AError extends Error {
|
|
3001
|
+
readonly code: string;
|
|
3002
|
+
readonly jsonRpcCode?: number | undefined;
|
|
3003
|
+
constructor(message: string, code: string, jsonRpcCode?: number | undefined);
|
|
3004
|
+
}
|
|
3005
|
+
|
|
3006
|
+
/**
|
|
3007
|
+
* A2A Protocol Server
|
|
3008
|
+
*
|
|
3009
|
+
* Server implementation for creating A2A-compliant agents with streaming support.
|
|
3010
|
+
*/
|
|
3011
|
+
|
|
3012
|
+
interface A2AServerOptions {
|
|
3013
|
+
card: AgentCard;
|
|
3014
|
+
identity?: AgentIdentity;
|
|
3015
|
+
port?: number;
|
|
3016
|
+
handlers: Record<string, SkillHandler>;
|
|
3017
|
+
streamingHandlers?: Record<string, StreamingSkillHandler>;
|
|
3018
|
+
}
|
|
3019
|
+
type SkillHandler = (message: A2AMessage, context: SkillContext) => Promise<A2AMessage | A2AArtifact[]>;
|
|
3020
|
+
type StreamingSkillHandler = (message: A2AMessage, context: StreamingSkillContext) => AsyncGenerator<StreamingUpdate>;
|
|
3021
|
+
interface SkillContext {
|
|
3022
|
+
taskId: string;
|
|
3023
|
+
contextId?: string;
|
|
3024
|
+
history: A2AMessage[];
|
|
3025
|
+
}
|
|
3026
|
+
interface StreamingSkillContext extends SkillContext {
|
|
3027
|
+
emit: (update: StreamingUpdate) => void;
|
|
3028
|
+
}
|
|
3029
|
+
type StreamingUpdate = {
|
|
3030
|
+
type: "progress";
|
|
3031
|
+
message: string;
|
|
3032
|
+
percent?: number;
|
|
3033
|
+
} | {
|
|
3034
|
+
type: "artifact";
|
|
3035
|
+
artifact: A2AArtifact;
|
|
3036
|
+
} | {
|
|
3037
|
+
type: "message";
|
|
3038
|
+
message: A2AMessage;
|
|
3039
|
+
} | {
|
|
3040
|
+
type: "status";
|
|
3041
|
+
status: A2ATaskState;
|
|
3042
|
+
};
|
|
3043
|
+
interface TaskState {
|
|
3044
|
+
id: string;
|
|
3045
|
+
contextId?: string;
|
|
3046
|
+
status: A2ATaskState;
|
|
3047
|
+
history: A2AMessage[];
|
|
3048
|
+
artifacts: A2AArtifact[];
|
|
3049
|
+
createdAt: Date;
|
|
3050
|
+
updatedAt: Date;
|
|
3051
|
+
subscribers: Set<(event: TaskUpdateEvent) => void>;
|
|
3052
|
+
}
|
|
3053
|
+
declare class A2AServer {
|
|
3054
|
+
private card;
|
|
3055
|
+
private identity?;
|
|
3056
|
+
private handlers;
|
|
3057
|
+
private streamingHandlers;
|
|
3058
|
+
private tasks;
|
|
3059
|
+
private heartbeatInterval?;
|
|
3060
|
+
constructor(options: A2AServerOptions);
|
|
3061
|
+
/**
|
|
3062
|
+
* Start sending heartbeats to the registry
|
|
3063
|
+
* @param publicUrl The public URL where this agent is reachable
|
|
3064
|
+
* @param registryUrl The registry API base URL (default: http://localhost:3000)
|
|
3065
|
+
*/
|
|
3066
|
+
startHeartbeat(publicUrl: string, registryUrl?: string): Promise<void>;
|
|
3067
|
+
stopHeartbeat(): void;
|
|
3068
|
+
getAgentCard(): AgentCard;
|
|
3069
|
+
getTask(taskId: string): TaskState | undefined;
|
|
3070
|
+
handleRequest(request: JsonRpcRequest): Promise<JsonRpcResponse>;
|
|
3071
|
+
handleStreamingRequest(request: JsonRpcRequest): AsyncGenerator<TaskUpdateEvent>;
|
|
3072
|
+
subscribeToTask(taskId: string): AsyncGenerator<TaskUpdateEvent> | null;
|
|
3073
|
+
formatSSE(event: TaskUpdateEvent): string;
|
|
3074
|
+
notifySubscribers(taskId: string): void;
|
|
3075
|
+
private handleTasksSend;
|
|
3076
|
+
private handleTasksGet;
|
|
3077
|
+
private handleTasksCancel;
|
|
3078
|
+
private findHandler;
|
|
3079
|
+
private findStreamingHandler;
|
|
3080
|
+
private findHandlerInMap;
|
|
3081
|
+
private extractText;
|
|
3082
|
+
private createUpdateEvent;
|
|
3083
|
+
private taskToResponse;
|
|
3084
|
+
private success;
|
|
3085
|
+
private error;
|
|
3086
|
+
private generateId;
|
|
3087
|
+
}
|
|
3088
|
+
|
|
3089
|
+
/**
|
|
3090
|
+
* A2A Task Delegator
|
|
3091
|
+
*
|
|
3092
|
+
* Enables agents to delegate tasks to other agents and receive completion callbacks.
|
|
3093
|
+
* Provides a complete feedback loop for multi-agent orchestration.
|
|
3094
|
+
*/
|
|
3095
|
+
|
|
3096
|
+
interface DelegatorConfig {
|
|
3097
|
+
apiUrl: string;
|
|
3098
|
+
authToken: string;
|
|
3099
|
+
workspaceId: string;
|
|
3100
|
+
agentId: string;
|
|
3101
|
+
timeout?: number;
|
|
3102
|
+
pollInterval?: number;
|
|
3103
|
+
}
|
|
3104
|
+
interface DelegationRequest {
|
|
3105
|
+
skill: string;
|
|
3106
|
+
message: string | A2AMessage;
|
|
3107
|
+
contextId?: string;
|
|
3108
|
+
parentTaskId?: string;
|
|
3109
|
+
traceId?: string;
|
|
3110
|
+
timeout?: number;
|
|
3111
|
+
onProgress?: (event: TaskUpdateEvent) => void;
|
|
3112
|
+
}
|
|
3113
|
+
interface DelegationResult {
|
|
3114
|
+
taskId: string;
|
|
3115
|
+
agentId: string;
|
|
3116
|
+
traceId?: string;
|
|
3117
|
+
status: A2ATaskState;
|
|
3118
|
+
result?: A2AMessage;
|
|
3119
|
+
artifacts?: Array<{
|
|
3120
|
+
name?: string;
|
|
3121
|
+
parts: Array<{
|
|
3122
|
+
type: string;
|
|
3123
|
+
text?: string;
|
|
3124
|
+
}>;
|
|
3125
|
+
}>;
|
|
3126
|
+
error?: string;
|
|
3127
|
+
executionTimeMs: number;
|
|
3128
|
+
}
|
|
3129
|
+
declare class A2ATaskDelegator {
|
|
3130
|
+
private client;
|
|
3131
|
+
private config;
|
|
3132
|
+
private activeDelegations;
|
|
3133
|
+
constructor(config: DelegatorConfig);
|
|
3134
|
+
delegate(request: DelegationRequest): Promise<DelegationResult>;
|
|
3135
|
+
delegateWithStreaming(request: DelegationRequest): AsyncGenerator<TaskUpdateEvent, DelegationResult>;
|
|
3136
|
+
cancelDelegation(taskId: string): void;
|
|
3137
|
+
cancelAllDelegations(): void;
|
|
3138
|
+
discoverAgents(skill: string): Promise<Array<{
|
|
3139
|
+
agentId: string;
|
|
3140
|
+
name: string;
|
|
3141
|
+
}>>;
|
|
3142
|
+
private waitForCompletion;
|
|
3143
|
+
private pollForCompletion;
|
|
3144
|
+
private sleep;
|
|
3145
|
+
}
|
|
3146
|
+
declare function createDelegator(config: DelegatorConfig): A2ATaskDelegator;
|
|
3147
|
+
|
|
3148
|
+
export { A2AClient, A2AError, A2AServer, A2ATaskDelegator, SekuireAgent as Agent, AgentIdentity, AnthropicProvider, BaseMemoryStorage, Beacon, CONVEX_FUNCTIONS_TEMPLATE, CONVEX_SCHEMA_TEMPLATE, CloudflareD1Storage, CloudflareKVStorage, ComplianceError, ComplianceMonitor, ContentPolicyError, ConvexStorage, CryptoError, DEFAULT_API_URL, DynamoDBStorage, FileAccessError, GoogleProvider, InMemoryStorage, NetworkComplianceError, NetworkError, OllamaProvider, OpenAIProvider, PolicyClient, PolicyEnforcer, PolicyViolationError, PostgresStorage, ProtocolError, RedisStorage, SQLiteStorage, SekuireAgent$1 as SekuireAgent, SekuireAgentBuilder, SekuireClient, SekuireCrypto, SekuireError, SekuireLogger, SekuireRegistryClient, SekuireSDK, SekuireServer, SekuireSpanExporter, TaskWorker, Tool, ToolPatternParser, ToolRegistry, ToolUsageError, TursoStorage, UpstashStorage, builtInTools, calculateSekuireId, createAgent, createBeacon, createDefaultToolRegistry, createDelegationTool, createDelegator, createDiscoveryTool, createLLMProvider, createMemoryStorage, createRegistryClient, createSekuireClient, createSekuireExpressMiddleware, createSekuireFastifyPlugin, createWorker, detectDeploymentUrl, generateKeyPair, getAgent, getAgentConfig, getAgents, getTools$1 as getLegacyTools, getStorageInfo, getSystemPrompt, getTools, getTracer, hasStorage, initTelemetry, listStorageTypes, llm, loadConfig, loadSystemPrompt, loadTools, registerStorage, shutdownTelemetry, tool, tools };
|
|
3149
|
+
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, BootstrapResponse, BuiltInMemoryType, ChatChunk, ChatOptions, ChatResponse, CloudflareD1Config, CloudflareKVConfig, ComplianceConfig, ComplianceViolation, ToolDefinition$1 as ConfigToolDefinition, ConvexConfig, CreateOrgRequest, CreateWorkspaceRequest, DelegationRequest, DelegationResult, DelegatorConfig, DisputeRequest, DisputeResponse, DynamoDBConfig, 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, SQLiteConfig, 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, TursoConfig, UpdateAgentOptions, UpstashConfig, UserContextResponse, VerificationIssue, VerificationRequest, VerificationResult, VerificationStatus, VerifyAgentRequest, WorkerConfig, WorkspaceResponse, WorkspaceSummary };
|