@sekuire/sdk 0.1.13 → 0.1.14
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/beacon.d.ts +78 -7
- package/dist/index.d.ts +201 -12
- package/dist/index.esm.js +520 -48
- package/dist/index.js +520 -47
- package/dist/runtime-credentials.d.ts +24 -0
- package/dist/sdk.d.ts +65 -4
- package/dist/worker.d.ts +32 -0
- package/package.json +1 -1
package/dist/beacon.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* 1. Install Token (recommended): Use an install token from the dashboard
|
|
9
9
|
* 2. API Key: Use an API key for SDK-initiated bootstrap (requires workspace)
|
|
10
10
|
*/
|
|
11
|
+
import { RuntimeCredentialsStore } from "./runtime-credentials";
|
|
11
12
|
export interface BeaconConfig {
|
|
12
13
|
/** Sekuire Core API base URL */
|
|
13
14
|
apiBaseUrl: string;
|
|
@@ -27,6 +28,26 @@ export interface BeaconConfig {
|
|
|
27
28
|
capabilities?: string[];
|
|
28
29
|
/** Optional callback invoked on status changes */
|
|
29
30
|
onStatusChange?: (status: BeaconStatus) => void;
|
|
31
|
+
/** Optional shared credentials store for token synchronization */
|
|
32
|
+
credentialsStore?: RuntimeCredentialsStore;
|
|
33
|
+
/**
|
|
34
|
+
* Pre-existing installation ID for credential recovery.
|
|
35
|
+
* When set with refreshToken, allows recovery after container restarts.
|
|
36
|
+
* Reads from SEKUIRE_INSTALLATION_ID if not set.
|
|
37
|
+
*/
|
|
38
|
+
installationId?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Refresh token for credential recovery.
|
|
41
|
+
* Use with installationId to recover after container restarts.
|
|
42
|
+
* Reads from SEKUIRE_REFRESH_TOKEN if not set.
|
|
43
|
+
*/
|
|
44
|
+
refreshToken?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Pre-existing runtime token (optional).
|
|
47
|
+
* If still valid, skips refresh on startup.
|
|
48
|
+
* Reads from SEKUIRE_RUNTIME_TOKEN if not set.
|
|
49
|
+
*/
|
|
50
|
+
runtimeToken?: string;
|
|
30
51
|
}
|
|
31
52
|
export interface BeaconStatus {
|
|
32
53
|
isRunning: boolean;
|
|
@@ -37,6 +58,14 @@ export interface BeaconStatus {
|
|
|
37
58
|
failedHeartbeats: number;
|
|
38
59
|
/** True if bootstrap failed and agent is running without Sekuire features */
|
|
39
60
|
degradedMode: boolean;
|
|
61
|
+
/** Indicates credentials were recovered from env vars rather than fresh bootstrap */
|
|
62
|
+
recoveredFromEnv?: boolean;
|
|
63
|
+
}
|
|
64
|
+
export interface InstallationCredentials {
|
|
65
|
+
installationId: string;
|
|
66
|
+
runtimeToken: string;
|
|
67
|
+
refreshToken: string;
|
|
68
|
+
expiresAt?: string;
|
|
40
69
|
}
|
|
41
70
|
export interface BootstrapResponse {
|
|
42
71
|
installation_id: string;
|
|
@@ -54,11 +83,19 @@ export declare class Beacon {
|
|
|
54
83
|
private lastHeartbeat;
|
|
55
84
|
private failedHeartbeats;
|
|
56
85
|
private degradedMode;
|
|
86
|
+
private recoveredFromEnv;
|
|
87
|
+
private expiresAt;
|
|
88
|
+
private credentialsStore?;
|
|
57
89
|
constructor(config: BeaconConfig);
|
|
58
90
|
/**
|
|
59
91
|
* Start the beacon - registers with Sekuire and begins heartbeat loop
|
|
60
92
|
*
|
|
61
|
-
*
|
|
93
|
+
* Authentication priority:
|
|
94
|
+
* 1. If SEKUIRE_INSTALLATION_ID + SEKUIRE_REFRESH_TOKEN are set, recover credentials
|
|
95
|
+
* 2. If SEKUIRE_RUNTIME_TOKEN is also set and valid, use it directly
|
|
96
|
+
* 3. Fall back to SEKUIRE_INSTALL_TOKEN for fresh bootstrap
|
|
97
|
+
*
|
|
98
|
+
* If all authentication methods fail, the agent continues running in degraded mode
|
|
62
99
|
* without Sekuire features. This prevents auth failures from crashing agents.
|
|
63
100
|
*/
|
|
64
101
|
start(): Promise<void>;
|
|
@@ -82,6 +119,41 @@ export declare class Beacon {
|
|
|
82
119
|
installationId: string;
|
|
83
120
|
runtimeToken: string;
|
|
84
121
|
} | null;
|
|
122
|
+
/**
|
|
123
|
+
* Get full installation credentials for persistence.
|
|
124
|
+
*
|
|
125
|
+
* Use this after successful bootstrap to extract credentials that can be
|
|
126
|
+
* saved as environment variables or secrets for future container restarts.
|
|
127
|
+
* These credentials allow recovery without consuming a new install token.
|
|
128
|
+
*
|
|
129
|
+
* Example usage:
|
|
130
|
+
* ```ts
|
|
131
|
+
* const creds = beacon.getInstallationCredentials();
|
|
132
|
+
* if (creds) {
|
|
133
|
+
* // Save to your secrets manager (AWS Secrets Manager, K8s Secret, etc.)
|
|
134
|
+
* // SEKUIRE_INSTALLATION_ID = creds.installationId
|
|
135
|
+
* // SEKUIRE_REFRESH_TOKEN = creds.refreshToken
|
|
136
|
+
* // SEKUIRE_RUNTIME_TOKEN = creds.runtimeToken (optional, has expiry)
|
|
137
|
+
* }
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* @returns Full installation credentials or null if not bootstrapped
|
|
141
|
+
*/
|
|
142
|
+
getInstallationCredentials(): InstallationCredentials | null;
|
|
143
|
+
/**
|
|
144
|
+
* Try to recover credentials using installation ID and refresh token from env.
|
|
145
|
+
*
|
|
146
|
+
* This allows agents to survive container restarts without needing a new
|
|
147
|
+
* install token, which is especially important for ephemeral compute
|
|
148
|
+
* environments like Cloud Run, Kubernetes, or serverless functions.
|
|
149
|
+
*
|
|
150
|
+
* @returns true if recovery succeeded, false otherwise
|
|
151
|
+
*/
|
|
152
|
+
private tryCredentialRecovery;
|
|
153
|
+
/**
|
|
154
|
+
* Validate a runtime token by making a lightweight API call.
|
|
155
|
+
*/
|
|
156
|
+
private validateRuntimeToken;
|
|
85
157
|
/**
|
|
86
158
|
* Bootstrap with retry and exponential backoff
|
|
87
159
|
*
|
|
@@ -119,13 +191,12 @@ export declare class Beacon {
|
|
|
119
191
|
*/
|
|
120
192
|
private notifyStatusChange;
|
|
121
193
|
/**
|
|
122
|
-
* Get
|
|
123
|
-
*/
|
|
124
|
-
private getApiKey;
|
|
125
|
-
/**
|
|
126
|
-
* Get install token from environment
|
|
194
|
+
* Get environment variable value (works in Node.js and browser)
|
|
127
195
|
*/
|
|
128
|
-
private
|
|
196
|
+
private getEnvVar;
|
|
197
|
+
private getInstallationId;
|
|
198
|
+
private getRuntimeToken;
|
|
199
|
+
private getRefreshToken;
|
|
129
200
|
}
|
|
130
201
|
/**
|
|
131
202
|
* Create a new beacon instance
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,31 @@ import { Tracer } from '@opentelemetry/api';
|
|
|
3
3
|
import { ExportResult } from '@opentelemetry/core';
|
|
4
4
|
import { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
|
5
5
|
|
|
6
|
+
interface RuntimeCredentials {
|
|
7
|
+
installationId?: string;
|
|
8
|
+
runtimeToken?: string;
|
|
9
|
+
refreshToken?: string;
|
|
10
|
+
expiresAt?: string;
|
|
11
|
+
}
|
|
12
|
+
declare class RuntimeCredentialsStore {
|
|
13
|
+
private installationId?;
|
|
14
|
+
private runtimeToken?;
|
|
15
|
+
private refreshToken?;
|
|
16
|
+
private expiresAt?;
|
|
17
|
+
constructor(initial?: RuntimeCredentials);
|
|
18
|
+
update(partial: RuntimeCredentials): void;
|
|
19
|
+
setRuntimeToken(runtimeToken: string, expiresAt?: string): void;
|
|
20
|
+
setInstallationId(installationId: string): void;
|
|
21
|
+
setRefreshToken(refreshToken: string): void;
|
|
22
|
+
getInstallationId(): string | undefined;
|
|
23
|
+
getRuntimeToken(): string | undefined;
|
|
24
|
+
getRefreshToken(): string | undefined;
|
|
25
|
+
getExpiresAt(): string | undefined;
|
|
26
|
+
getAll(): RuntimeCredentials;
|
|
27
|
+
hasRecoveryCredentials(): boolean;
|
|
28
|
+
hasRuntimeToken(): boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
6
31
|
/**
|
|
7
32
|
* Sekuire Beacon - Deployment Registration & Heartbeat
|
|
8
33
|
*
|
|
@@ -13,6 +38,7 @@ import { SpanExporter, ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
|
|
13
38
|
* 1. Install Token (recommended): Use an install token from the dashboard
|
|
14
39
|
* 2. API Key: Use an API key for SDK-initiated bootstrap (requires workspace)
|
|
15
40
|
*/
|
|
41
|
+
|
|
16
42
|
interface BeaconConfig {
|
|
17
43
|
/** Sekuire Core API base URL */
|
|
18
44
|
apiBaseUrl: string;
|
|
@@ -32,6 +58,26 @@ interface BeaconConfig {
|
|
|
32
58
|
capabilities?: string[];
|
|
33
59
|
/** Optional callback invoked on status changes */
|
|
34
60
|
onStatusChange?: (status: BeaconStatus) => void;
|
|
61
|
+
/** Optional shared credentials store for token synchronization */
|
|
62
|
+
credentialsStore?: RuntimeCredentialsStore;
|
|
63
|
+
/**
|
|
64
|
+
* Pre-existing installation ID for credential recovery.
|
|
65
|
+
* When set with refreshToken, allows recovery after container restarts.
|
|
66
|
+
* Reads from SEKUIRE_INSTALLATION_ID if not set.
|
|
67
|
+
*/
|
|
68
|
+
installationId?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Refresh token for credential recovery.
|
|
71
|
+
* Use with installationId to recover after container restarts.
|
|
72
|
+
* Reads from SEKUIRE_REFRESH_TOKEN if not set.
|
|
73
|
+
*/
|
|
74
|
+
refreshToken?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Pre-existing runtime token (optional).
|
|
77
|
+
* If still valid, skips refresh on startup.
|
|
78
|
+
* Reads from SEKUIRE_RUNTIME_TOKEN if not set.
|
|
79
|
+
*/
|
|
80
|
+
runtimeToken?: string;
|
|
35
81
|
}
|
|
36
82
|
interface BeaconStatus {
|
|
37
83
|
isRunning: boolean;
|
|
@@ -42,6 +88,14 @@ interface BeaconStatus {
|
|
|
42
88
|
failedHeartbeats: number;
|
|
43
89
|
/** True if bootstrap failed and agent is running without Sekuire features */
|
|
44
90
|
degradedMode: boolean;
|
|
91
|
+
/** Indicates credentials were recovered from env vars rather than fresh bootstrap */
|
|
92
|
+
recoveredFromEnv?: boolean;
|
|
93
|
+
}
|
|
94
|
+
interface InstallationCredentials {
|
|
95
|
+
installationId: string;
|
|
96
|
+
runtimeToken: string;
|
|
97
|
+
refreshToken: string;
|
|
98
|
+
expiresAt?: string;
|
|
45
99
|
}
|
|
46
100
|
interface BootstrapResponse {
|
|
47
101
|
installation_id: string;
|
|
@@ -59,11 +113,19 @@ declare class Beacon {
|
|
|
59
113
|
private lastHeartbeat;
|
|
60
114
|
private failedHeartbeats;
|
|
61
115
|
private degradedMode;
|
|
116
|
+
private recoveredFromEnv;
|
|
117
|
+
private expiresAt;
|
|
118
|
+
private credentialsStore?;
|
|
62
119
|
constructor(config: BeaconConfig);
|
|
63
120
|
/**
|
|
64
121
|
* Start the beacon - registers with Sekuire and begins heartbeat loop
|
|
65
122
|
*
|
|
66
|
-
*
|
|
123
|
+
* Authentication priority:
|
|
124
|
+
* 1. If SEKUIRE_INSTALLATION_ID + SEKUIRE_REFRESH_TOKEN are set, recover credentials
|
|
125
|
+
* 2. If SEKUIRE_RUNTIME_TOKEN is also set and valid, use it directly
|
|
126
|
+
* 3. Fall back to SEKUIRE_INSTALL_TOKEN for fresh bootstrap
|
|
127
|
+
*
|
|
128
|
+
* If all authentication methods fail, the agent continues running in degraded mode
|
|
67
129
|
* without Sekuire features. This prevents auth failures from crashing agents.
|
|
68
130
|
*/
|
|
69
131
|
start(): Promise<void>;
|
|
@@ -87,6 +149,41 @@ declare class Beacon {
|
|
|
87
149
|
installationId: string;
|
|
88
150
|
runtimeToken: string;
|
|
89
151
|
} | null;
|
|
152
|
+
/**
|
|
153
|
+
* Get full installation credentials for persistence.
|
|
154
|
+
*
|
|
155
|
+
* Use this after successful bootstrap to extract credentials that can be
|
|
156
|
+
* saved as environment variables or secrets for future container restarts.
|
|
157
|
+
* These credentials allow recovery without consuming a new install token.
|
|
158
|
+
*
|
|
159
|
+
* Example usage:
|
|
160
|
+
* ```ts
|
|
161
|
+
* const creds = beacon.getInstallationCredentials();
|
|
162
|
+
* if (creds) {
|
|
163
|
+
* // Save to your secrets manager (AWS Secrets Manager, K8s Secret, etc.)
|
|
164
|
+
* // SEKUIRE_INSTALLATION_ID = creds.installationId
|
|
165
|
+
* // SEKUIRE_REFRESH_TOKEN = creds.refreshToken
|
|
166
|
+
* // SEKUIRE_RUNTIME_TOKEN = creds.runtimeToken (optional, has expiry)
|
|
167
|
+
* }
|
|
168
|
+
* ```
|
|
169
|
+
*
|
|
170
|
+
* @returns Full installation credentials or null if not bootstrapped
|
|
171
|
+
*/
|
|
172
|
+
getInstallationCredentials(): InstallationCredentials | null;
|
|
173
|
+
/**
|
|
174
|
+
* Try to recover credentials using installation ID and refresh token from env.
|
|
175
|
+
*
|
|
176
|
+
* This allows agents to survive container restarts without needing a new
|
|
177
|
+
* install token, which is especially important for ephemeral compute
|
|
178
|
+
* environments like Cloud Run, Kubernetes, or serverless functions.
|
|
179
|
+
*
|
|
180
|
+
* @returns true if recovery succeeded, false otherwise
|
|
181
|
+
*/
|
|
182
|
+
private tryCredentialRecovery;
|
|
183
|
+
/**
|
|
184
|
+
* Validate a runtime token by making a lightweight API call.
|
|
185
|
+
*/
|
|
186
|
+
private validateRuntimeToken;
|
|
90
187
|
/**
|
|
91
188
|
* Bootstrap with retry and exponential backoff
|
|
92
189
|
*
|
|
@@ -124,13 +221,12 @@ declare class Beacon {
|
|
|
124
221
|
*/
|
|
125
222
|
private notifyStatusChange;
|
|
126
223
|
/**
|
|
127
|
-
* Get
|
|
128
|
-
*/
|
|
129
|
-
private getApiKey;
|
|
130
|
-
/**
|
|
131
|
-
* Get install token from environment
|
|
224
|
+
* Get environment variable value (works in Node.js and browser)
|
|
132
225
|
*/
|
|
133
|
-
private
|
|
226
|
+
private getEnvVar;
|
|
227
|
+
private getInstallationId;
|
|
228
|
+
private getRuntimeToken;
|
|
229
|
+
private getRefreshToken;
|
|
134
230
|
}
|
|
135
231
|
/**
|
|
136
232
|
* Create a new beacon instance
|
|
@@ -258,6 +354,7 @@ declare class SekuireLogger {
|
|
|
258
354
|
* Handles SSE connection to Core for real-time task delivery.
|
|
259
355
|
* Provides `onTask()` API for agents to register task handlers.
|
|
260
356
|
*/
|
|
357
|
+
|
|
261
358
|
interface TaskEvent {
|
|
262
359
|
task_id: string;
|
|
263
360
|
capability?: string;
|
|
@@ -283,11 +380,27 @@ interface WorkerConfig {
|
|
|
283
380
|
agentId: string;
|
|
284
381
|
installToken?: string;
|
|
285
382
|
runtimeToken?: string;
|
|
383
|
+
/** Optional token provider for shared runtime credentials */
|
|
384
|
+
tokenProvider?: () => string | undefined;
|
|
286
385
|
heartbeatIntervalMs?: number;
|
|
287
386
|
reconnectDelayMs?: number;
|
|
288
387
|
maxReconnectDelayMs?: number;
|
|
289
388
|
deploymentUrl?: string;
|
|
290
389
|
capabilities?: string[];
|
|
390
|
+
/** Optional shared credentials store for token synchronization */
|
|
391
|
+
credentialsStore?: RuntimeCredentialsStore;
|
|
392
|
+
/**
|
|
393
|
+
* Pre-existing installation ID for credential recovery.
|
|
394
|
+
* When set with refreshToken, allows recovery after container restarts.
|
|
395
|
+
* Reads from SEKUIRE_INSTALLATION_ID if not set.
|
|
396
|
+
*/
|
|
397
|
+
installationId?: string;
|
|
398
|
+
/**
|
|
399
|
+
* Refresh token for credential recovery.
|
|
400
|
+
* Use with installationId to recover after container restarts.
|
|
401
|
+
* Reads from SEKUIRE_REFRESH_TOKEN if not set.
|
|
402
|
+
*/
|
|
403
|
+
refreshToken?: string;
|
|
291
404
|
}
|
|
292
405
|
declare class TaskWorker {
|
|
293
406
|
private eventSource;
|
|
@@ -302,15 +415,28 @@ declare class TaskWorker {
|
|
|
302
415
|
private refreshToken;
|
|
303
416
|
private expiresAt;
|
|
304
417
|
private onCommandCallback?;
|
|
418
|
+
private recoveredFromEnv;
|
|
419
|
+
private credentialsStore?;
|
|
420
|
+
private tokenProvider?;
|
|
305
421
|
constructor(config: WorkerConfig);
|
|
422
|
+
private getEnvVar;
|
|
306
423
|
/**
|
|
307
424
|
* Register a handler for a specific capability
|
|
308
425
|
*/
|
|
309
426
|
onTask(capability: string, handler: TaskHandler): this;
|
|
310
427
|
/**
|
|
311
428
|
* Start the worker (connects to SSE stream and starts heartbeat)
|
|
429
|
+
*
|
|
430
|
+
* Authentication priority:
|
|
431
|
+
* 1. If runtimeToken is provided, use it directly
|
|
432
|
+
* 2. If installationId + refreshToken are set, recover credentials
|
|
433
|
+
* 3. Fall back to installToken for fresh bootstrap
|
|
312
434
|
*/
|
|
313
435
|
start(): Promise<void>;
|
|
436
|
+
/**
|
|
437
|
+
* Try to recover credentials using installation ID and refresh token.
|
|
438
|
+
*/
|
|
439
|
+
private tryCredentialRecovery;
|
|
314
440
|
/**
|
|
315
441
|
* Stop the worker gracefully
|
|
316
442
|
*/
|
|
@@ -363,6 +489,8 @@ declare class TaskWorker {
|
|
|
363
489
|
* Refresh the runtime token using the refresh token
|
|
364
490
|
*/
|
|
365
491
|
private refreshRuntimeToken;
|
|
492
|
+
private getInstallationId;
|
|
493
|
+
private getRefreshToken;
|
|
366
494
|
}
|
|
367
495
|
declare function createWorker(config: WorkerConfig): TaskWorker;
|
|
368
496
|
|
|
@@ -389,6 +517,24 @@ interface SekuireSDKConfig {
|
|
|
389
517
|
loggingEnabled?: boolean;
|
|
390
518
|
/** Capabilities this agent provides */
|
|
391
519
|
capabilities?: string[];
|
|
520
|
+
/**
|
|
521
|
+
* Pre-existing installation ID for credential recovery.
|
|
522
|
+
* When set with refreshToken, allows recovery after container restarts.
|
|
523
|
+
* Reads from SEKUIRE_INSTALLATION_ID if not set.
|
|
524
|
+
*/
|
|
525
|
+
installationId?: string;
|
|
526
|
+
/**
|
|
527
|
+
* Refresh token for credential recovery.
|
|
528
|
+
* Use with installationId to recover after container restarts.
|
|
529
|
+
* Reads from SEKUIRE_REFRESH_TOKEN if not set.
|
|
530
|
+
*/
|
|
531
|
+
refreshToken?: string;
|
|
532
|
+
/**
|
|
533
|
+
* Pre-existing runtime token (optional).
|
|
534
|
+
* If still valid, skips refresh on startup.
|
|
535
|
+
* Reads from SEKUIRE_RUNTIME_TOKEN if not set.
|
|
536
|
+
*/
|
|
537
|
+
runtimeToken?: string;
|
|
392
538
|
}
|
|
393
539
|
declare class SekuireSDK {
|
|
394
540
|
private config;
|
|
@@ -397,13 +543,17 @@ declare class SekuireSDK {
|
|
|
397
543
|
private client;
|
|
398
544
|
private beacon;
|
|
399
545
|
private isRunning;
|
|
546
|
+
private credentialsStore;
|
|
400
547
|
constructor(config: SekuireSDKConfig);
|
|
401
548
|
/**
|
|
402
549
|
* Create SDK instance from environment variables.
|
|
403
550
|
*
|
|
404
551
|
* Required env vars:
|
|
405
552
|
* SEKUIRE_AGENT_ID - The agent's sekuire_id
|
|
406
|
-
*
|
|
553
|
+
*
|
|
554
|
+
* Authentication (one of the following):
|
|
555
|
+
* SEKUIRE_INSTALL_TOKEN - Install token from dashboard (for initial bootstrap)
|
|
556
|
+
* SEKUIRE_INSTALLATION_ID + SEKUIRE_REFRESH_TOKEN - For credential recovery
|
|
407
557
|
*
|
|
408
558
|
* Optional env vars:
|
|
409
559
|
* SEKUIRE_API_KEY - API key for authentication (X-API-Key header)
|
|
@@ -412,6 +562,7 @@ declare class SekuireSDK {
|
|
|
412
562
|
* SEKUIRE_API_URL - API base URL (default: https://api.sekuire.ai)
|
|
413
563
|
* SEKUIRE_WORKSPACE_ID - Workspace ID for policy enforcement
|
|
414
564
|
* SEKUIRE_ENVIRONMENT - Environment name (default: production)
|
|
565
|
+
* SEKUIRE_RUNTIME_TOKEN - Pre-existing runtime token (skips refresh if valid)
|
|
415
566
|
*/
|
|
416
567
|
static fromEnv(options?: {
|
|
417
568
|
autoHeartbeat?: boolean;
|
|
@@ -420,10 +571,12 @@ declare class SekuireSDK {
|
|
|
420
571
|
/**
|
|
421
572
|
* Start the SDK.
|
|
422
573
|
*
|
|
423
|
-
* - Bootstraps with Sekuire using
|
|
574
|
+
* - Bootstraps with Sekuire using install token or recovery credentials
|
|
424
575
|
* - Starts auto-heartbeat loop if enabled
|
|
425
576
|
*
|
|
426
|
-
*
|
|
577
|
+
* Authentication (one of):
|
|
578
|
+
* - SEKUIRE_INSTALL_TOKEN for initial bootstrap
|
|
579
|
+
* - SEKUIRE_INSTALLATION_ID + SEKUIRE_REFRESH_TOKEN for recovery
|
|
427
580
|
*/
|
|
428
581
|
start(): Promise<void>;
|
|
429
582
|
/**
|
|
@@ -468,6 +621,39 @@ declare class SekuireSDK {
|
|
|
468
621
|
installationId: string;
|
|
469
622
|
runtimeToken: string;
|
|
470
623
|
} | null;
|
|
624
|
+
/**
|
|
625
|
+
* Get full installation credentials for persistence.
|
|
626
|
+
*
|
|
627
|
+
* Use this after successful SDK start to extract credentials that can be
|
|
628
|
+
* saved as environment variables or secrets for future container restarts.
|
|
629
|
+
* These credentials allow recovery without consuming a new install token.
|
|
630
|
+
*
|
|
631
|
+
* Recommended workflow for ephemeral compute (Cloud Run, K8s, etc.):
|
|
632
|
+
* 1. First deploy: use SEKUIRE_INSTALL_TOKEN for initial bootstrap
|
|
633
|
+
* 2. After start: call getInstallationCredentials() to extract creds
|
|
634
|
+
* 3. Save to secrets manager (AWS Secrets Manager, K8s Secret, etc.)
|
|
635
|
+
* 4. Update deployment with:
|
|
636
|
+
* - SEKUIRE_INSTALLATION_ID
|
|
637
|
+
* - SEKUIRE_REFRESH_TOKEN
|
|
638
|
+
* - (optionally) SEKUIRE_RUNTIME_TOKEN
|
|
639
|
+
* 5. Future restarts: SDK auto-recovers using refresh token
|
|
640
|
+
*
|
|
641
|
+
* @example
|
|
642
|
+
* ```ts
|
|
643
|
+
* const sdk = SekuireSDK.fromEnv();
|
|
644
|
+
* await sdk.start();
|
|
645
|
+
*
|
|
646
|
+
* const creds = sdk.getInstallationCredentials();
|
|
647
|
+
* if (creds) {
|
|
648
|
+
* console.log('Save these to your secrets manager:');
|
|
649
|
+
* console.log(`SEKUIRE_INSTALLATION_ID=${creds.installationId}`);
|
|
650
|
+
* console.log(`SEKUIRE_REFRESH_TOKEN=${creds.refreshToken}`);
|
|
651
|
+
* }
|
|
652
|
+
* ```
|
|
653
|
+
*
|
|
654
|
+
* @returns Full installation credentials or null if not bootstrapped
|
|
655
|
+
*/
|
|
656
|
+
getInstallationCredentials(): InstallationCredentials | null;
|
|
471
657
|
/**
|
|
472
658
|
* Create a TaskWorker that shares credentials with this SDK instance.
|
|
473
659
|
*
|
|
@@ -475,6 +661,9 @@ declare class SekuireSDK {
|
|
|
475
661
|
* the runtime credentials from the SDK's beacon. The SDK must be started
|
|
476
662
|
* before calling this method.
|
|
477
663
|
*
|
|
664
|
+
* The Worker receives full credentials (installationId, runtimeToken, refreshToken)
|
|
665
|
+
* so it can independently refresh tokens when they expire.
|
|
666
|
+
*
|
|
478
667
|
* @param options Optional worker configuration overrides
|
|
479
668
|
* @returns TaskWorker instance ready to be started
|
|
480
669
|
* @throws Error if SDK hasn't been started or bootstrap failed
|
|
@@ -3228,5 +3417,5 @@ declare class A2ATaskDelegator {
|
|
|
3228
3417
|
}
|
|
3229
3418
|
declare function createDelegator(config: DelegatorConfig): A2ATaskDelegator;
|
|
3230
3419
|
|
|
3231
|
-
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 };
|
|
3232
|
-
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 };
|
|
3420
|
+
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, RuntimeCredentialsStore, 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 };
|
|
3421
|
+
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, InstallationCredentials, 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, RuntimeCredentials, 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 };
|