@sekuire/sdk 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/a2a-client.d.ts +95 -0
- package/dist/a2a-delegator.d.ts +58 -0
- package/dist/a2a-server.d.ts +84 -0
- package/dist/agent.d.ts +1 -1
- package/dist/beacon.d.ts +65 -0
- package/dist/compliance.d.ts +3 -3
- package/dist/crypto.d.ts +0 -3
- package/dist/http/base-client.d.ts +25 -0
- package/dist/http/index.d.ts +2 -0
- package/dist/identity.d.ts +11 -2
- package/dist/index.d.ts +1035 -172
- package/dist/index.esm.js +14379 -4687
- package/dist/index.js +15233 -5256
- package/dist/llm/anthropic.d.ts +4 -12
- package/dist/llm/base-provider.d.ts +13 -0
- package/dist/llm/google.d.ts +4 -12
- package/dist/llm/index.d.ts +0 -12
- package/dist/llm/ollama.d.ts +4 -11
- package/dist/llm/openai.d.ts +4 -12
- package/dist/llm/types.d.ts +19 -12
- package/dist/logger.d.ts +4 -0
- package/dist/memory/index.d.ts +1 -1
- package/dist/new-agent.d.ts +2 -2
- package/dist/platform-url.d.ts +1 -0
- package/dist/registry-client.d.ts +171 -0
- package/dist/sdk.d.ts +112 -0
- package/dist/telemetry/exporter.d.ts +21 -0
- package/dist/telemetry/index.d.ts +22 -0
- package/dist/tools/agent-invocation.d.ts +16 -68
- package/dist/tools/remote.d.ts +1 -1
- package/dist/types/a2a-types.d.ts +194 -0
- package/dist/types.d.ts +1 -0
- package/dist/utils.d.ts +0 -4
- package/dist/worker.d.ts +104 -0
- package/package.json +8 -1
package/dist/llm/anthropic.d.ts
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Supports Claude models (Claude 3, Claude 3.5, etc.)
|
|
5
|
-
*/
|
|
6
|
-
export declare class AnthropicProvider implements LLMProvider {
|
|
1
|
+
import { BaseLLMProvider } from './base-provider';
|
|
2
|
+
import type { ChatChunk, ChatOptions, ChatResponse, LLMProviderConfig, Message } from './types';
|
|
3
|
+
export declare class AnthropicProvider extends BaseLLMProvider {
|
|
7
4
|
private client;
|
|
8
|
-
private model;
|
|
9
|
-
private maxTokens;
|
|
10
5
|
constructor(config: LLMProviderConfig);
|
|
11
6
|
chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
12
7
|
chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
13
|
-
countTokens(text: string): number;
|
|
14
|
-
getMaxTokens(): number;
|
|
15
8
|
getProviderName(): string;
|
|
16
|
-
|
|
17
|
-
private getMaxTokensForModel;
|
|
9
|
+
protected getMaxTokensForModel(model: string): number;
|
|
18
10
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChatChunk, ChatOptions, ChatResponse, LLMProvider, LLMProviderConfig, Message } from './types';
|
|
2
|
+
export declare abstract class BaseLLMProvider implements LLMProvider {
|
|
3
|
+
protected model: string;
|
|
4
|
+
protected maxTokens: number;
|
|
5
|
+
constructor(config: LLMProviderConfig);
|
|
6
|
+
abstract chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
7
|
+
abstract chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
8
|
+
abstract getProviderName(): string;
|
|
9
|
+
protected abstract getMaxTokensForModel(model: string): number;
|
|
10
|
+
countTokens(text: string): number;
|
|
11
|
+
getMaxTokens(): number;
|
|
12
|
+
getModelName(): string;
|
|
13
|
+
}
|
package/dist/llm/google.d.ts
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Supports Gemini Pro, Gemini Pro Vision, and other Google models
|
|
5
|
-
*/
|
|
6
|
-
export declare class GoogleProvider implements LLMProvider {
|
|
1
|
+
import { BaseLLMProvider } from './base-provider';
|
|
2
|
+
import type { ChatChunk, ChatOptions, ChatResponse, LLMProviderConfig, Message } from './types';
|
|
3
|
+
export declare class GoogleProvider extends BaseLLMProvider {
|
|
7
4
|
private client;
|
|
8
|
-
private model;
|
|
9
|
-
private maxTokens;
|
|
10
5
|
constructor(config: LLMProviderConfig);
|
|
11
6
|
chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
12
7
|
chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
13
|
-
countTokens(text: string): number;
|
|
14
|
-
getMaxTokens(): number;
|
|
15
8
|
getProviderName(): string;
|
|
16
|
-
|
|
17
|
-
private getMaxTokensForModel;
|
|
9
|
+
protected getMaxTokensForModel(model: string): number;
|
|
18
10
|
}
|
package/dist/llm/index.d.ts
CHANGED
|
@@ -16,27 +16,15 @@ export declare function createLLMProvider(provider: string, config: LLMProviderC
|
|
|
16
16
|
* Factory functions for easy LLM instantiation
|
|
17
17
|
*/
|
|
18
18
|
export declare const llm: {
|
|
19
|
-
/**
|
|
20
|
-
* Create OpenAI provider (GPT-4, GPT-3.5, etc.)
|
|
21
|
-
*/
|
|
22
19
|
openai: (config: Omit<LLMProviderConfig, "model"> & {
|
|
23
20
|
model?: string;
|
|
24
21
|
}) => OpenAIProvider;
|
|
25
|
-
/**
|
|
26
|
-
* Create Anthropic provider (Claude 3, Claude 3.5, etc.)
|
|
27
|
-
*/
|
|
28
22
|
anthropic: (config: Omit<LLMProviderConfig, "model"> & {
|
|
29
23
|
model?: string;
|
|
30
24
|
}) => AnthropicProvider;
|
|
31
|
-
/**
|
|
32
|
-
* Create Google provider (Gemini Pro, Gemini 1.5, etc.)
|
|
33
|
-
*/
|
|
34
25
|
google: (config: Omit<LLMProviderConfig, "model"> & {
|
|
35
26
|
model?: string;
|
|
36
27
|
}) => GoogleProvider;
|
|
37
|
-
/**
|
|
38
|
-
* Create Ollama provider (local models: Llama 2, Mistral, etc.)
|
|
39
|
-
*/
|
|
40
28
|
ollama: (config: Omit<LLMProviderConfig, "model"> & {
|
|
41
29
|
model?: string;
|
|
42
30
|
}) => OllamaProvider;
|
package/dist/llm/ollama.d.ts
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Supports local models via Ollama (Llama 2, Mistral, CodeLlama, etc.)
|
|
5
|
-
*/
|
|
6
|
-
export declare class OllamaProvider implements LLMProvider {
|
|
1
|
+
import { BaseLLMProvider } from './base-provider';
|
|
2
|
+
import type { ChatChunk, ChatOptions, ChatResponse, LLMProviderConfig, Message } from './types';
|
|
3
|
+
export declare class OllamaProvider extends BaseLLMProvider {
|
|
7
4
|
private baseUrl;
|
|
8
|
-
private model;
|
|
9
|
-
private maxTokens;
|
|
10
5
|
constructor(config: LLMProviderConfig);
|
|
11
6
|
chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
12
7
|
chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
13
|
-
countTokens(text: string): number;
|
|
14
|
-
getMaxTokens(): number;
|
|
15
8
|
getProviderName(): string;
|
|
16
|
-
|
|
9
|
+
protected getMaxTokensForModel(_model: string): number;
|
|
17
10
|
}
|
package/dist/llm/openai.d.ts
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Supports GPT-3.5, GPT-4, and other OpenAI models
|
|
5
|
-
*/
|
|
6
|
-
export declare class OpenAIProvider implements LLMProvider {
|
|
1
|
+
import { BaseLLMProvider } from './base-provider';
|
|
2
|
+
import type { ChatChunk, ChatOptions, ChatResponse, LLMProviderConfig, Message } from './types';
|
|
3
|
+
export declare class OpenAIProvider extends BaseLLMProvider {
|
|
7
4
|
private client;
|
|
8
|
-
private model;
|
|
9
|
-
private maxTokens;
|
|
10
5
|
constructor(config: LLMProviderConfig);
|
|
11
6
|
chat(messages: Message[], options?: ChatOptions): Promise<ChatResponse>;
|
|
12
7
|
chatStream(messages: Message[], options?: ChatOptions): AsyncGenerator<ChatChunk>;
|
|
13
|
-
countTokens(text: string): number;
|
|
14
|
-
getMaxTokens(): number;
|
|
15
8
|
getProviderName(): string;
|
|
16
|
-
|
|
17
|
-
private getMaxTokensForModel;
|
|
9
|
+
protected getMaxTokensForModel(model: string): number;
|
|
18
10
|
}
|
package/dist/llm/types.d.ts
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export interface ToolDefinition {
|
|
2
|
+
type: 'function';
|
|
3
|
+
function: {
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
parameters?: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface ToolCallFunction {
|
|
10
|
+
id: string;
|
|
11
|
+
type: 'function';
|
|
12
|
+
function: {
|
|
13
|
+
name: string;
|
|
14
|
+
arguments: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
4
17
|
export interface Message {
|
|
5
18
|
role: 'system' | 'user' | 'assistant' | 'function' | 'tool';
|
|
6
19
|
content: string | null;
|
|
7
20
|
name?: string;
|
|
8
21
|
tool_call_id?: string;
|
|
9
|
-
tool_calls?:
|
|
22
|
+
tool_calls?: ToolCallFunction[];
|
|
10
23
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Options for chat completion
|
|
13
|
-
*/
|
|
14
24
|
export interface ChatOptions {
|
|
15
25
|
temperature?: number;
|
|
16
26
|
max_tokens?: number;
|
|
@@ -19,16 +29,13 @@ export interface ChatOptions {
|
|
|
19
29
|
presence_penalty?: number;
|
|
20
30
|
stop?: string[];
|
|
21
31
|
stream?: boolean;
|
|
22
|
-
tools?:
|
|
32
|
+
tools?: ToolDefinition[];
|
|
23
33
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Response from chat completion
|
|
26
|
-
*/
|
|
27
34
|
export interface ChatResponse {
|
|
28
35
|
content: string;
|
|
29
36
|
model: string;
|
|
30
37
|
finish_reason?: string;
|
|
31
|
-
tool_calls?:
|
|
38
|
+
tool_calls?: ToolCallFunction[];
|
|
32
39
|
usage?: {
|
|
33
40
|
prompt_tokens: number;
|
|
34
41
|
completion_tokens: number;
|
package/dist/logger.d.ts
CHANGED
|
@@ -15,6 +15,10 @@ export interface LoggerConfig {
|
|
|
15
15
|
enabled?: boolean;
|
|
16
16
|
batchSize?: number;
|
|
17
17
|
flushInterval?: number;
|
|
18
|
+
onError?: (error: Error, context: {
|
|
19
|
+
operation: string;
|
|
20
|
+
eventsLost?: number;
|
|
21
|
+
}) => void;
|
|
18
22
|
}
|
|
19
23
|
export interface EventLog {
|
|
20
24
|
sekuire_id: string;
|
package/dist/memory/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export * from './redis';
|
|
|
5
5
|
import type { MemoryStorage } from './base';
|
|
6
6
|
import { type PostgresConfig } from './postgres';
|
|
7
7
|
import { type RedisConfig } from './redis';
|
|
8
|
-
export type MemoryType = 'in-memory' | 'redis' | 'postgres';
|
|
8
|
+
export type MemoryType = 'in-memory' | 'redis' | 'postgres' | 'buffer';
|
|
9
9
|
export interface MemoryFactoryConfig {
|
|
10
10
|
type: MemoryType;
|
|
11
11
|
redis?: RedisConfig;
|
package/dist/new-agent.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ToolDefinition } from './config/loader';
|
|
2
|
-
import type { LLMProvider, Message
|
|
3
|
-
import { PolicyEnforcer } from './policy-enforcer';
|
|
2
|
+
import type { ChatOptions, LLMProvider, Message } from './llm/types';
|
|
4
3
|
import { type MemoryStorage } from './memory';
|
|
4
|
+
import { PolicyEnforcer } from './policy-enforcer';
|
|
5
5
|
/**
|
|
6
6
|
* Options for overriding agent configuration
|
|
7
7
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function detectDeploymentUrl(): string | undefined;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { type AgentResponse, type Manifest, type ReputationResponse, type VerificationStatus } from "./types";
|
|
2
|
+
export interface RegistryClientConfig {
|
|
3
|
+
apiUrl: string;
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
timeout?: number;
|
|
6
|
+
retries?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface PublishAgentOptions {
|
|
9
|
+
manifest: Manifest;
|
|
10
|
+
privateKeyHex: string;
|
|
11
|
+
systemPrompt: string;
|
|
12
|
+
tools: string;
|
|
13
|
+
publisherOrgId?: string;
|
|
14
|
+
visibility?: "public" | "private" | "internal";
|
|
15
|
+
}
|
|
16
|
+
export interface UpdateAgentOptions {
|
|
17
|
+
manifest?: Partial<Manifest>;
|
|
18
|
+
visibility?: "public" | "private" | "internal";
|
|
19
|
+
gitRepository?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface SearchAgentsOptions {
|
|
22
|
+
query?: string;
|
|
23
|
+
tags?: string[];
|
|
24
|
+
verificationStatus?: VerificationStatus;
|
|
25
|
+
category?: string;
|
|
26
|
+
limit?: number;
|
|
27
|
+
offset?: number;
|
|
28
|
+
}
|
|
29
|
+
export interface TaskCompletion {
|
|
30
|
+
taskId: string;
|
|
31
|
+
taskHash: string;
|
|
32
|
+
rating: number;
|
|
33
|
+
comment?: string;
|
|
34
|
+
evidence?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface LeaderboardEntry {
|
|
37
|
+
sekuireId: string;
|
|
38
|
+
name: string;
|
|
39
|
+
reputationScore: number;
|
|
40
|
+
taskCount: number;
|
|
41
|
+
verificationStatus: VerificationStatus;
|
|
42
|
+
rank: number;
|
|
43
|
+
}
|
|
44
|
+
export interface PublishResponse {
|
|
45
|
+
sekuireId: string;
|
|
46
|
+
name: string;
|
|
47
|
+
version: string;
|
|
48
|
+
verificationStatus: VerificationStatus;
|
|
49
|
+
createdAt: string;
|
|
50
|
+
}
|
|
51
|
+
export interface DisputeResponse {
|
|
52
|
+
id: string;
|
|
53
|
+
sekuireId: string;
|
|
54
|
+
status: "pending" | "reviewing" | "resolved" | "rejected";
|
|
55
|
+
createdAt: string;
|
|
56
|
+
}
|
|
57
|
+
export interface VerificationRequest {
|
|
58
|
+
sekuireId: string;
|
|
59
|
+
repositoryUrl?: string;
|
|
60
|
+
commitHash?: string;
|
|
61
|
+
complianceFramework?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface VerificationResult {
|
|
64
|
+
passed: boolean;
|
|
65
|
+
securityScore: number;
|
|
66
|
+
complianceScore: number;
|
|
67
|
+
issues: VerificationIssue[];
|
|
68
|
+
timestamp: string;
|
|
69
|
+
}
|
|
70
|
+
export interface VerificationIssue {
|
|
71
|
+
severity: "critical" | "high" | "medium" | "low";
|
|
72
|
+
category: string;
|
|
73
|
+
message: string;
|
|
74
|
+
file?: string;
|
|
75
|
+
line?: number;
|
|
76
|
+
}
|
|
77
|
+
export interface TrustHeadersRequest {
|
|
78
|
+
agentId: string;
|
|
79
|
+
action?: string;
|
|
80
|
+
context?: Record<string, unknown>;
|
|
81
|
+
}
|
|
82
|
+
export interface TrustHeaders {
|
|
83
|
+
"X-Sekuire-Agent-ID": string;
|
|
84
|
+
"X-Sekuire-Reputation": string;
|
|
85
|
+
"X-Sekuire-Verification": string;
|
|
86
|
+
"X-Sekuire-Badges": string;
|
|
87
|
+
"X-Sekuire-Timestamp": string;
|
|
88
|
+
"X-Sekuire-Signature": string;
|
|
89
|
+
}
|
|
90
|
+
export declare class SekuireRegistryClient {
|
|
91
|
+
private readonly http;
|
|
92
|
+
constructor(config: RegistryClientConfig | string, authToken?: string);
|
|
93
|
+
setAuthToken(token: string): void;
|
|
94
|
+
setApiKey(apiKey: string): void;
|
|
95
|
+
publishAgent(options: PublishAgentOptions): Promise<PublishResponse>;
|
|
96
|
+
getAgent(sekuireId: string): Promise<AgentResponse>;
|
|
97
|
+
updateAgent(sekuireId: string, options: UpdateAgentOptions): Promise<AgentResponse>;
|
|
98
|
+
deleteAgent(sekuireId: string): Promise<void>;
|
|
99
|
+
listAgents(options?: SearchAgentsOptions): Promise<AgentResponse[]>;
|
|
100
|
+
searchAgents(query: string, options?: Omit<SearchAgentsOptions, "query">): Promise<AgentResponse[]>;
|
|
101
|
+
getMyAgents(): Promise<AgentResponse[]>;
|
|
102
|
+
getReputation(sekuireId: string): Promise<ReputationResponse>;
|
|
103
|
+
recordTaskCompletion(sekuireId: string, task: TaskCompletion, privateKeyHex: string): Promise<void>;
|
|
104
|
+
getLeaderboard(limit?: number): Promise<LeaderboardEntry[]>;
|
|
105
|
+
fileDispute(sekuireId: string, reason: string, evidenceLog: string, accuserId: string): Promise<DisputeResponse>;
|
|
106
|
+
verifyAgentQuick(sekuireId: string): Promise<VerificationResult>;
|
|
107
|
+
verifyAgentComprehensive(request: VerificationRequest): Promise<VerificationResult>;
|
|
108
|
+
getVerificationHistory(sekuireId: string): Promise<VerificationResult[]>;
|
|
109
|
+
getLatestVerification(sekuireId: string): Promise<VerificationResult | null>;
|
|
110
|
+
generateTrustHeaders(request: TrustHeadersRequest): Promise<TrustHeaders>;
|
|
111
|
+
getTrustProfile(agentDid: string): Promise<Record<string, unknown>>;
|
|
112
|
+
getTransactionHistory(agentDid: string): Promise<unknown[]>;
|
|
113
|
+
createTask(task: {
|
|
114
|
+
description: string;
|
|
115
|
+
capabilities: string[];
|
|
116
|
+
priority?: number;
|
|
117
|
+
callbackUrl?: string;
|
|
118
|
+
}): Promise<{
|
|
119
|
+
taskId: string;
|
|
120
|
+
status: string;
|
|
121
|
+
}>;
|
|
122
|
+
getTask(taskId: string): Promise<{
|
|
123
|
+
taskId: string;
|
|
124
|
+
status: string;
|
|
125
|
+
result?: unknown;
|
|
126
|
+
error?: string;
|
|
127
|
+
}>;
|
|
128
|
+
completeTask(taskId: string, result: unknown, privateKeyHex: string): Promise<void>;
|
|
129
|
+
getRegistryStats(): Promise<{
|
|
130
|
+
totalAgents: number;
|
|
131
|
+
verifiedAgents: number;
|
|
132
|
+
totalTasks: number;
|
|
133
|
+
categories: string[];
|
|
134
|
+
}>;
|
|
135
|
+
getCategories(): Promise<Array<{
|
|
136
|
+
slug: string;
|
|
137
|
+
name: string;
|
|
138
|
+
agentCount: number;
|
|
139
|
+
}>>;
|
|
140
|
+
getAgentsByCategory(categorySlug: string): Promise<AgentResponse[]>;
|
|
141
|
+
getWorkspace(workspaceId: string): Promise<Record<string, unknown>>;
|
|
142
|
+
getWorkspacePolicies(workspaceId: string): Promise<unknown[]>;
|
|
143
|
+
getActivePolicy(workspaceId: string): Promise<unknown>;
|
|
144
|
+
getPolicyTemplates(): Promise<unknown[]>;
|
|
145
|
+
evaluatePolicy(workspaceId: string, action: {
|
|
146
|
+
type: string;
|
|
147
|
+
resource: string;
|
|
148
|
+
context?: Record<string, unknown>;
|
|
149
|
+
}): Promise<{
|
|
150
|
+
allowed: boolean;
|
|
151
|
+
violations: string[];
|
|
152
|
+
}>;
|
|
153
|
+
logAgentEvents(sekuireId: string, events: Array<{
|
|
154
|
+
type: string;
|
|
155
|
+
severity: string;
|
|
156
|
+
data: Record<string, unknown>;
|
|
157
|
+
timestamp?: string;
|
|
158
|
+
}>): Promise<void>;
|
|
159
|
+
logAgentHealth(sekuireId: string, health: {
|
|
160
|
+
status: "healthy" | "degraded" | "unhealthy";
|
|
161
|
+
uptime: number;
|
|
162
|
+
memoryMb?: number;
|
|
163
|
+
cpuPercent?: number;
|
|
164
|
+
}): Promise<void>;
|
|
165
|
+
getAgentLogs(sekuireId: string, options?: {
|
|
166
|
+
limit?: number;
|
|
167
|
+
offset?: number;
|
|
168
|
+
type?: string;
|
|
169
|
+
}): Promise<unknown[]>;
|
|
170
|
+
}
|
|
171
|
+
export declare function createRegistryClient(apiUrl: string, authToken?: string, apiKey?: string): SekuireRegistryClient;
|
package/dist/sdk.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SekuireSDK - Main SDK entry point for TypeScript agents
|
|
3
|
+
*
|
|
4
|
+
* Combines identity, logging, and heartbeat functionality with a simple API.
|
|
5
|
+
*/
|
|
6
|
+
import { type BeaconStatus } from "./beacon";
|
|
7
|
+
import { AgentIdentity } from "./identity";
|
|
8
|
+
import { SekuireLogger, type EventType, type Severity } from "./logger";
|
|
9
|
+
export declare const DEFAULT_API_URL = "https://api.sekuire.ai";
|
|
10
|
+
export interface SekuireSDKConfig {
|
|
11
|
+
privateKey?: string;
|
|
12
|
+
agentId: string;
|
|
13
|
+
agentName?: string;
|
|
14
|
+
apiUrl?: string;
|
|
15
|
+
apiKey?: string;
|
|
16
|
+
workspaceId?: string;
|
|
17
|
+
environment?: string;
|
|
18
|
+
autoHeartbeat?: boolean;
|
|
19
|
+
heartbeatInterval?: number;
|
|
20
|
+
loggingEnabled?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare class SekuireSDK {
|
|
23
|
+
private config;
|
|
24
|
+
private identity;
|
|
25
|
+
private logger;
|
|
26
|
+
private client;
|
|
27
|
+
private beacon;
|
|
28
|
+
private isRunning;
|
|
29
|
+
constructor(config: SekuireSDKConfig);
|
|
30
|
+
/**
|
|
31
|
+
* Create SDK instance from environment variables.
|
|
32
|
+
*
|
|
33
|
+
* Required env vars:
|
|
34
|
+
* SEKUIRE_AGENT_ID - The agent's sekuire_id
|
|
35
|
+
*
|
|
36
|
+
* Optional env vars:
|
|
37
|
+
* SEKUIRE_API_KEY - API key for authentication (X-API-Key header)
|
|
38
|
+
* SEKUIRE_PRIVATE_KEY - Private key for signing (required for heartbeat)
|
|
39
|
+
* SEKUIRE_AGENT_NAME - Human-readable agent name
|
|
40
|
+
* SEKUIRE_API_URL - API base URL (default: https://api.sekuire.ai)
|
|
41
|
+
* SEKUIRE_WORKSPACE_ID - Workspace ID for policy enforcement
|
|
42
|
+
* SEKUIRE_ENVIRONMENT - Environment name (default: production)
|
|
43
|
+
*/
|
|
44
|
+
static fromEnv(options?: {
|
|
45
|
+
autoHeartbeat?: boolean;
|
|
46
|
+
loggingEnabled?: boolean;
|
|
47
|
+
}): SekuireSDK;
|
|
48
|
+
/**
|
|
49
|
+
* Start the SDK.
|
|
50
|
+
*
|
|
51
|
+
* - Sends initial heartbeat
|
|
52
|
+
* - Starts auto-heartbeat loop if enabled
|
|
53
|
+
*/
|
|
54
|
+
start(): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Send a signed heartbeat to the registry.
|
|
57
|
+
*
|
|
58
|
+
* The heartbeat proves the agent is running and has access to the private key.
|
|
59
|
+
*
|
|
60
|
+
* @param url Optional public URL where the agent can be reached
|
|
61
|
+
* @returns True if heartbeat was acknowledged, False otherwise
|
|
62
|
+
*/
|
|
63
|
+
heartbeat(url?: string): Promise<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Log an event to Sekuire.
|
|
66
|
+
*
|
|
67
|
+
* @param eventType Type of event (tool_execution, model_call, policy_check, etc.)
|
|
68
|
+
* @param data Event-specific data
|
|
69
|
+
* @param severity Severity level (debug, info, warn, error)
|
|
70
|
+
*/
|
|
71
|
+
log(eventType: EventType, data: Record<string, unknown>, severity?: Severity): void;
|
|
72
|
+
/**
|
|
73
|
+
* Check if an action is allowed by the workspace policy.
|
|
74
|
+
*
|
|
75
|
+
* @param action The action to check (e.g., "read_file", "network_access")
|
|
76
|
+
* @param context Context for the action (e.g., {path: "/etc/passwd"})
|
|
77
|
+
* @returns True if allowed, False if denied
|
|
78
|
+
*/
|
|
79
|
+
checkPolicy(action: string, context: Record<string, unknown>): Promise<boolean>;
|
|
80
|
+
/**
|
|
81
|
+
* Shutdown the SDK gracefully.
|
|
82
|
+
*/
|
|
83
|
+
shutdown(): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Get the current beacon status (heartbeat health, connection info).
|
|
86
|
+
*/
|
|
87
|
+
getBeaconStatus(): BeaconStatus;
|
|
88
|
+
/**
|
|
89
|
+
* Get the agent ID.
|
|
90
|
+
*/
|
|
91
|
+
get agentId(): string;
|
|
92
|
+
/**
|
|
93
|
+
* Get the agent's public key.
|
|
94
|
+
*/
|
|
95
|
+
get publicKey(): string | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Sign a message with the agent's private key.
|
|
98
|
+
*/
|
|
99
|
+
sign(message: string): Promise<string>;
|
|
100
|
+
/**
|
|
101
|
+
* Verify a signature using the agent's public key.
|
|
102
|
+
*/
|
|
103
|
+
verify(message: string, signature: string): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Get the underlying identity object.
|
|
106
|
+
*/
|
|
107
|
+
getIdentity(): AgentIdentity;
|
|
108
|
+
/**
|
|
109
|
+
* Get the underlying logger object.
|
|
110
|
+
*/
|
|
111
|
+
getLogger(): SekuireLogger;
|
|
112
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ExportResult } from '@opentelemetry/core';
|
|
2
|
+
import { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
3
|
+
export interface SekuireExporterConfig {
|
|
4
|
+
apiUrl: string;
|
|
5
|
+
agentId: string;
|
|
6
|
+
authToken?: string;
|
|
7
|
+
workspaceId?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class SekuireSpanExporter implements SpanExporter {
|
|
10
|
+
private config;
|
|
11
|
+
private pendingExport;
|
|
12
|
+
constructor(config: SekuireExporterConfig);
|
|
13
|
+
export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
|
|
14
|
+
private spanToEvent;
|
|
15
|
+
private mapSpanToEventType;
|
|
16
|
+
private getDurationMs;
|
|
17
|
+
private extractAttributes;
|
|
18
|
+
private sendEvents;
|
|
19
|
+
shutdown(): Promise<void>;
|
|
20
|
+
forceFlush(): Promise<void>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Tracer } from '@opentelemetry/api';
|
|
2
|
+
export type ExporterType = 'otlp' | 'sekuire' | 'console' | 'none';
|
|
3
|
+
export interface TelemetryConfig {
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
agentId: string;
|
|
6
|
+
exporter?: ExporterType;
|
|
7
|
+
otlpEndpoint?: string;
|
|
8
|
+
sekuireApiUrl?: string;
|
|
9
|
+
authToken?: string;
|
|
10
|
+
workspaceId?: string;
|
|
11
|
+
debug?: boolean;
|
|
12
|
+
batchConfig?: {
|
|
13
|
+
maxQueueSize?: number;
|
|
14
|
+
maxExportBatchSize?: number;
|
|
15
|
+
scheduledDelayMillis?: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare function initTelemetry(config: TelemetryConfig): Tracer;
|
|
19
|
+
export declare function getTracer(): Tracer;
|
|
20
|
+
export declare function withSpan<T>(name: string, fn: (span: any) => T): T;
|
|
21
|
+
export declare function shutdownTelemetry(): Promise<void>;
|
|
22
|
+
export { SekuireSpanExporter, type SekuireExporterConfig } from './exporter';
|
|
@@ -1,90 +1,38 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Tool, ToolInput, ToolMetadata } from './base';
|
|
2
2
|
/**
|
|
3
3
|
* Tool for invoking other Sekuire agents
|
|
4
4
|
* Performs handshake and sends requests to verified agents
|
|
5
5
|
*/
|
|
6
|
-
export declare class InvokeAgentTool
|
|
6
|
+
export declare class InvokeAgentTool extends Tool {
|
|
7
|
+
metadata: ToolMetadata;
|
|
8
|
+
private client;
|
|
7
9
|
private readonly privateKey?;
|
|
8
10
|
private readonly publicKey?;
|
|
9
11
|
private readonly registryUrl;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
parameters: {
|
|
13
|
-
type: "object";
|
|
14
|
-
properties: {
|
|
15
|
-
agent_url: {
|
|
16
|
-
type: "string";
|
|
17
|
-
description: string;
|
|
18
|
-
};
|
|
19
|
-
agent_id: {
|
|
20
|
-
type: "string";
|
|
21
|
-
description: string;
|
|
22
|
-
};
|
|
23
|
-
request: {
|
|
24
|
-
type: "string";
|
|
25
|
-
description: string;
|
|
26
|
-
};
|
|
27
|
-
parameters: {
|
|
28
|
-
type: "object";
|
|
29
|
-
description: string;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
required: string[];
|
|
33
|
-
};
|
|
34
|
-
metadata: ToolMetadata;
|
|
35
|
-
private client;
|
|
36
|
-
constructor(privateKey?: string | undefined, publicKey?: string | undefined, registryUrl?: string);
|
|
37
|
-
execute(args: Record<string, any>): Promise<string>;
|
|
12
|
+
constructor(privateKey?: string, publicKey?: string, registryUrl?: string);
|
|
13
|
+
execute(input: ToolInput): Promise<string>;
|
|
38
14
|
}
|
|
39
15
|
/**
|
|
40
16
|
* Tool for searching the Sekuire registry for agents
|
|
41
17
|
*/
|
|
42
|
-
export declare class SearchAgentsTool
|
|
18
|
+
export declare class SearchAgentsTool extends Tool {
|
|
19
|
+
metadata: ToolMetadata;
|
|
20
|
+
private client;
|
|
43
21
|
private readonly privateKey?;
|
|
44
22
|
private readonly publicKey?;
|
|
45
23
|
private readonly registryUrl;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
parameters: {
|
|
49
|
-
type: "object";
|
|
50
|
-
properties: {
|
|
51
|
-
query: {
|
|
52
|
-
type: "string";
|
|
53
|
-
description: string;
|
|
54
|
-
};
|
|
55
|
-
limit: {
|
|
56
|
-
type: "number";
|
|
57
|
-
description: string;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
required: string[];
|
|
61
|
-
};
|
|
62
|
-
metadata: ToolMetadata;
|
|
63
|
-
private client;
|
|
64
|
-
constructor(privateKey?: string | undefined, publicKey?: string | undefined, registryUrl?: string);
|
|
65
|
-
execute(args: Record<string, any>): Promise<string>;
|
|
24
|
+
constructor(privateKey?: string, publicKey?: string, registryUrl?: string);
|
|
25
|
+
execute(input: ToolInput): Promise<string>;
|
|
66
26
|
}
|
|
67
27
|
/**
|
|
68
28
|
* Tool for getting detailed information about a specific agent
|
|
69
29
|
*/
|
|
70
|
-
export declare class GetAgentInfoTool
|
|
30
|
+
export declare class GetAgentInfoTool extends Tool {
|
|
31
|
+
metadata: ToolMetadata;
|
|
32
|
+
private client;
|
|
71
33
|
private readonly privateKey?;
|
|
72
34
|
private readonly publicKey?;
|
|
73
35
|
private readonly registryUrl;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
parameters: {
|
|
77
|
-
type: "object";
|
|
78
|
-
properties: {
|
|
79
|
-
agent_id: {
|
|
80
|
-
type: "string";
|
|
81
|
-
description: string;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
required: string[];
|
|
85
|
-
};
|
|
86
|
-
metadata: ToolMetadata;
|
|
87
|
-
private client;
|
|
88
|
-
constructor(privateKey?: string | undefined, publicKey?: string | undefined, registryUrl?: string);
|
|
89
|
-
execute(args: Record<string, any>): Promise<string>;
|
|
36
|
+
constructor(privateKey?: string, publicKey?: string, registryUrl?: string);
|
|
37
|
+
execute(input: ToolInput): Promise<string>;
|
|
90
38
|
}
|