@agentimprint/sdk 0.1.0
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 +85 -0
- package/dist/index.cjs +436 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +329 -0
- package/dist/index.d.ts +329 -0
- package/dist/index.js +423 -0
- package/dist/index.js.map +1 -0
- package/package.json +34 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
declare class HttpClient {
|
|
2
|
+
private readonly apiKey;
|
|
3
|
+
private readonly baseUrl;
|
|
4
|
+
constructor(apiKey: string, baseUrl: string);
|
|
5
|
+
private buildUrl;
|
|
6
|
+
private request;
|
|
7
|
+
private throwError;
|
|
8
|
+
get<T>(path: string, params?: Record<string, string | number | boolean | undefined>, requiresAuth?: boolean): Promise<T>;
|
|
9
|
+
post<T>(path: string, body?: unknown, requiresAuth?: boolean): Promise<T>;
|
|
10
|
+
put<T>(path: string, body?: unknown): Promise<T>;
|
|
11
|
+
delete<T>(path: string): Promise<T>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface Organization {
|
|
15
|
+
uuid: string;
|
|
16
|
+
name: string;
|
|
17
|
+
slug: string;
|
|
18
|
+
tier: string;
|
|
19
|
+
is_active: boolean;
|
|
20
|
+
created_at: string;
|
|
21
|
+
updated_at: string;
|
|
22
|
+
}
|
|
23
|
+
interface OrganizationWithKey extends Organization {
|
|
24
|
+
apiKey: string;
|
|
25
|
+
}
|
|
26
|
+
interface Agent {
|
|
27
|
+
uuid: string;
|
|
28
|
+
name: string;
|
|
29
|
+
model_family: string;
|
|
30
|
+
core_purpose: string;
|
|
31
|
+
creator_identifier: string;
|
|
32
|
+
fingerprint: string;
|
|
33
|
+
version: string;
|
|
34
|
+
capabilities: string[];
|
|
35
|
+
meta: Record<string, unknown>;
|
|
36
|
+
is_active: boolean;
|
|
37
|
+
organization_uuid: string;
|
|
38
|
+
created_at: string;
|
|
39
|
+
updated_at: string;
|
|
40
|
+
}
|
|
41
|
+
interface CreateAgentParams {
|
|
42
|
+
name: string;
|
|
43
|
+
model_family: string;
|
|
44
|
+
core_purpose: string;
|
|
45
|
+
creator_identifier: string;
|
|
46
|
+
version?: string;
|
|
47
|
+
capabilities?: string[];
|
|
48
|
+
meta?: Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
interface DiscoverResult {
|
|
51
|
+
uuid: string;
|
|
52
|
+
name: string;
|
|
53
|
+
fingerprint: string;
|
|
54
|
+
model_family: string;
|
|
55
|
+
organization_uuid: string;
|
|
56
|
+
created_at: string;
|
|
57
|
+
}
|
|
58
|
+
interface GenerateKeyResult {
|
|
59
|
+
key: string;
|
|
60
|
+
}
|
|
61
|
+
interface SplitKeyParams {
|
|
62
|
+
shares: number;
|
|
63
|
+
threshold: number;
|
|
64
|
+
}
|
|
65
|
+
interface SplitKeyResult {
|
|
66
|
+
shares: string[];
|
|
67
|
+
}
|
|
68
|
+
interface RecoverKeyResult {
|
|
69
|
+
key: string;
|
|
70
|
+
}
|
|
71
|
+
interface Vault {
|
|
72
|
+
uuid: string;
|
|
73
|
+
name: string;
|
|
74
|
+
description: string | null;
|
|
75
|
+
agent_uuid: string;
|
|
76
|
+
organization_uuid: string;
|
|
77
|
+
encryption_algorithm: string;
|
|
78
|
+
compression_enabled: boolean;
|
|
79
|
+
entry_count: number;
|
|
80
|
+
is_active: boolean;
|
|
81
|
+
created_at: string;
|
|
82
|
+
updated_at: string;
|
|
83
|
+
}
|
|
84
|
+
interface CreateVaultParams {
|
|
85
|
+
name: string;
|
|
86
|
+
agent_uuid: string;
|
|
87
|
+
description?: string;
|
|
88
|
+
encryption_algorithm?: string;
|
|
89
|
+
compression_enabled?: boolean;
|
|
90
|
+
}
|
|
91
|
+
interface VaultStats {
|
|
92
|
+
vault_uuid: string;
|
|
93
|
+
entry_count: number;
|
|
94
|
+
total_size_bytes: number;
|
|
95
|
+
encrypted_count: number;
|
|
96
|
+
unencrypted_count: number;
|
|
97
|
+
namespaces: string[];
|
|
98
|
+
created_at: string;
|
|
99
|
+
last_updated_at: string | null;
|
|
100
|
+
}
|
|
101
|
+
interface VaultExport {
|
|
102
|
+
vault: Vault;
|
|
103
|
+
entries: Entry[];
|
|
104
|
+
exported_at: string;
|
|
105
|
+
}
|
|
106
|
+
interface ImportResult {
|
|
107
|
+
imported: number;
|
|
108
|
+
skipped: number;
|
|
109
|
+
errors: string[];
|
|
110
|
+
}
|
|
111
|
+
interface MerkleInfo {
|
|
112
|
+
vault_uuid: string;
|
|
113
|
+
root_hash: string;
|
|
114
|
+
entry_count: number;
|
|
115
|
+
computed_at: string;
|
|
116
|
+
}
|
|
117
|
+
interface VerifyResult {
|
|
118
|
+
valid: boolean;
|
|
119
|
+
vault_uuid: string;
|
|
120
|
+
root_hash: string;
|
|
121
|
+
mismatched_entries: string[];
|
|
122
|
+
verified_at: string;
|
|
123
|
+
}
|
|
124
|
+
interface Snapshot {
|
|
125
|
+
uuid: string;
|
|
126
|
+
vault_uuid: string;
|
|
127
|
+
root_hash: string;
|
|
128
|
+
entry_count: number;
|
|
129
|
+
metadata: Record<string, unknown>;
|
|
130
|
+
created_at: string;
|
|
131
|
+
}
|
|
132
|
+
type EntryType = 'lesson' | 'heuristic' | 'fact' | 'preference' | 'pattern' | 'relationship' | 'negative' | 'procedural';
|
|
133
|
+
interface Entry {
|
|
134
|
+
uuid: string;
|
|
135
|
+
vault_uuid: string;
|
|
136
|
+
entry_type: EntryType;
|
|
137
|
+
content: Record<string, unknown>;
|
|
138
|
+
provenance: Record<string, unknown> | null;
|
|
139
|
+
confidence: number;
|
|
140
|
+
domain: string | null;
|
|
141
|
+
tags: string[];
|
|
142
|
+
is_encrypted: boolean;
|
|
143
|
+
pii_flags: string[] | null;
|
|
144
|
+
tombstoned_at: string | null;
|
|
145
|
+
created_at: string;
|
|
146
|
+
updated_at: string;
|
|
147
|
+
}
|
|
148
|
+
interface CreateEntryParams {
|
|
149
|
+
entry_type: EntryType;
|
|
150
|
+
content: Record<string, unknown>;
|
|
151
|
+
provenance?: Record<string, unknown>;
|
|
152
|
+
confidence?: number;
|
|
153
|
+
domain?: string;
|
|
154
|
+
tags?: string[];
|
|
155
|
+
is_encrypted?: boolean;
|
|
156
|
+
pii_flags?: string[];
|
|
157
|
+
}
|
|
158
|
+
interface UpdateEntryParams {
|
|
159
|
+
content?: Record<string, unknown>;
|
|
160
|
+
provenance?: Record<string, unknown>;
|
|
161
|
+
confidence?: number;
|
|
162
|
+
domain?: string;
|
|
163
|
+
tags?: string[];
|
|
164
|
+
pii_flags?: string[];
|
|
165
|
+
}
|
|
166
|
+
interface ListEntriesParams {
|
|
167
|
+
type?: EntryType;
|
|
168
|
+
domain?: string;
|
|
169
|
+
tag?: string;
|
|
170
|
+
q?: string;
|
|
171
|
+
include_tombstoned?: boolean;
|
|
172
|
+
page?: number;
|
|
173
|
+
per_page?: number;
|
|
174
|
+
}
|
|
175
|
+
interface PaginatedEntries {
|
|
176
|
+
entries: Entry[];
|
|
177
|
+
pagination: {
|
|
178
|
+
total: number;
|
|
179
|
+
per_page: number;
|
|
180
|
+
current_page: number;
|
|
181
|
+
last_page: number;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
interface BulkResult {
|
|
185
|
+
imported: string[];
|
|
186
|
+
failed: Array<{
|
|
187
|
+
index: number;
|
|
188
|
+
errors: Record<string, string[]>;
|
|
189
|
+
}>;
|
|
190
|
+
summary: {
|
|
191
|
+
total: number;
|
|
192
|
+
imported: number;
|
|
193
|
+
failed: number;
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
interface EncryptedPayload {
|
|
197
|
+
ciphertext: string;
|
|
198
|
+
iv: string;
|
|
199
|
+
tag: string;
|
|
200
|
+
algorithm: string;
|
|
201
|
+
}
|
|
202
|
+
interface FingerprintComponents {
|
|
203
|
+
model_family: string;
|
|
204
|
+
core_purpose: string;
|
|
205
|
+
creator_identifier: string;
|
|
206
|
+
}
|
|
207
|
+
interface ImprintClientConfig {
|
|
208
|
+
apiKey: string;
|
|
209
|
+
baseUrl?: string;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
declare class AgentsResource {
|
|
213
|
+
private readonly http;
|
|
214
|
+
constructor(http: HttpClient);
|
|
215
|
+
create(params: CreateAgentParams): Promise<Agent>;
|
|
216
|
+
list(): Promise<Agent[]>;
|
|
217
|
+
get(uuid: string): Promise<Agent>;
|
|
218
|
+
discover(fingerprint: string): Promise<DiscoverResult>;
|
|
219
|
+
generateKey(uuid: string): Promise<GenerateKeyResult>;
|
|
220
|
+
splitKey(uuid: string, params: SplitKeyParams): Promise<SplitKeyResult>;
|
|
221
|
+
recoverKey(uuid: string, shares: string[]): Promise<RecoverKeyResult>;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
declare class EntriesResource {
|
|
225
|
+
private readonly http;
|
|
226
|
+
constructor(http: HttpClient);
|
|
227
|
+
list(vaultUuid: string, params?: ListEntriesParams): Promise<PaginatedEntries>;
|
|
228
|
+
create(vaultUuid: string, entry: CreateEntryParams): Promise<Entry>;
|
|
229
|
+
createBulk(vaultUuid: string, entries: CreateEntryParams[]): Promise<BulkResult>;
|
|
230
|
+
get(vaultUuid: string, entryUuid: string): Promise<Entry>;
|
|
231
|
+
update(vaultUuid: string, entryUuid: string, data: UpdateEntryParams): Promise<Entry>;
|
|
232
|
+
delete(vaultUuid: string, entryUuid: string): Promise<void>;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
declare class OrganizationsResource {
|
|
236
|
+
private readonly http;
|
|
237
|
+
constructor(http: HttpClient);
|
|
238
|
+
create(name: string): Promise<OrganizationWithKey>;
|
|
239
|
+
get(uuid: string): Promise<Organization>;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
declare class VaultsResource {
|
|
243
|
+
private readonly http;
|
|
244
|
+
constructor(http: HttpClient);
|
|
245
|
+
create(params: CreateVaultParams): Promise<Vault>;
|
|
246
|
+
list(): Promise<Vault[]>;
|
|
247
|
+
get(uuid: string): Promise<Vault>;
|
|
248
|
+
stats(uuid: string): Promise<VaultStats>;
|
|
249
|
+
export(uuid: string): Promise<VaultExport>;
|
|
250
|
+
import(uuid: string, data: VaultExport): Promise<ImportResult>;
|
|
251
|
+
merkle(uuid: string): Promise<MerkleInfo>;
|
|
252
|
+
verify(uuid: string): Promise<VerifyResult>;
|
|
253
|
+
snapshot(uuid: string): Promise<Snapshot>;
|
|
254
|
+
snapshots(uuid: string): Promise<Snapshot[]>;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
declare const DEFAULT_BASE_URL = "https://api.agentimprint.io";
|
|
258
|
+
/**
|
|
259
|
+
* ImprintClient — main entry point for the Agent Imprint SDK.
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```ts
|
|
263
|
+
* const client = new ImprintClient({ apiKey: 'your-api-key' });
|
|
264
|
+
* const agents = await client.agents.list();
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
declare class ImprintClient {
|
|
268
|
+
readonly organizations: OrganizationsResource;
|
|
269
|
+
readonly agents: AgentsResource;
|
|
270
|
+
readonly vaults: VaultsResource;
|
|
271
|
+
readonly entries: EntriesResource;
|
|
272
|
+
private readonly http;
|
|
273
|
+
/**
|
|
274
|
+
* Public discovery — check if an agent fingerprint exists (no auth required).
|
|
275
|
+
* Uses the unauthenticated /api/v1/discover endpoint.
|
|
276
|
+
*/
|
|
277
|
+
static probe(fingerprint: string, baseUrl?: string): Promise<{
|
|
278
|
+
exists: boolean;
|
|
279
|
+
}>;
|
|
280
|
+
constructor(config: ImprintClientConfig);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
declare class ImprintApiError extends Error {
|
|
284
|
+
readonly status: number;
|
|
285
|
+
readonly code: string | undefined;
|
|
286
|
+
readonly body: unknown;
|
|
287
|
+
constructor(message: string, status: number, body?: unknown, code?: string);
|
|
288
|
+
}
|
|
289
|
+
declare class ImprintValidationError extends ImprintApiError {
|
|
290
|
+
readonly errors: Record<string, string[]>;
|
|
291
|
+
constructor(message: string, errors: Record<string, string[]>, body?: unknown);
|
|
292
|
+
}
|
|
293
|
+
declare class ImprintAuthError extends ImprintApiError {
|
|
294
|
+
constructor(message?: string, body?: unknown);
|
|
295
|
+
}
|
|
296
|
+
declare class ImprintNotFoundError extends ImprintApiError {
|
|
297
|
+
constructor(message?: string, body?: unknown);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Compute a deterministic agent fingerprint that matches the server-side algorithm.
|
|
302
|
+
*
|
|
303
|
+
* Algorithm: sha256(model_family + sha256(core_purpose) + creator_identifier)
|
|
304
|
+
*/
|
|
305
|
+
declare function computeFingerprint(params: FingerprintComponents): Promise<string>;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Generate a cryptographically secure random 256-bit key (64 hex chars).
|
|
309
|
+
*/
|
|
310
|
+
declare function generateKey(): string;
|
|
311
|
+
/**
|
|
312
|
+
* Derive a vault-specific key from a master key and vault UUID.
|
|
313
|
+
*/
|
|
314
|
+
declare function deriveVaultKey(masterKey: string, vaultUuid: string): Promise<string>;
|
|
315
|
+
/**
|
|
316
|
+
* Derive an entry-specific key from a vault key and entry UUID.
|
|
317
|
+
*/
|
|
318
|
+
declare function deriveEntryKey(vaultKey: string, entryUuid: string): Promise<string>;
|
|
319
|
+
/**
|
|
320
|
+
* Encrypt a JSON-serializable object with AES-256-GCM.
|
|
321
|
+
* Returns an EncryptedPayload with ciphertext, iv, and tag (all hex-encoded).
|
|
322
|
+
*/
|
|
323
|
+
declare function encrypt(keyHex: string, data: object): Promise<EncryptedPayload>;
|
|
324
|
+
/**
|
|
325
|
+
* Decrypt an EncryptedPayload back to the original object.
|
|
326
|
+
*/
|
|
327
|
+
declare function decrypt(keyHex: string, payload: EncryptedPayload): Promise<object>;
|
|
328
|
+
|
|
329
|
+
export { type Agent, type BulkResult, type CreateAgentParams, type CreateEntryParams, type CreateVaultParams, DEFAULT_BASE_URL, type DiscoverResult, type EncryptedPayload, type Entry, type FingerprintComponents, type GenerateKeyResult, type ImportResult, ImprintApiError, ImprintAuthError, ImprintClient, type ImprintClientConfig, ImprintNotFoundError, ImprintValidationError, type ListEntriesParams, type MerkleInfo, type Organization, type OrganizationWithKey, type PaginatedEntries, type RecoverKeyResult, type Snapshot, type SplitKeyParams, type SplitKeyResult, type UpdateEntryParams, type Vault, type VaultExport, type VaultStats, type VerifyResult, computeFingerprint, decrypt, deriveEntryKey, deriveVaultKey, encrypt, generateKey };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
declare class HttpClient {
|
|
2
|
+
private readonly apiKey;
|
|
3
|
+
private readonly baseUrl;
|
|
4
|
+
constructor(apiKey: string, baseUrl: string);
|
|
5
|
+
private buildUrl;
|
|
6
|
+
private request;
|
|
7
|
+
private throwError;
|
|
8
|
+
get<T>(path: string, params?: Record<string, string | number | boolean | undefined>, requiresAuth?: boolean): Promise<T>;
|
|
9
|
+
post<T>(path: string, body?: unknown, requiresAuth?: boolean): Promise<T>;
|
|
10
|
+
put<T>(path: string, body?: unknown): Promise<T>;
|
|
11
|
+
delete<T>(path: string): Promise<T>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface Organization {
|
|
15
|
+
uuid: string;
|
|
16
|
+
name: string;
|
|
17
|
+
slug: string;
|
|
18
|
+
tier: string;
|
|
19
|
+
is_active: boolean;
|
|
20
|
+
created_at: string;
|
|
21
|
+
updated_at: string;
|
|
22
|
+
}
|
|
23
|
+
interface OrganizationWithKey extends Organization {
|
|
24
|
+
apiKey: string;
|
|
25
|
+
}
|
|
26
|
+
interface Agent {
|
|
27
|
+
uuid: string;
|
|
28
|
+
name: string;
|
|
29
|
+
model_family: string;
|
|
30
|
+
core_purpose: string;
|
|
31
|
+
creator_identifier: string;
|
|
32
|
+
fingerprint: string;
|
|
33
|
+
version: string;
|
|
34
|
+
capabilities: string[];
|
|
35
|
+
meta: Record<string, unknown>;
|
|
36
|
+
is_active: boolean;
|
|
37
|
+
organization_uuid: string;
|
|
38
|
+
created_at: string;
|
|
39
|
+
updated_at: string;
|
|
40
|
+
}
|
|
41
|
+
interface CreateAgentParams {
|
|
42
|
+
name: string;
|
|
43
|
+
model_family: string;
|
|
44
|
+
core_purpose: string;
|
|
45
|
+
creator_identifier: string;
|
|
46
|
+
version?: string;
|
|
47
|
+
capabilities?: string[];
|
|
48
|
+
meta?: Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
interface DiscoverResult {
|
|
51
|
+
uuid: string;
|
|
52
|
+
name: string;
|
|
53
|
+
fingerprint: string;
|
|
54
|
+
model_family: string;
|
|
55
|
+
organization_uuid: string;
|
|
56
|
+
created_at: string;
|
|
57
|
+
}
|
|
58
|
+
interface GenerateKeyResult {
|
|
59
|
+
key: string;
|
|
60
|
+
}
|
|
61
|
+
interface SplitKeyParams {
|
|
62
|
+
shares: number;
|
|
63
|
+
threshold: number;
|
|
64
|
+
}
|
|
65
|
+
interface SplitKeyResult {
|
|
66
|
+
shares: string[];
|
|
67
|
+
}
|
|
68
|
+
interface RecoverKeyResult {
|
|
69
|
+
key: string;
|
|
70
|
+
}
|
|
71
|
+
interface Vault {
|
|
72
|
+
uuid: string;
|
|
73
|
+
name: string;
|
|
74
|
+
description: string | null;
|
|
75
|
+
agent_uuid: string;
|
|
76
|
+
organization_uuid: string;
|
|
77
|
+
encryption_algorithm: string;
|
|
78
|
+
compression_enabled: boolean;
|
|
79
|
+
entry_count: number;
|
|
80
|
+
is_active: boolean;
|
|
81
|
+
created_at: string;
|
|
82
|
+
updated_at: string;
|
|
83
|
+
}
|
|
84
|
+
interface CreateVaultParams {
|
|
85
|
+
name: string;
|
|
86
|
+
agent_uuid: string;
|
|
87
|
+
description?: string;
|
|
88
|
+
encryption_algorithm?: string;
|
|
89
|
+
compression_enabled?: boolean;
|
|
90
|
+
}
|
|
91
|
+
interface VaultStats {
|
|
92
|
+
vault_uuid: string;
|
|
93
|
+
entry_count: number;
|
|
94
|
+
total_size_bytes: number;
|
|
95
|
+
encrypted_count: number;
|
|
96
|
+
unencrypted_count: number;
|
|
97
|
+
namespaces: string[];
|
|
98
|
+
created_at: string;
|
|
99
|
+
last_updated_at: string | null;
|
|
100
|
+
}
|
|
101
|
+
interface VaultExport {
|
|
102
|
+
vault: Vault;
|
|
103
|
+
entries: Entry[];
|
|
104
|
+
exported_at: string;
|
|
105
|
+
}
|
|
106
|
+
interface ImportResult {
|
|
107
|
+
imported: number;
|
|
108
|
+
skipped: number;
|
|
109
|
+
errors: string[];
|
|
110
|
+
}
|
|
111
|
+
interface MerkleInfo {
|
|
112
|
+
vault_uuid: string;
|
|
113
|
+
root_hash: string;
|
|
114
|
+
entry_count: number;
|
|
115
|
+
computed_at: string;
|
|
116
|
+
}
|
|
117
|
+
interface VerifyResult {
|
|
118
|
+
valid: boolean;
|
|
119
|
+
vault_uuid: string;
|
|
120
|
+
root_hash: string;
|
|
121
|
+
mismatched_entries: string[];
|
|
122
|
+
verified_at: string;
|
|
123
|
+
}
|
|
124
|
+
interface Snapshot {
|
|
125
|
+
uuid: string;
|
|
126
|
+
vault_uuid: string;
|
|
127
|
+
root_hash: string;
|
|
128
|
+
entry_count: number;
|
|
129
|
+
metadata: Record<string, unknown>;
|
|
130
|
+
created_at: string;
|
|
131
|
+
}
|
|
132
|
+
type EntryType = 'lesson' | 'heuristic' | 'fact' | 'preference' | 'pattern' | 'relationship' | 'negative' | 'procedural';
|
|
133
|
+
interface Entry {
|
|
134
|
+
uuid: string;
|
|
135
|
+
vault_uuid: string;
|
|
136
|
+
entry_type: EntryType;
|
|
137
|
+
content: Record<string, unknown>;
|
|
138
|
+
provenance: Record<string, unknown> | null;
|
|
139
|
+
confidence: number;
|
|
140
|
+
domain: string | null;
|
|
141
|
+
tags: string[];
|
|
142
|
+
is_encrypted: boolean;
|
|
143
|
+
pii_flags: string[] | null;
|
|
144
|
+
tombstoned_at: string | null;
|
|
145
|
+
created_at: string;
|
|
146
|
+
updated_at: string;
|
|
147
|
+
}
|
|
148
|
+
interface CreateEntryParams {
|
|
149
|
+
entry_type: EntryType;
|
|
150
|
+
content: Record<string, unknown>;
|
|
151
|
+
provenance?: Record<string, unknown>;
|
|
152
|
+
confidence?: number;
|
|
153
|
+
domain?: string;
|
|
154
|
+
tags?: string[];
|
|
155
|
+
is_encrypted?: boolean;
|
|
156
|
+
pii_flags?: string[];
|
|
157
|
+
}
|
|
158
|
+
interface UpdateEntryParams {
|
|
159
|
+
content?: Record<string, unknown>;
|
|
160
|
+
provenance?: Record<string, unknown>;
|
|
161
|
+
confidence?: number;
|
|
162
|
+
domain?: string;
|
|
163
|
+
tags?: string[];
|
|
164
|
+
pii_flags?: string[];
|
|
165
|
+
}
|
|
166
|
+
interface ListEntriesParams {
|
|
167
|
+
type?: EntryType;
|
|
168
|
+
domain?: string;
|
|
169
|
+
tag?: string;
|
|
170
|
+
q?: string;
|
|
171
|
+
include_tombstoned?: boolean;
|
|
172
|
+
page?: number;
|
|
173
|
+
per_page?: number;
|
|
174
|
+
}
|
|
175
|
+
interface PaginatedEntries {
|
|
176
|
+
entries: Entry[];
|
|
177
|
+
pagination: {
|
|
178
|
+
total: number;
|
|
179
|
+
per_page: number;
|
|
180
|
+
current_page: number;
|
|
181
|
+
last_page: number;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
interface BulkResult {
|
|
185
|
+
imported: string[];
|
|
186
|
+
failed: Array<{
|
|
187
|
+
index: number;
|
|
188
|
+
errors: Record<string, string[]>;
|
|
189
|
+
}>;
|
|
190
|
+
summary: {
|
|
191
|
+
total: number;
|
|
192
|
+
imported: number;
|
|
193
|
+
failed: number;
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
interface EncryptedPayload {
|
|
197
|
+
ciphertext: string;
|
|
198
|
+
iv: string;
|
|
199
|
+
tag: string;
|
|
200
|
+
algorithm: string;
|
|
201
|
+
}
|
|
202
|
+
interface FingerprintComponents {
|
|
203
|
+
model_family: string;
|
|
204
|
+
core_purpose: string;
|
|
205
|
+
creator_identifier: string;
|
|
206
|
+
}
|
|
207
|
+
interface ImprintClientConfig {
|
|
208
|
+
apiKey: string;
|
|
209
|
+
baseUrl?: string;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
declare class AgentsResource {
|
|
213
|
+
private readonly http;
|
|
214
|
+
constructor(http: HttpClient);
|
|
215
|
+
create(params: CreateAgentParams): Promise<Agent>;
|
|
216
|
+
list(): Promise<Agent[]>;
|
|
217
|
+
get(uuid: string): Promise<Agent>;
|
|
218
|
+
discover(fingerprint: string): Promise<DiscoverResult>;
|
|
219
|
+
generateKey(uuid: string): Promise<GenerateKeyResult>;
|
|
220
|
+
splitKey(uuid: string, params: SplitKeyParams): Promise<SplitKeyResult>;
|
|
221
|
+
recoverKey(uuid: string, shares: string[]): Promise<RecoverKeyResult>;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
declare class EntriesResource {
|
|
225
|
+
private readonly http;
|
|
226
|
+
constructor(http: HttpClient);
|
|
227
|
+
list(vaultUuid: string, params?: ListEntriesParams): Promise<PaginatedEntries>;
|
|
228
|
+
create(vaultUuid: string, entry: CreateEntryParams): Promise<Entry>;
|
|
229
|
+
createBulk(vaultUuid: string, entries: CreateEntryParams[]): Promise<BulkResult>;
|
|
230
|
+
get(vaultUuid: string, entryUuid: string): Promise<Entry>;
|
|
231
|
+
update(vaultUuid: string, entryUuid: string, data: UpdateEntryParams): Promise<Entry>;
|
|
232
|
+
delete(vaultUuid: string, entryUuid: string): Promise<void>;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
declare class OrganizationsResource {
|
|
236
|
+
private readonly http;
|
|
237
|
+
constructor(http: HttpClient);
|
|
238
|
+
create(name: string): Promise<OrganizationWithKey>;
|
|
239
|
+
get(uuid: string): Promise<Organization>;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
declare class VaultsResource {
|
|
243
|
+
private readonly http;
|
|
244
|
+
constructor(http: HttpClient);
|
|
245
|
+
create(params: CreateVaultParams): Promise<Vault>;
|
|
246
|
+
list(): Promise<Vault[]>;
|
|
247
|
+
get(uuid: string): Promise<Vault>;
|
|
248
|
+
stats(uuid: string): Promise<VaultStats>;
|
|
249
|
+
export(uuid: string): Promise<VaultExport>;
|
|
250
|
+
import(uuid: string, data: VaultExport): Promise<ImportResult>;
|
|
251
|
+
merkle(uuid: string): Promise<MerkleInfo>;
|
|
252
|
+
verify(uuid: string): Promise<VerifyResult>;
|
|
253
|
+
snapshot(uuid: string): Promise<Snapshot>;
|
|
254
|
+
snapshots(uuid: string): Promise<Snapshot[]>;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
declare const DEFAULT_BASE_URL = "https://api.agentimprint.io";
|
|
258
|
+
/**
|
|
259
|
+
* ImprintClient — main entry point for the Agent Imprint SDK.
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```ts
|
|
263
|
+
* const client = new ImprintClient({ apiKey: 'your-api-key' });
|
|
264
|
+
* const agents = await client.agents.list();
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
declare class ImprintClient {
|
|
268
|
+
readonly organizations: OrganizationsResource;
|
|
269
|
+
readonly agents: AgentsResource;
|
|
270
|
+
readonly vaults: VaultsResource;
|
|
271
|
+
readonly entries: EntriesResource;
|
|
272
|
+
private readonly http;
|
|
273
|
+
/**
|
|
274
|
+
* Public discovery — check if an agent fingerprint exists (no auth required).
|
|
275
|
+
* Uses the unauthenticated /api/v1/discover endpoint.
|
|
276
|
+
*/
|
|
277
|
+
static probe(fingerprint: string, baseUrl?: string): Promise<{
|
|
278
|
+
exists: boolean;
|
|
279
|
+
}>;
|
|
280
|
+
constructor(config: ImprintClientConfig);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
declare class ImprintApiError extends Error {
|
|
284
|
+
readonly status: number;
|
|
285
|
+
readonly code: string | undefined;
|
|
286
|
+
readonly body: unknown;
|
|
287
|
+
constructor(message: string, status: number, body?: unknown, code?: string);
|
|
288
|
+
}
|
|
289
|
+
declare class ImprintValidationError extends ImprintApiError {
|
|
290
|
+
readonly errors: Record<string, string[]>;
|
|
291
|
+
constructor(message: string, errors: Record<string, string[]>, body?: unknown);
|
|
292
|
+
}
|
|
293
|
+
declare class ImprintAuthError extends ImprintApiError {
|
|
294
|
+
constructor(message?: string, body?: unknown);
|
|
295
|
+
}
|
|
296
|
+
declare class ImprintNotFoundError extends ImprintApiError {
|
|
297
|
+
constructor(message?: string, body?: unknown);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Compute a deterministic agent fingerprint that matches the server-side algorithm.
|
|
302
|
+
*
|
|
303
|
+
* Algorithm: sha256(model_family + sha256(core_purpose) + creator_identifier)
|
|
304
|
+
*/
|
|
305
|
+
declare function computeFingerprint(params: FingerprintComponents): Promise<string>;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Generate a cryptographically secure random 256-bit key (64 hex chars).
|
|
309
|
+
*/
|
|
310
|
+
declare function generateKey(): string;
|
|
311
|
+
/**
|
|
312
|
+
* Derive a vault-specific key from a master key and vault UUID.
|
|
313
|
+
*/
|
|
314
|
+
declare function deriveVaultKey(masterKey: string, vaultUuid: string): Promise<string>;
|
|
315
|
+
/**
|
|
316
|
+
* Derive an entry-specific key from a vault key and entry UUID.
|
|
317
|
+
*/
|
|
318
|
+
declare function deriveEntryKey(vaultKey: string, entryUuid: string): Promise<string>;
|
|
319
|
+
/**
|
|
320
|
+
* Encrypt a JSON-serializable object with AES-256-GCM.
|
|
321
|
+
* Returns an EncryptedPayload with ciphertext, iv, and tag (all hex-encoded).
|
|
322
|
+
*/
|
|
323
|
+
declare function encrypt(keyHex: string, data: object): Promise<EncryptedPayload>;
|
|
324
|
+
/**
|
|
325
|
+
* Decrypt an EncryptedPayload back to the original object.
|
|
326
|
+
*/
|
|
327
|
+
declare function decrypt(keyHex: string, payload: EncryptedPayload): Promise<object>;
|
|
328
|
+
|
|
329
|
+
export { type Agent, type BulkResult, type CreateAgentParams, type CreateEntryParams, type CreateVaultParams, DEFAULT_BASE_URL, type DiscoverResult, type EncryptedPayload, type Entry, type FingerprintComponents, type GenerateKeyResult, type ImportResult, ImprintApiError, ImprintAuthError, ImprintClient, type ImprintClientConfig, ImprintNotFoundError, ImprintValidationError, type ListEntriesParams, type MerkleInfo, type Organization, type OrganizationWithKey, type PaginatedEntries, type RecoverKeyResult, type Snapshot, type SplitKeyParams, type SplitKeyResult, type UpdateEntryParams, type Vault, type VaultExport, type VaultStats, type VerifyResult, computeFingerprint, decrypt, deriveEntryKey, deriveVaultKey, encrypt, generateKey };
|