@sekuire/sdk 0.1.10 → 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/beacon.d.ts +40 -5
- package/dist/config/loader.d.ts +38 -1
- package/dist/index.d.ts +297 -20
- package/dist/index.esm.js +1527 -277
- package/dist/index.js +1127 -133
- 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/sdk.d.ts +14 -9
- package/package.json +33 -2
package/README.md
CHANGED
|
@@ -48,11 +48,75 @@ console.log(response);
|
|
|
48
48
|
|
|
49
49
|
## Features
|
|
50
50
|
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
51
|
+
- **4 LLM Providers**: OpenAI, Anthropic, Google, Ollama
|
|
52
|
+
- **Built-in Tools**: Calculator, Web Search, HTTP, File Operations
|
|
53
|
+
- **Streaming**: Token-by-token responses
|
|
54
|
+
- **Config-First**: Declarative YAML configuration
|
|
55
|
+
- **Type-Safe**: Full TypeScript support
|
|
56
|
+
- **Beacon/Heartbeat**: Automatic registration and health reporting
|
|
57
|
+
|
|
58
|
+
## Deployment Registration (Beacon)
|
|
59
|
+
|
|
60
|
+
The SDK includes a Beacon system for registering deployed agents with Sekuire and sending periodic heartbeats.
|
|
61
|
+
|
|
62
|
+
### Getting an Install Token
|
|
63
|
+
|
|
64
|
+
Before deploying, generate an install token from the dashboard or CLI:
|
|
65
|
+
|
|
66
|
+
**From Dashboard:**
|
|
67
|
+
1. Go to your workspace
|
|
68
|
+
2. Click "Install Agent"
|
|
69
|
+
3. Generate an install token
|
|
70
|
+
|
|
71
|
+
**From CLI:**
|
|
72
|
+
```bash
|
|
73
|
+
sekuire install token --workspace ws_xxxx --agent <agent_id>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Using the SDK with Install Token
|
|
77
|
+
|
|
78
|
+
Set the required environment variables:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
export SEKUIRE_AGENT_ID="your-agent-sekuire-id"
|
|
82
|
+
export SEKUIRE_INSTALL_TOKEN="skt_xxxx" # From dashboard or CLI
|
|
83
|
+
export SEKUIRE_API_URL="https://api.sekuire.ai" # Optional, defaults to production
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Then initialize the SDK:
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import { SekuireSDK } from '@sekuire/sdk';
|
|
90
|
+
|
|
91
|
+
// Create SDK from environment variables (recommended)
|
|
92
|
+
const sdk = SekuireSDK.fromEnv();
|
|
93
|
+
|
|
94
|
+
// Or with explicit config
|
|
95
|
+
const sdk = new SekuireSDK({
|
|
96
|
+
agentId: process.env.SEKUIRE_AGENT_ID,
|
|
97
|
+
installToken: process.env.SEKUIRE_INSTALL_TOKEN,
|
|
98
|
+
apiUrl: 'https://api.sekuire.ai',
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// Start the SDK (bootstraps and begins heartbeat loop)
|
|
102
|
+
await sdk.start();
|
|
103
|
+
|
|
104
|
+
// Check connection status
|
|
105
|
+
console.log('Connected:', sdk.isConnected());
|
|
106
|
+
|
|
107
|
+
// Graceful shutdown
|
|
108
|
+
await sdk.shutdown();
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Beacon Configuration Options
|
|
112
|
+
|
|
113
|
+
| Option | Environment Variable | Description |
|
|
114
|
+
|--------|---------------------|-------------|
|
|
115
|
+
| `installToken` | `SEKUIRE_INSTALL_TOKEN` | Install token from dashboard/CLI (required) |
|
|
116
|
+
| `agentId` | `SEKUIRE_AGENT_ID` | Your agent's sekuire_id (required) |
|
|
117
|
+
| `apiUrl` | `SEKUIRE_API_URL` | API base URL (default: https://api.sekuire.ai) |
|
|
118
|
+
| `heartbeatIntervalSeconds` | - | Heartbeat interval (default: 60) |
|
|
119
|
+
| `capabilities` | - | List of capabilities this agent provides |
|
|
56
120
|
|
|
57
121
|
## API Reference
|
|
58
122
|
|
package/dist/beacon.d.ts
CHANGED
|
@@ -3,34 +3,52 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Automatically registers the agent with Sekuire and sends periodic heartbeats
|
|
5
5
|
* to show online status in the Dashboard.
|
|
6
|
+
*
|
|
7
|
+
* Supports two authentication modes:
|
|
8
|
+
* 1. Install Token (recommended): Use an install token from the dashboard
|
|
9
|
+
* 2. API Key: Use an API key for SDK-initiated bootstrap (requires workspace)
|
|
6
10
|
*/
|
|
7
11
|
export interface BeaconConfig {
|
|
8
12
|
/** Sekuire Core API base URL */
|
|
9
13
|
apiBaseUrl: string;
|
|
14
|
+
/** Install token from dashboard (preferred for BYOC deployments) */
|
|
15
|
+
installToken?: string;
|
|
10
16
|
/** API key for authentication (reads from SEKUIRE_API_KEY if not set) */
|
|
11
17
|
apiKey?: string;
|
|
12
18
|
/** Agent ID to register */
|
|
13
19
|
agentId: string;
|
|
14
|
-
/**
|
|
15
|
-
|
|
20
|
+
/** Workspace ID (required when using API key without install token) */
|
|
21
|
+
workspaceId?: string;
|
|
22
|
+
/** Heartbeat interval in seconds (default: 60) */
|
|
23
|
+
heartbeatIntervalSeconds?: number;
|
|
16
24
|
/** Optional explicit deployment URL (auto-detected if not set) */
|
|
17
25
|
deploymentUrl?: string;
|
|
18
|
-
/** Optional
|
|
19
|
-
|
|
26
|
+
/** Optional capabilities this agent provides */
|
|
27
|
+
capabilities?: string[];
|
|
20
28
|
/** Optional callback invoked on status changes */
|
|
21
29
|
onStatusChange?: (status: BeaconStatus) => void;
|
|
22
30
|
}
|
|
23
31
|
export interface BeaconStatus {
|
|
24
32
|
isRunning: boolean;
|
|
25
33
|
installationId?: string;
|
|
34
|
+
runtimeToken?: string;
|
|
26
35
|
deploymentUrl?: string;
|
|
27
36
|
lastHeartbeat?: Date;
|
|
28
37
|
failedHeartbeats: number;
|
|
29
38
|
}
|
|
39
|
+
export interface BootstrapResponse {
|
|
40
|
+
installation_id: string;
|
|
41
|
+
runtime_token: string;
|
|
42
|
+
refresh_token: string;
|
|
43
|
+
expires_at: string;
|
|
44
|
+
heartbeat_interval: number;
|
|
45
|
+
}
|
|
30
46
|
export declare class Beacon {
|
|
31
47
|
private config;
|
|
32
48
|
private intervalId;
|
|
33
49
|
private installationId;
|
|
50
|
+
private runtimeToken;
|
|
51
|
+
private refreshToken;
|
|
34
52
|
private lastHeartbeat;
|
|
35
53
|
private failedHeartbeats;
|
|
36
54
|
constructor(config: BeaconConfig);
|
|
@@ -48,16 +66,33 @@ export declare class Beacon {
|
|
|
48
66
|
getStatus(): BeaconStatus;
|
|
49
67
|
/**
|
|
50
68
|
* Bootstrap registration with Sekuire
|
|
69
|
+
*
|
|
70
|
+
* Exchanges an install token for runtime credentials (installation_id + runtime_token).
|
|
71
|
+
* The install token is obtained from the dashboard or CLI.
|
|
51
72
|
*/
|
|
52
73
|
private bootstrap;
|
|
53
74
|
/**
|
|
54
|
-
* Send heartbeat to Sekuire
|
|
75
|
+
* Send heartbeat (lease renewal) to Sekuire
|
|
76
|
+
*
|
|
77
|
+
* Uses the installation-based lease endpoint with runtime token authentication.
|
|
55
78
|
*/
|
|
56
79
|
private heartbeat;
|
|
80
|
+
/**
|
|
81
|
+
* Refresh the runtime token using the refresh token
|
|
82
|
+
*/
|
|
83
|
+
private refreshRuntimeToken;
|
|
84
|
+
/**
|
|
85
|
+
* Notify status change callback
|
|
86
|
+
*/
|
|
87
|
+
private notifyStatusChange;
|
|
57
88
|
/**
|
|
58
89
|
* Get API key from environment
|
|
59
90
|
*/
|
|
60
91
|
private getApiKey;
|
|
92
|
+
/**
|
|
93
|
+
* Get install token from environment
|
|
94
|
+
*/
|
|
95
|
+
private getInstallToken;
|
|
61
96
|
}
|
|
62
97
|
/**
|
|
63
98
|
* Create a new beacon instance
|
package/dist/config/loader.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ export interface LLMConfig {
|
|
|
71
71
|
base_url?: string;
|
|
72
72
|
}
|
|
73
73
|
export interface MemoryConfig {
|
|
74
|
-
type: 'in-memory' | 'redis' | 'postgres';
|
|
74
|
+
type: 'in-memory' | 'buffer' | 'redis' | 'postgres' | 'sqlite' | 'upstash' | 'cloudflare-kv' | 'cloudflare-d1' | 'dynamodb' | 'turso' | 'convex' | string;
|
|
75
75
|
max_messages?: number;
|
|
76
76
|
redis?: {
|
|
77
77
|
url?: string;
|
|
@@ -90,6 +90,43 @@ export interface MemoryConfig {
|
|
|
90
90
|
password?: string;
|
|
91
91
|
tableName?: string;
|
|
92
92
|
};
|
|
93
|
+
sqlite?: {
|
|
94
|
+
filename: string;
|
|
95
|
+
tableName?: string;
|
|
96
|
+
};
|
|
97
|
+
upstash?: {
|
|
98
|
+
url: string;
|
|
99
|
+
token: string;
|
|
100
|
+
keyPrefix?: string;
|
|
101
|
+
};
|
|
102
|
+
cloudflareKV?: {
|
|
103
|
+
namespaceId?: string;
|
|
104
|
+
accountId?: string;
|
|
105
|
+
apiToken?: string;
|
|
106
|
+
keyPrefix?: string;
|
|
107
|
+
};
|
|
108
|
+
cloudflareD1?: {
|
|
109
|
+
databaseId?: string;
|
|
110
|
+
accountId?: string;
|
|
111
|
+
apiToken?: string;
|
|
112
|
+
tableName?: string;
|
|
113
|
+
};
|
|
114
|
+
dynamodb?: {
|
|
115
|
+
tableName: string;
|
|
116
|
+
region?: string;
|
|
117
|
+
endpoint?: string;
|
|
118
|
+
createTable?: boolean;
|
|
119
|
+
};
|
|
120
|
+
turso?: {
|
|
121
|
+
url: string;
|
|
122
|
+
authToken?: string;
|
|
123
|
+
tableName?: string;
|
|
124
|
+
};
|
|
125
|
+
convex?: {
|
|
126
|
+
url: string;
|
|
127
|
+
adminKey?: string;
|
|
128
|
+
};
|
|
129
|
+
config?: Record<string, unknown>;
|
|
93
130
|
}
|
|
94
131
|
export interface ComplianceConfig {
|
|
95
132
|
framework?: string;
|