@sekuire/sdk 0.1.8 → 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 +9 -2
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A2A Protocol Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Types implementing the A2A Protocol specification for agent interoperability.
|
|
5
|
+
* See: https://github.com/a2aproject/A2A
|
|
6
|
+
*/
|
|
7
|
+
/** Full A2A-compliant Agent Card */
|
|
8
|
+
export interface AgentCard {
|
|
9
|
+
/** Unique agent identifier (e.g., "sekuire:workspace:agent-name") */
|
|
10
|
+
agentId: string;
|
|
11
|
+
/** Human-readable agent name */
|
|
12
|
+
name: string;
|
|
13
|
+
/** Agent description */
|
|
14
|
+
description: string;
|
|
15
|
+
/** Semantic version */
|
|
16
|
+
version: string;
|
|
17
|
+
/** Provider information */
|
|
18
|
+
provider?: AgentProvider;
|
|
19
|
+
/** Supported A2A protocol versions */
|
|
20
|
+
protocolVersions: string[];
|
|
21
|
+
/** Agent capabilities */
|
|
22
|
+
capabilities: AgentCapabilities;
|
|
23
|
+
/** Skills the agent provides */
|
|
24
|
+
skills: AgentSkill[];
|
|
25
|
+
/** Default input MIME types accepted */
|
|
26
|
+
defaultInputModes?: string[];
|
|
27
|
+
/** Default output MIME types produced */
|
|
28
|
+
defaultOutputModes?: string[];
|
|
29
|
+
/** Security schemes supported */
|
|
30
|
+
securitySchemes?: Record<string, SecurityScheme>;
|
|
31
|
+
/** Required security scheme names */
|
|
32
|
+
security?: string[];
|
|
33
|
+
/** Base URL for A2A endpoints */
|
|
34
|
+
url: string;
|
|
35
|
+
}
|
|
36
|
+
/** Provider information */
|
|
37
|
+
export interface AgentProvider {
|
|
38
|
+
name: string;
|
|
39
|
+
url?: string;
|
|
40
|
+
}
|
|
41
|
+
/** Agent capabilities */
|
|
42
|
+
export interface AgentCapabilities {
|
|
43
|
+
/** Supports streaming responses via SSE */
|
|
44
|
+
streaming: boolean;
|
|
45
|
+
/** Supports push notifications */
|
|
46
|
+
pushNotifications: boolean;
|
|
47
|
+
/** Supports extended agent card endpoint */
|
|
48
|
+
extendedAgentCard: boolean;
|
|
49
|
+
}
|
|
50
|
+
/** Security scheme definition */
|
|
51
|
+
export interface SecurityScheme {
|
|
52
|
+
type: string;
|
|
53
|
+
scheme?: string;
|
|
54
|
+
bearerFormat?: string;
|
|
55
|
+
}
|
|
56
|
+
/** Structured skill definition */
|
|
57
|
+
export interface AgentSkill {
|
|
58
|
+
/** Skill identifier (e.g., "document:summarize") */
|
|
59
|
+
id: string;
|
|
60
|
+
/** Human-readable skill name */
|
|
61
|
+
name: string;
|
|
62
|
+
/** Skill description */
|
|
63
|
+
description?: string;
|
|
64
|
+
/** Tags for categorization */
|
|
65
|
+
tags?: string[];
|
|
66
|
+
/** Input MIME types accepted */
|
|
67
|
+
inputModes?: string[];
|
|
68
|
+
/** Output MIME types produced */
|
|
69
|
+
outputModes?: string[];
|
|
70
|
+
/** Example prompts */
|
|
71
|
+
examples?: string[];
|
|
72
|
+
}
|
|
73
|
+
/** A2A message with role and parts */
|
|
74
|
+
export interface A2AMessage {
|
|
75
|
+
/** Message role: "user" or "agent" */
|
|
76
|
+
role: "user" | "agent";
|
|
77
|
+
/** Message content parts */
|
|
78
|
+
parts: A2AMessagePart[];
|
|
79
|
+
}
|
|
80
|
+
/** Message part content */
|
|
81
|
+
export type A2AMessagePart = {
|
|
82
|
+
type: "text";
|
|
83
|
+
text: string;
|
|
84
|
+
} | {
|
|
85
|
+
type: "file";
|
|
86
|
+
uri: string;
|
|
87
|
+
mimeType?: string;
|
|
88
|
+
} | {
|
|
89
|
+
type: "data";
|
|
90
|
+
data: unknown;
|
|
91
|
+
};
|
|
92
|
+
/** A2A task states */
|
|
93
|
+
export type A2ATaskState = "pending" | "working" | "input-required" | "completed" | "failed" | "cancelled";
|
|
94
|
+
/** A2A task status with timestamp */
|
|
95
|
+
export interface A2ATaskStatus {
|
|
96
|
+
state: A2ATaskState;
|
|
97
|
+
timestamp: string;
|
|
98
|
+
}
|
|
99
|
+
/** Full A2A task */
|
|
100
|
+
export interface A2ATask {
|
|
101
|
+
taskId: string;
|
|
102
|
+
contextId?: string;
|
|
103
|
+
status: A2ATaskStatus;
|
|
104
|
+
artifacts: A2AArtifact[];
|
|
105
|
+
history: A2AMessage[];
|
|
106
|
+
/** ID of the task that delegated to this task */
|
|
107
|
+
parentTaskId?: string;
|
|
108
|
+
/** Trace ID shared across the delegation chain */
|
|
109
|
+
traceId?: string;
|
|
110
|
+
}
|
|
111
|
+
/** Task artifact output */
|
|
112
|
+
export interface A2AArtifact {
|
|
113
|
+
name?: string;
|
|
114
|
+
parts: A2AMessagePart[];
|
|
115
|
+
index?: number;
|
|
116
|
+
}
|
|
117
|
+
/** Request for skill-based auto-discovery routing */
|
|
118
|
+
export interface A2ARouteRequest {
|
|
119
|
+
/** Required skill (e.g., "document:summarize") */
|
|
120
|
+
skill: string;
|
|
121
|
+
/** Message to send to the agent */
|
|
122
|
+
message: A2AMessage;
|
|
123
|
+
/** Optional conversation context ID */
|
|
124
|
+
contextId?: string;
|
|
125
|
+
/** Parent task ID for delegation tracking */
|
|
126
|
+
parentTaskId?: string;
|
|
127
|
+
/** Trace ID for the entire delegation chain */
|
|
128
|
+
traceId?: string;
|
|
129
|
+
}
|
|
130
|
+
/** Response from skill-based routing */
|
|
131
|
+
export interface A2ARouteResponse {
|
|
132
|
+
/** Created task ID */
|
|
133
|
+
taskId: string;
|
|
134
|
+
/** Current task status */
|
|
135
|
+
status: A2ATaskState;
|
|
136
|
+
/** ID of the selected agent */
|
|
137
|
+
agentId: string;
|
|
138
|
+
/** Initial response message (if any) */
|
|
139
|
+
message?: A2AMessage;
|
|
140
|
+
/** Trace ID for the delegation chain */
|
|
141
|
+
traceId?: string;
|
|
142
|
+
}
|
|
143
|
+
/** JSON-RPC 2.0 Request */
|
|
144
|
+
export interface JsonRpcRequest {
|
|
145
|
+
jsonrpc: "2.0";
|
|
146
|
+
method: string;
|
|
147
|
+
id: string | number;
|
|
148
|
+
params?: unknown;
|
|
149
|
+
}
|
|
150
|
+
/** JSON-RPC 2.0 Response */
|
|
151
|
+
export interface JsonRpcResponse<T = unknown> {
|
|
152
|
+
jsonrpc: "2.0";
|
|
153
|
+
id: string | number;
|
|
154
|
+
result?: T;
|
|
155
|
+
error?: JsonRpcError;
|
|
156
|
+
}
|
|
157
|
+
/** JSON-RPC 2.0 Error */
|
|
158
|
+
export interface JsonRpcError {
|
|
159
|
+
code: number;
|
|
160
|
+
message: string;
|
|
161
|
+
data?: unknown;
|
|
162
|
+
}
|
|
163
|
+
/** Parameters for tasks/send method */
|
|
164
|
+
export interface TasksSendParams {
|
|
165
|
+
/** Optional existing task ID to continue */
|
|
166
|
+
taskId?: string;
|
|
167
|
+
/** Message to send */
|
|
168
|
+
message: A2AMessage;
|
|
169
|
+
/** Optional context ID for grouping tasks */
|
|
170
|
+
contextId?: string;
|
|
171
|
+
}
|
|
172
|
+
/** Parameters for tasks/get method */
|
|
173
|
+
export interface TasksGetParams {
|
|
174
|
+
taskId: string;
|
|
175
|
+
}
|
|
176
|
+
/** Parameters for tasks/cancel method */
|
|
177
|
+
export interface TasksCancelParams {
|
|
178
|
+
taskId: string;
|
|
179
|
+
}
|
|
180
|
+
/** Parameters for tasks/sendSubscribe method */
|
|
181
|
+
export interface TasksSendSubscribeParams {
|
|
182
|
+
/** Optional existing task ID to continue */
|
|
183
|
+
taskId?: string;
|
|
184
|
+
/** Message to send */
|
|
185
|
+
message: A2AMessage;
|
|
186
|
+
}
|
|
187
|
+
/** SSE task update event */
|
|
188
|
+
export interface TaskUpdateEvent {
|
|
189
|
+
taskId: string;
|
|
190
|
+
status: A2ATaskState;
|
|
191
|
+
updatedAt: string;
|
|
192
|
+
message?: A2AMessage;
|
|
193
|
+
artifacts?: A2AArtifact[];
|
|
194
|
+
}
|
package/dist/types.d.ts
CHANGED
package/dist/utils.d.ts
CHANGED
|
@@ -22,10 +22,6 @@ export declare function createSekuireClient(keyPair: KeyPair, registryUrl?: stri
|
|
|
22
22
|
* Load keypair from environment variables
|
|
23
23
|
*/
|
|
24
24
|
export declare function loadKeyPairFromEnv(): KeyPair;
|
|
25
|
-
/**
|
|
26
|
-
* Load keypair from files
|
|
27
|
-
*/
|
|
28
|
-
export declare function loadKeyPairFromFiles(privateKeyPath: string, publicKeyPath?: string): Promise<KeyPair>;
|
|
29
25
|
/**
|
|
30
26
|
* Validate agent configuration
|
|
31
27
|
*/
|
package/dist/worker.d.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sekuire Task Worker
|
|
3
|
+
*
|
|
4
|
+
* Handles SSE connection to Core for real-time task delivery.
|
|
5
|
+
* Provides `onTask()` API for agents to register task handlers.
|
|
6
|
+
*/
|
|
7
|
+
export interface TaskEvent {
|
|
8
|
+
task_id: string;
|
|
9
|
+
capability?: string;
|
|
10
|
+
tool?: string;
|
|
11
|
+
input: Record<string, unknown>;
|
|
12
|
+
workspace_id: string;
|
|
13
|
+
requester_agent_id?: string;
|
|
14
|
+
parent_task_id?: string;
|
|
15
|
+
trace_id?: string;
|
|
16
|
+
workflow_id?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface TaskContext {
|
|
19
|
+
taskId: string;
|
|
20
|
+
workspaceId: string;
|
|
21
|
+
requesterId?: string;
|
|
22
|
+
parentTaskId?: string;
|
|
23
|
+
traceId?: string;
|
|
24
|
+
workflowId?: string;
|
|
25
|
+
}
|
|
26
|
+
export type TaskHandler = (ctx: TaskContext, input: Record<string, unknown>) => Promise<unknown>;
|
|
27
|
+
export interface WorkerConfig {
|
|
28
|
+
apiBaseUrl: string;
|
|
29
|
+
token: string;
|
|
30
|
+
agentId?: string;
|
|
31
|
+
apiKey?: string;
|
|
32
|
+
heartbeatIntervalMs?: number;
|
|
33
|
+
reconnectDelayMs?: number;
|
|
34
|
+
maxReconnectDelayMs?: number;
|
|
35
|
+
deploymentUrl?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare class TaskWorker {
|
|
38
|
+
private eventSource;
|
|
39
|
+
private handlers;
|
|
40
|
+
private config;
|
|
41
|
+
private heartbeatInterval;
|
|
42
|
+
private reconnectDelay;
|
|
43
|
+
private isConnected;
|
|
44
|
+
private isPaused;
|
|
45
|
+
private installationId;
|
|
46
|
+
private onCommandCallback?;
|
|
47
|
+
constructor(config: WorkerConfig);
|
|
48
|
+
/**
|
|
49
|
+
* Register a handler for a specific capability
|
|
50
|
+
*/
|
|
51
|
+
onTask(capability: string, handler: TaskHandler): this;
|
|
52
|
+
/**
|
|
53
|
+
* Start the worker (connects to SSE stream and starts heartbeat)
|
|
54
|
+
*/
|
|
55
|
+
start(): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Stop the worker gracefully
|
|
58
|
+
*/
|
|
59
|
+
stop(): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Check if the worker is currently paused
|
|
62
|
+
*/
|
|
63
|
+
getIsPaused(): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Register a callback for control commands
|
|
66
|
+
*/
|
|
67
|
+
onCommand(callback: (cmd: {
|
|
68
|
+
type: string;
|
|
69
|
+
reason?: string;
|
|
70
|
+
}) => void): this;
|
|
71
|
+
/**
|
|
72
|
+
* Handle control commands from SSE or heartbeat fallback
|
|
73
|
+
*/
|
|
74
|
+
private handleCommand;
|
|
75
|
+
/**
|
|
76
|
+
* Get API key from config or environment
|
|
77
|
+
*/
|
|
78
|
+
private getApiKey;
|
|
79
|
+
/**
|
|
80
|
+
* Connect to SSE stream
|
|
81
|
+
*/
|
|
82
|
+
private connect;
|
|
83
|
+
/**
|
|
84
|
+
* Schedule reconnection with exponential backoff
|
|
85
|
+
*/
|
|
86
|
+
private scheduleReconnect;
|
|
87
|
+
/**
|
|
88
|
+
* Handle incoming task
|
|
89
|
+
*/
|
|
90
|
+
private handleTask;
|
|
91
|
+
/**
|
|
92
|
+
* Report task completion to Core
|
|
93
|
+
*/
|
|
94
|
+
private completeTask;
|
|
95
|
+
/**
|
|
96
|
+
* Register this agent installation with Sekuire
|
|
97
|
+
*/
|
|
98
|
+
private bootstrap;
|
|
99
|
+
/**
|
|
100
|
+
* Start heartbeat loop
|
|
101
|
+
*/
|
|
102
|
+
private startHeartbeat;
|
|
103
|
+
}
|
|
104
|
+
export declare function createWorker(config: WorkerConfig): TaskWorker;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sekuire/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "Sekuire Identity Protocol SDK for TypeScript/JavaScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -56,15 +56,21 @@
|
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@anthropic-ai/sdk": "^0.71.2",
|
|
58
58
|
"@google/generative-ai": "^0.24.1",
|
|
59
|
+
"@opentelemetry/api": "^1.9.0",
|
|
60
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.57.0",
|
|
61
|
+
"@opentelemetry/resources": "^1.29.0",
|
|
62
|
+
"@opentelemetry/sdk-trace-base": "^1.29.0",
|
|
63
|
+
"@opentelemetry/semantic-conventions": "^1.29.0",
|
|
59
64
|
"axios": "^1.13.2",
|
|
60
65
|
"blake3": "^2.1.7",
|
|
61
66
|
"cheerio": "^1.1.2",
|
|
62
67
|
"dotenv": "^17.2.3",
|
|
68
|
+
"eventsource": "^2.0.2",
|
|
63
69
|
"js-yaml": "^4.1.1",
|
|
64
70
|
"openai": "^6.15.0",
|
|
65
71
|
"tweetnacl": "^1.0.3",
|
|
66
72
|
"uuid": "^9.0.1",
|
|
67
|
-
"zod": "^
|
|
73
|
+
"zod": "^3.22.4"
|
|
68
74
|
},
|
|
69
75
|
"devDependencies": {
|
|
70
76
|
"@biomejs/biome": "^1.9.4",
|
|
@@ -72,6 +78,7 @@
|
|
|
72
78
|
"@rollup/plugin-json": "^6.1.0",
|
|
73
79
|
"@rollup/plugin-node-resolve": "^15.3.1",
|
|
74
80
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
81
|
+
"@types/eventsource": "^1.1.15",
|
|
75
82
|
"@types/js-yaml": "^4.0.9",
|
|
76
83
|
"@types/node": "^20.19.27",
|
|
77
84
|
"@types/uuid": "^9.0.8",
|