@forg3t/sdk 0.1.3 → 0.1.5
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 +400 -63
- package/dist/index.d.mts +536 -15
- package/dist/index.d.ts +536 -15
- package/dist/index.js +1132 -39
- package/dist/index.mjs +1104 -45
- package/package.json +56 -49
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface Forg3tClientOptions {
|
|
2
2
|
apiUrl?: string;
|
|
3
3
|
apiKey?: string;
|
|
4
|
+
bearerToken?: string;
|
|
4
5
|
timeoutMs?: number;
|
|
5
6
|
}
|
|
6
7
|
interface PaginationParams {
|
|
@@ -15,6 +16,57 @@ interface Project {
|
|
|
15
16
|
createdAt: string;
|
|
16
17
|
updatedAt: string;
|
|
17
18
|
}
|
|
19
|
+
interface CurrentUserResponse {
|
|
20
|
+
userId: string | null;
|
|
21
|
+
email: string | null;
|
|
22
|
+
tenantId: string;
|
|
23
|
+
defaultProjectId: string | null;
|
|
24
|
+
projectsCount: number;
|
|
25
|
+
projectName?: string;
|
|
26
|
+
}
|
|
27
|
+
interface BootstrapTenantRequest {
|
|
28
|
+
tenantName: string;
|
|
29
|
+
projectName?: string;
|
|
30
|
+
integrationType?: string;
|
|
31
|
+
integrationName?: string;
|
|
32
|
+
dataRetentionDays?: number | null;
|
|
33
|
+
regulatoryScope?: unknown;
|
|
34
|
+
}
|
|
35
|
+
interface BootstrapTenantResponse {
|
|
36
|
+
created: boolean;
|
|
37
|
+
tenant: {
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
|
+
status: string;
|
|
41
|
+
regulatoryScope: unknown;
|
|
42
|
+
createdAt: string;
|
|
43
|
+
};
|
|
44
|
+
membership: {
|
|
45
|
+
userId: string;
|
|
46
|
+
email: string | null;
|
|
47
|
+
role: string;
|
|
48
|
+
};
|
|
49
|
+
bootstrap: {
|
|
50
|
+
tenantId: string;
|
|
51
|
+
project: {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
created: boolean;
|
|
55
|
+
};
|
|
56
|
+
apiKey: {
|
|
57
|
+
id: string;
|
|
58
|
+
keyPrefix: string;
|
|
59
|
+
created: boolean;
|
|
60
|
+
plaintextKey?: string;
|
|
61
|
+
};
|
|
62
|
+
integration: {
|
|
63
|
+
id: string;
|
|
64
|
+
type: string;
|
|
65
|
+
name: string;
|
|
66
|
+
created: boolean;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
}
|
|
18
70
|
interface ApiKey {
|
|
19
71
|
id: string;
|
|
20
72
|
name: string;
|
|
@@ -30,7 +82,12 @@ interface CreateApiKeyRequest {
|
|
|
30
82
|
expiresAt?: string;
|
|
31
83
|
}
|
|
32
84
|
interface CreateApiKeyResponse extends ApiKey {
|
|
33
|
-
|
|
85
|
+
key: string;
|
|
86
|
+
plaintextKey?: string;
|
|
87
|
+
}
|
|
88
|
+
interface RevokeApiKeyResponse {
|
|
89
|
+
status: 'revoked' | string;
|
|
90
|
+
revokedAt?: string | null;
|
|
34
91
|
}
|
|
35
92
|
interface AuditEvent {
|
|
36
93
|
id: string;
|
|
@@ -55,8 +112,8 @@ interface AuditEventListResponse {
|
|
|
55
112
|
events: AuditEvent[];
|
|
56
113
|
nextCursor?: string;
|
|
57
114
|
}
|
|
58
|
-
type JobStatus = 'queued' | 'running' | '
|
|
59
|
-
type JobType = 'VERIFY' | 'RAG_UNLEARN' | 'ADAPTER_UNLEARN' | 'MODEL_UNLEARN';
|
|
115
|
+
type JobStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'canceled';
|
|
116
|
+
type JobType = 'VERIFY' | 'BLACKBOX_SUPPRESS' | 'RAG_UNLEARN' | 'ADAPTER_UNLEARN' | 'MODEL_UNLEARN';
|
|
60
117
|
type ClaimType = 'PII' | 'CONCEPT' | 'ENTITY' | 'DOCUMENT' | 'EMBEDDING_CLUSTER';
|
|
61
118
|
type ClaimScope = 'global' | 'project' | 'tenant' | 'adapter' | 'index';
|
|
62
119
|
type ClaimAssertion = 'must_not_be_recalled' | 'must_be_refused' | 'must_return_null';
|
|
@@ -76,6 +133,7 @@ interface JobConfig {
|
|
|
76
133
|
interface Job {
|
|
77
134
|
id: string;
|
|
78
135
|
projectId: string;
|
|
136
|
+
tenantId?: string;
|
|
79
137
|
type: JobType;
|
|
80
138
|
status: JobStatus;
|
|
81
139
|
payload: {
|
|
@@ -88,24 +146,51 @@ interface Job {
|
|
|
88
146
|
false_positive_rate?: number;
|
|
89
147
|
[key: string]: any;
|
|
90
148
|
} | null;
|
|
91
|
-
|
|
92
|
-
|
|
149
|
+
createdAt?: string;
|
|
150
|
+
updatedAt?: string;
|
|
151
|
+
startedAt?: string | null;
|
|
152
|
+
completedAt?: string | null;
|
|
153
|
+
workerId?: string | null;
|
|
154
|
+
lastClaimId?: string | null;
|
|
155
|
+
leaseExpiresAt?: string | null;
|
|
156
|
+
heartbeatAt?: string | null;
|
|
157
|
+
nextClaimAfter?: string | null;
|
|
158
|
+
attempts?: number;
|
|
159
|
+
maxAttempts?: number;
|
|
160
|
+
error?: string | null;
|
|
161
|
+
created_at?: string;
|
|
162
|
+
updated_at?: string;
|
|
93
163
|
started_at?: string | null;
|
|
94
164
|
completed_at?: string | null;
|
|
95
165
|
}
|
|
96
|
-
|
|
166
|
+
type SubmitJobRequest = {
|
|
97
167
|
type: JobType;
|
|
98
168
|
claim: UnlearningClaim;
|
|
99
169
|
config: JobConfig;
|
|
100
|
-
|
|
170
|
+
idempotencyKey?: string;
|
|
171
|
+
} | {
|
|
172
|
+
type: JobType;
|
|
173
|
+
payload: {
|
|
174
|
+
claim?: UnlearningClaim;
|
|
175
|
+
config?: JobConfig;
|
|
176
|
+
[key: string]: unknown;
|
|
177
|
+
};
|
|
178
|
+
idempotencyKey?: string;
|
|
179
|
+
};
|
|
101
180
|
interface ClaimJobsRequest {
|
|
102
181
|
limit?: number;
|
|
182
|
+
types?: JobType[];
|
|
103
183
|
}
|
|
104
184
|
interface JobResult {
|
|
105
185
|
result: Record<string, unknown>;
|
|
186
|
+
claimId?: string;
|
|
106
187
|
}
|
|
107
188
|
interface JobError {
|
|
108
189
|
error: Record<string, unknown>;
|
|
190
|
+
claimId?: string;
|
|
191
|
+
}
|
|
192
|
+
interface JobMutationOptions {
|
|
193
|
+
claimId?: string;
|
|
109
194
|
}
|
|
110
195
|
interface Webhook {
|
|
111
196
|
id: string;
|
|
@@ -153,6 +238,20 @@ interface EvidenceArtifact {
|
|
|
153
238
|
createdAt: string;
|
|
154
239
|
artifacts: unknown[];
|
|
155
240
|
}
|
|
241
|
+
interface EvidenceStatusResponse {
|
|
242
|
+
jobId: string;
|
|
243
|
+
status: string;
|
|
244
|
+
evidenceReady: boolean;
|
|
245
|
+
retryAfterSeconds?: number;
|
|
246
|
+
reportHash?: string;
|
|
247
|
+
evidenceJsonHash?: string;
|
|
248
|
+
evidence?: Record<string, unknown>;
|
|
249
|
+
error?: string;
|
|
250
|
+
errorCode?: string;
|
|
251
|
+
errorMessage?: string | null;
|
|
252
|
+
failedAt?: string | null;
|
|
253
|
+
durationMs?: number | null;
|
|
254
|
+
}
|
|
156
255
|
interface EvidencePdfResponse {
|
|
157
256
|
data: Uint8Array;
|
|
158
257
|
headers: {
|
|
@@ -161,37 +260,200 @@ interface EvidencePdfResponse {
|
|
|
161
260
|
'x-forg3t-report-hash': string;
|
|
162
261
|
};
|
|
163
262
|
}
|
|
263
|
+
declare enum IntegrationType {
|
|
264
|
+
SLACK = "slack",
|
|
265
|
+
CONFLUENCE = "confluence",
|
|
266
|
+
GOOGLE_DRIVE = "google_drive",
|
|
267
|
+
ZENDESK = "zendesk",
|
|
268
|
+
NOTION = "notion",
|
|
269
|
+
LANGCHAIN = "langchain",
|
|
270
|
+
OPENROUTER = "openrouter",
|
|
271
|
+
OPENAI = "openai",
|
|
272
|
+
CUSTOM = "custom"
|
|
273
|
+
}
|
|
274
|
+
declare enum IntegrationMode {
|
|
275
|
+
MODE_A_BLACKBOX = "mode_a_blackbox",// System level (RAG/Deletion)
|
|
276
|
+
MODE_B_WHITEBOX = "mode_b_whitebox"
|
|
277
|
+
}
|
|
278
|
+
interface BaseAdapterConfig {
|
|
279
|
+
adapterId?: string;
|
|
280
|
+
modelName?: string;
|
|
281
|
+
temperature?: number;
|
|
282
|
+
integrationMode?: IntegrationMode;
|
|
283
|
+
[key: string]: unknown;
|
|
284
|
+
}
|
|
285
|
+
interface LangChainAdapterConfig extends BaseAdapterConfig {
|
|
286
|
+
chainType: 'retrieval' | 'conversational' | 'agent';
|
|
287
|
+
vectorStoreId?: string;
|
|
288
|
+
}
|
|
289
|
+
interface OpenRouterAdapterConfig extends BaseAdapterConfig {
|
|
290
|
+
routingStrategy: 'cost' | 'latency' | 'quality';
|
|
291
|
+
fallbackModels?: string[];
|
|
292
|
+
}
|
|
293
|
+
interface Integration {
|
|
294
|
+
id: string;
|
|
295
|
+
projectId: string;
|
|
296
|
+
type: IntegrationType;
|
|
297
|
+
name: string;
|
|
298
|
+
description?: string;
|
|
299
|
+
status: 'active' | 'disconnected' | 'error' | 'pending';
|
|
300
|
+
config: BaseAdapterConfig | LangChainAdapterConfig | OpenRouterAdapterConfig | Record<string, unknown>;
|
|
301
|
+
capabilities: string[];
|
|
302
|
+
createdAt: string;
|
|
303
|
+
updatedAt: string;
|
|
304
|
+
lastSyncedAt?: string;
|
|
305
|
+
}
|
|
306
|
+
interface CreateIntegrationRequest {
|
|
307
|
+
type: IntegrationType;
|
|
308
|
+
name: string;
|
|
309
|
+
config: Record<string, unknown>;
|
|
310
|
+
}
|
|
311
|
+
declare enum AccessLevel {
|
|
312
|
+
LAYER_A_ONLY = "layer_a_only",// Control-plane actions (black-box suppression, gateway/policy enforcement)
|
|
313
|
+
LAYER_A_AND_B = "layer_a_and_b"
|
|
314
|
+
}
|
|
315
|
+
interface UnlearningTarget {
|
|
316
|
+
type: 'user_id' | 'email' | 'document_id' | 'phrase' | 'concept';
|
|
317
|
+
value: string;
|
|
318
|
+
aliases?: string[];
|
|
319
|
+
}
|
|
320
|
+
interface UnlearningScope {
|
|
321
|
+
integrationIds?: string[];
|
|
322
|
+
}
|
|
323
|
+
interface ExecutionStep {
|
|
324
|
+
id: string;
|
|
325
|
+
name: string;
|
|
326
|
+
layer: 'A' | 'B';
|
|
327
|
+
status: 'pending' | 'running' | 'completed' | 'failed' | 'skipped';
|
|
328
|
+
logs: string[];
|
|
329
|
+
startedAt?: string;
|
|
330
|
+
completedAt?: string;
|
|
331
|
+
}
|
|
332
|
+
interface ExecutionPlan {
|
|
333
|
+
steps: ExecutionStep[];
|
|
334
|
+
estimatedDurationMs?: number;
|
|
335
|
+
}
|
|
336
|
+
interface UnlearningExecutionModelRef {
|
|
337
|
+
uri: string;
|
|
338
|
+
format?: string;
|
|
339
|
+
sha256?: string;
|
|
340
|
+
version?: string;
|
|
341
|
+
metadata?: Record<string, unknown>;
|
|
342
|
+
}
|
|
343
|
+
interface UnlearningExecutionPlanSpec {
|
|
344
|
+
method: string;
|
|
345
|
+
hyperparameters?: Record<string, unknown>;
|
|
346
|
+
dryRun?: boolean;
|
|
347
|
+
}
|
|
348
|
+
interface UnlearningExecutionTargetSpec {
|
|
349
|
+
provider: 'openai' | 'groq' | 'http_generic' | 'custom';
|
|
350
|
+
model?: string;
|
|
351
|
+
endpoint?: string;
|
|
352
|
+
headers?: Record<string, string>;
|
|
353
|
+
responsePath?: string;
|
|
354
|
+
apiKey?: string;
|
|
355
|
+
}
|
|
356
|
+
interface UnlearningExecutionSpec {
|
|
357
|
+
target?: UnlearningExecutionTargetSpec;
|
|
358
|
+
model?: UnlearningExecutionModelRef;
|
|
359
|
+
plan?: UnlearningExecutionPlanSpec;
|
|
360
|
+
}
|
|
361
|
+
interface UnlearningJobSummary {
|
|
362
|
+
id: string;
|
|
363
|
+
type: JobType | string;
|
|
364
|
+
status: JobStatus | string;
|
|
365
|
+
createdAt?: string;
|
|
366
|
+
updatedAt?: string;
|
|
367
|
+
startedAt?: string | null;
|
|
368
|
+
completedAt?: string | null;
|
|
369
|
+
}
|
|
370
|
+
interface UnlearningRequest {
|
|
371
|
+
id: string;
|
|
372
|
+
projectId: string;
|
|
373
|
+
name?: string;
|
|
374
|
+
target: UnlearningTarget;
|
|
375
|
+
scope: UnlearningScope;
|
|
376
|
+
accessLevel: AccessLevel;
|
|
377
|
+
status: 'draft' | 'submitted' | 'processing' | 'completed' | 'failed';
|
|
378
|
+
rawStatus?: string;
|
|
379
|
+
execution?: UnlearningExecutionSpec;
|
|
380
|
+
job?: UnlearningJobSummary | null;
|
|
381
|
+
plan?: ExecutionPlan;
|
|
382
|
+
evidenceArtifacts: string[];
|
|
383
|
+
createdAt: string;
|
|
384
|
+
updatedAt: string;
|
|
385
|
+
}
|
|
386
|
+
interface CreateUnlearningRequestParams {
|
|
387
|
+
name?: string;
|
|
388
|
+
target: UnlearningTarget;
|
|
389
|
+
scope: UnlearningScope;
|
|
390
|
+
accessLevel: AccessLevel;
|
|
391
|
+
execution?: UnlearningExecutionSpec;
|
|
392
|
+
}
|
|
164
393
|
|
|
165
394
|
declare class Forg3tClient {
|
|
166
395
|
private transport;
|
|
167
396
|
constructor(options?: Forg3tClientOptions);
|
|
397
|
+
/**
|
|
398
|
+
* Get the current user context and their default project.
|
|
399
|
+
* Used by the Admin Dashboard for bootstrap and session verification.
|
|
400
|
+
*/
|
|
401
|
+
getCurrentUser(requestId?: string): Promise<CurrentUserResponse>;
|
|
402
|
+
/**
|
|
403
|
+
* Bootstraps a tenant for an authenticated dashboard user.
|
|
404
|
+
* Requires a bearer token from the user's session instead of an API key.
|
|
405
|
+
*/
|
|
406
|
+
bootstrapTenant(data: BootstrapTenantRequest, requestId?: string): Promise<BootstrapTenantResponse>;
|
|
168
407
|
getProjectOverview(projectId: string, requestId?: string): Promise<Project>;
|
|
169
408
|
listAuditEvents(projectId: string, filters?: AuditEventFilters, requestId?: string): Promise<AuditEventListResponse>;
|
|
409
|
+
listIntegrations(projectId: string, requestId?: string): Promise<Integration[]>;
|
|
410
|
+
createIntegration(projectId: string, data: CreateIntegrationRequest, requestId?: string): Promise<Integration>;
|
|
411
|
+
testIntegration(projectId: string, integrationId: string, requestId?: string): Promise<{
|
|
412
|
+
success: boolean;
|
|
413
|
+
message?: string;
|
|
414
|
+
}>;
|
|
415
|
+
createUnlearningRequest(projectId: string, data: CreateUnlearningRequestParams, requestId?: string): Promise<UnlearningRequest>;
|
|
416
|
+
listUnlearningRequests(projectId: string, requestId?: string): Promise<UnlearningRequest[]>;
|
|
417
|
+
getUnlearningRequest(projectId: string, unlearningRequestId: string, requestId?: string): Promise<UnlearningRequest>;
|
|
170
418
|
listApiKeys(projectId: string, requestId?: string): Promise<ApiKey[]>;
|
|
171
419
|
createApiKey(projectId: string, data: CreateApiKeyRequest, requestId?: string): Promise<CreateApiKeyResponse>;
|
|
172
|
-
rotateApiKey(keyId: string, requestId?: string): Promise<CreateApiKeyResponse>;
|
|
173
|
-
revokeApiKey(keyId: string, requestId?: string): Promise<
|
|
420
|
+
rotateApiKey(projectId: string, keyId: string, requestId?: string): Promise<CreateApiKeyResponse>;
|
|
421
|
+
revokeApiKey(projectId: string, keyId: string, requestId?: string): Promise<RevokeApiKeyResponse>;
|
|
174
422
|
submitJob(projectId: string, data: SubmitJobRequest, requestId?: string): Promise<Job>;
|
|
423
|
+
/**
|
|
424
|
+
* Creates a new job with deduplication support via an optional idempotency key.
|
|
425
|
+
* This wrapper cleanly exposes the core parameters for the production job queue.
|
|
426
|
+
*/
|
|
427
|
+
createJob(projectId: string, type: JobType, claim: UnlearningClaim, config: JobConfig, idempotencyKey?: string, requestId?: string): Promise<Job>;
|
|
175
428
|
getJob(projectId: string, jobId: string, requestId?: string): Promise<Job>;
|
|
429
|
+
/**
|
|
430
|
+
* Polls the job status continuously until a terminal state (succeeded, failed, canceled) is reached,
|
|
431
|
+
* or the specified timeout limits are exceeded.
|
|
432
|
+
*/
|
|
433
|
+
pollJobStatus(projectId: string, jobId: string, timeoutMs?: number, pollIntervalMs?: number, requestId?: string): Promise<Job>;
|
|
176
434
|
listJobs(projectId: string, query?: {
|
|
177
435
|
status?: string;
|
|
178
436
|
limit?: number;
|
|
179
437
|
offset?: number;
|
|
180
438
|
}, requestId?: string): Promise<Job[]>;
|
|
181
439
|
claimJobs(projectId: string, data?: ClaimJobsRequest, requestId?: string): Promise<Job[]>;
|
|
182
|
-
heartbeatJob(projectId: string, jobId: string, requestId?: string): Promise<Job>;
|
|
183
|
-
completeJob(projectId: string, jobId: string, result: JobResult, requestId?: string): Promise<Job>;
|
|
184
|
-
failJob(projectId: string, jobId: string, error: JobError, requestId?: string): Promise<Job>;
|
|
440
|
+
heartbeatJob(projectId: string, jobId: string, optionsOrRequestId?: JobMutationOptions | string, requestId?: string): Promise<Job>;
|
|
441
|
+
completeJob(projectId: string, jobId: string, result: JobResult, optionsOrRequestId?: JobMutationOptions | string, requestId?: string): Promise<Job>;
|
|
442
|
+
failJob(projectId: string, jobId: string, error: JobError, optionsOrRequestId?: JobMutationOptions | string, requestId?: string): Promise<Job>;
|
|
185
443
|
listDeadJobs(projectId: string, requestId?: string): Promise<Job[]>;
|
|
186
444
|
replayJob(projectId: string, jobId: string, requestId?: string): Promise<Job>;
|
|
187
|
-
getEvidence(jobId: string, requestId?: string): Promise<EvidenceArtifact>;
|
|
445
|
+
getEvidence(jobId: string, requestId?: string): Promise<EvidenceStatusResponse | EvidenceArtifact>;
|
|
446
|
+
getEvidenceJson(jobId: string, requestId?: string): Promise<Record<string, unknown>>;
|
|
447
|
+
getArtifactDownloadUrl(projectId: string, jobId: string, filename: string, requestId?: string): Promise<{
|
|
448
|
+
downloadUrl: string;
|
|
449
|
+
}>;
|
|
188
450
|
getEvidencePdf(jobId: string, options?: {
|
|
189
451
|
saveToPath?: string;
|
|
190
452
|
}): Promise<EvidencePdfResponse>;
|
|
191
453
|
private savePdfToFile;
|
|
192
454
|
/**
|
|
193
455
|
* @deprecated The current Control Plane version does not support direct artifact downloads.
|
|
194
|
-
* Please use
|
|
456
|
+
* Please use getArtifactDownloadUrl(), getEvidencePdf(), or getEvidenceJson().
|
|
195
457
|
*/
|
|
196
458
|
downloadEvidenceArtifact(_jobId: string, _requestId?: string): Promise<void>;
|
|
197
459
|
listWebhooks(projectId: string, requestId?: string): Promise<Webhook[]>;
|
|
@@ -216,6 +478,8 @@ declare class Forg3tClient {
|
|
|
216
478
|
report_hash: string;
|
|
217
479
|
false_positive_rate: number;
|
|
218
480
|
}, requestId?: string): Promise<void>;
|
|
481
|
+
private assertCreateUnlearningRequest;
|
|
482
|
+
private assertModelUnlearnPreflight;
|
|
219
483
|
}
|
|
220
484
|
|
|
221
485
|
declare class Forg3tError extends Error {
|
|
@@ -237,5 +501,262 @@ declare class Forg3tRateLimitError extends Forg3tError {
|
|
|
237
501
|
declare class Forg3tApiConnectionError extends Forg3tError {
|
|
238
502
|
constructor(message: string);
|
|
239
503
|
}
|
|
504
|
+
declare class Forg3tNotImplementedError extends Forg3tError {
|
|
505
|
+
constructor(message: string, endpoint?: string, requestId?: string);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
interface WhiteboxQualityGatePolicy {
|
|
509
|
+
/**
|
|
510
|
+
* Require an evaluation stage output from adapter.runEvaluation.
|
|
511
|
+
* If true and evaluation is missing, the quality gate fails.
|
|
512
|
+
*/
|
|
513
|
+
requireEvaluation?: boolean;
|
|
514
|
+
/**
|
|
515
|
+
* Maximum leak score accepted for automatic pass.
|
|
516
|
+
*/
|
|
517
|
+
maxLeakScore?: number;
|
|
518
|
+
/**
|
|
519
|
+
* Allowed evaluation verdicts for pass.
|
|
520
|
+
*/
|
|
521
|
+
allowedVerdicts?: Array<'PASS' | 'FAIL' | 'REVIEW'>;
|
|
522
|
+
/**
|
|
523
|
+
* Minimum number of tensors that must be modified by unlearning.
|
|
524
|
+
*/
|
|
525
|
+
minChangedTensorCount?: number;
|
|
526
|
+
/**
|
|
527
|
+
* Minimum number of parameters that must be modified by unlearning.
|
|
528
|
+
*/
|
|
529
|
+
minChangedParamCount?: number;
|
|
530
|
+
/**
|
|
531
|
+
* Require before/after model hash transition and mismatch.
|
|
532
|
+
*/
|
|
533
|
+
requireModelHashTransition?: boolean;
|
|
534
|
+
/**
|
|
535
|
+
* Require localization object from whitebox output.
|
|
536
|
+
*/
|
|
537
|
+
requireLocalization?: boolean;
|
|
538
|
+
/**
|
|
539
|
+
* Minimum localization token coverage in [0, 1].
|
|
540
|
+
*/
|
|
541
|
+
minLocalizationTokenCoverage?: number;
|
|
542
|
+
/**
|
|
543
|
+
* Minimum localized parameter count.
|
|
544
|
+
*/
|
|
545
|
+
minLocalizedParamCount?: number;
|
|
546
|
+
/**
|
|
547
|
+
* Minimum localization confidence in [0, 1].
|
|
548
|
+
*/
|
|
549
|
+
minLocalizationConfidence?: number;
|
|
550
|
+
}
|
|
551
|
+
interface WhiteboxQualityGateDecision {
|
|
552
|
+
pass: boolean;
|
|
553
|
+
reasons: string[];
|
|
554
|
+
policy: WhiteboxQualityGatePolicy;
|
|
555
|
+
}
|
|
556
|
+
type WhiteboxQualityGatePreset = 'balanced' | 'strict';
|
|
557
|
+
declare const WHITEBOX_QUALITY_GATE_PRESETS: Record<WhiteboxQualityGatePreset, Required<WhiteboxQualityGatePolicy>>;
|
|
558
|
+
declare const WHITEBOX_QUALITY_GATE_PRESET_EXPLANATIONS: Record<WhiteboxQualityGatePreset, string>;
|
|
559
|
+
declare const DEFAULT_WHITEBOX_QUALITY_GATE_POLICY: Required<WhiteboxQualityGatePolicy>;
|
|
560
|
+
declare const resolveWhiteboxQualityGatePolicy: (preset?: WhiteboxQualityGatePreset, overrides?: WhiteboxQualityGatePolicy) => WhiteboxQualityGatePolicy;
|
|
561
|
+
declare const evaluateWhiteboxQualityGate: (unlearning: WhiteboxUnlearningOutput, evaluation: WhiteboxEvaluationOutput | undefined, policyOverrides?: WhiteboxQualityGatePolicy) => WhiteboxQualityGateDecision;
|
|
562
|
+
|
|
563
|
+
interface ModelArtifactReference {
|
|
564
|
+
uri: string;
|
|
565
|
+
format?: string;
|
|
566
|
+
sha256?: string;
|
|
567
|
+
version?: string;
|
|
568
|
+
metadata?: Record<string, unknown>;
|
|
569
|
+
}
|
|
570
|
+
interface WhiteboxTargetSpec {
|
|
571
|
+
text?: string;
|
|
572
|
+
tokenIds?: number[];
|
|
573
|
+
aliases?: string[];
|
|
574
|
+
selector?: Record<string, unknown>;
|
|
575
|
+
}
|
|
576
|
+
interface WhiteboxUnlearningPlan {
|
|
577
|
+
method: string;
|
|
578
|
+
hyperparameters?: Record<string, unknown>;
|
|
579
|
+
dryRun?: boolean;
|
|
580
|
+
}
|
|
581
|
+
interface WhiteboxUnlearningInput {
|
|
582
|
+
model: ModelArtifactReference;
|
|
583
|
+
target: WhiteboxTargetSpec;
|
|
584
|
+
plan: WhiteboxUnlearningPlan;
|
|
585
|
+
claim: UnlearningClaim;
|
|
586
|
+
config: JobConfig;
|
|
587
|
+
}
|
|
588
|
+
interface WhiteboxUnlearningOutput {
|
|
589
|
+
updatedModel: ModelArtifactReference;
|
|
590
|
+
changedTensorCount: number;
|
|
591
|
+
changedParamCount?: number;
|
|
592
|
+
modelBeforeSha256?: string;
|
|
593
|
+
modelAfterSha256?: string;
|
|
594
|
+
localization?: {
|
|
595
|
+
strategy: string;
|
|
596
|
+
tokenIds: number[];
|
|
597
|
+
tokenCoverage?: number;
|
|
598
|
+
localizedTensorCount?: number;
|
|
599
|
+
localizedParamCount?: number;
|
|
600
|
+
confidence?: number;
|
|
601
|
+
aliasCount?: number;
|
|
602
|
+
candidateTextCount?: number;
|
|
603
|
+
localizationMode?: string;
|
|
604
|
+
reportUri?: string;
|
|
605
|
+
reportSha256?: string;
|
|
606
|
+
hits?: Array<{
|
|
607
|
+
tensor: string;
|
|
608
|
+
tensorRole?: string;
|
|
609
|
+
tokenId?: number;
|
|
610
|
+
token?: string;
|
|
611
|
+
tokenSourceKind?: string;
|
|
612
|
+
matchedFromTextSha256?: string;
|
|
613
|
+
rowIndex?: number;
|
|
614
|
+
rowParamCount?: number;
|
|
615
|
+
}>;
|
|
616
|
+
[key: string]: unknown;
|
|
617
|
+
};
|
|
618
|
+
metrics?: Record<string, unknown>;
|
|
619
|
+
artifacts?: Array<{
|
|
620
|
+
name: string;
|
|
621
|
+
uri: string;
|
|
622
|
+
sha256?: string;
|
|
623
|
+
sizeBytes?: number;
|
|
624
|
+
}>;
|
|
625
|
+
}
|
|
626
|
+
interface WhiteboxEvaluationInput {
|
|
627
|
+
model: ModelArtifactReference;
|
|
628
|
+
baselineModel?: ModelArtifactReference;
|
|
629
|
+
claim: UnlearningClaim;
|
|
630
|
+
probes?: string[];
|
|
631
|
+
config: JobConfig;
|
|
632
|
+
}
|
|
633
|
+
interface WhiteboxEvaluationOutput {
|
|
634
|
+
finalVerdict: 'PASS' | 'FAIL' | 'REVIEW';
|
|
635
|
+
leakScore: number;
|
|
636
|
+
details?: Record<string, unknown>;
|
|
637
|
+
}
|
|
638
|
+
interface WhiteboxJobContext {
|
|
639
|
+
projectId: string;
|
|
640
|
+
jobId: string;
|
|
641
|
+
correlationId?: string;
|
|
642
|
+
}
|
|
643
|
+
interface TrainingBackendAdapter {
|
|
644
|
+
name: string;
|
|
645
|
+
runUnlearning(input: WhiteboxUnlearningInput, context: WhiteboxJobContext): Promise<WhiteboxUnlearningOutput>;
|
|
646
|
+
runEvaluation?(input: WhiteboxEvaluationInput, context: WhiteboxJobContext): Promise<WhiteboxEvaluationOutput>;
|
|
647
|
+
}
|
|
648
|
+
interface WhiteboxWorkerLogger {
|
|
649
|
+
info(message: string, meta?: Record<string, unknown>): void;
|
|
650
|
+
warn(message: string, meta?: Record<string, unknown>): void;
|
|
651
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
652
|
+
}
|
|
653
|
+
interface WhiteboxWorkerOptions {
|
|
654
|
+
projectId: string;
|
|
655
|
+
pollIntervalMs?: number;
|
|
656
|
+
claimBatchSize?: number;
|
|
657
|
+
heartbeatIntervalMs?: number;
|
|
658
|
+
supportedJobTypes?: JobType[];
|
|
659
|
+
qualityGatePolicy?: WhiteboxQualityGatePolicy;
|
|
660
|
+
qualityGateOnFailure?: 'fail_job' | 'review';
|
|
661
|
+
/**
|
|
662
|
+
* Controls how claim payload is reflected back to control-plane result payload.
|
|
663
|
+
* `hash` (default): stores sha256 hash + length, no raw payload.
|
|
664
|
+
* `omit`: stores claim metadata but omits payload/hash.
|
|
665
|
+
* `raw`: stores original claim payload verbatim.
|
|
666
|
+
*/
|
|
667
|
+
resultClaimMode?: 'hash' | 'omit' | 'raw';
|
|
668
|
+
logger?: WhiteboxWorkerLogger;
|
|
669
|
+
}
|
|
670
|
+
interface BuildModelUnlearningJobInput {
|
|
671
|
+
claim: UnlearningClaim;
|
|
672
|
+
model: ModelArtifactReference;
|
|
673
|
+
target: WhiteboxTargetSpec;
|
|
674
|
+
plan: WhiteboxUnlearningPlan;
|
|
675
|
+
targetAdapter?: string;
|
|
676
|
+
sensitivity?: string;
|
|
677
|
+
extraParameters?: Record<string, unknown>;
|
|
678
|
+
}
|
|
679
|
+
declare const buildModelUnlearningPayload: (input: BuildModelUnlearningJobInput) => {
|
|
680
|
+
claim: UnlearningClaim;
|
|
681
|
+
config: JobConfig;
|
|
682
|
+
};
|
|
683
|
+
declare class WhiteboxWorker {
|
|
684
|
+
private readonly client;
|
|
685
|
+
private readonly adapter;
|
|
686
|
+
private readonly options;
|
|
687
|
+
private running;
|
|
688
|
+
private loopPromise;
|
|
689
|
+
private readonly pollIntervalMs;
|
|
690
|
+
private readonly claimBatchSize;
|
|
691
|
+
private readonly heartbeatIntervalMs;
|
|
692
|
+
private readonly supportedJobTypes;
|
|
693
|
+
private readonly qualityGatePolicy;
|
|
694
|
+
private readonly qualityGateOnFailure;
|
|
695
|
+
private readonly resultClaimMode;
|
|
696
|
+
private readonly logger;
|
|
697
|
+
constructor(client: Forg3tClient, adapter: TrainingBackendAdapter, options: WhiteboxWorkerOptions);
|
|
698
|
+
start(): Promise<void>;
|
|
699
|
+
stop(): Promise<void>;
|
|
700
|
+
runOnce(): Promise<void>;
|
|
701
|
+
private runLoop;
|
|
702
|
+
private processClaimedJob;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
interface AdapterCommandSpec {
|
|
706
|
+
command: string;
|
|
707
|
+
args?: string[];
|
|
708
|
+
cwd?: string;
|
|
709
|
+
env?: Record<string, string>;
|
|
710
|
+
timeoutMs?: number;
|
|
711
|
+
stdinMode?: 'json' | 'none';
|
|
712
|
+
}
|
|
713
|
+
type CommandResolver<TInput> = AdapterCommandSpec | ((input: TInput, context: WhiteboxJobContext) => AdapterCommandSpec);
|
|
714
|
+
interface LocalCommandAdapterOptions {
|
|
715
|
+
name?: string;
|
|
716
|
+
unlearning: CommandResolver<WhiteboxUnlearningInput>;
|
|
717
|
+
evaluation?: CommandResolver<WhiteboxEvaluationInput>;
|
|
718
|
+
timeoutMs?: number;
|
|
719
|
+
}
|
|
720
|
+
declare class LocalCommandTrainingAdapter implements TrainingBackendAdapter {
|
|
721
|
+
private readonly options;
|
|
722
|
+
readonly name: string;
|
|
723
|
+
constructor(options: LocalCommandAdapterOptions);
|
|
724
|
+
runUnlearning(input: WhiteboxUnlearningInput, context: WhiteboxJobContext): Promise<WhiteboxUnlearningOutput>;
|
|
725
|
+
runEvaluation(input: WhiteboxEvaluationInput, context: WhiteboxJobContext): Promise<WhiteboxEvaluationOutput>;
|
|
726
|
+
}
|
|
727
|
+
interface HttpTrainingAdapterOptions {
|
|
728
|
+
name?: string;
|
|
729
|
+
unlearningUrl: string;
|
|
730
|
+
evaluationUrl?: string;
|
|
731
|
+
timeoutMs?: number;
|
|
732
|
+
headers?: Record<string, string>;
|
|
733
|
+
}
|
|
734
|
+
declare class HttpTrainingAdapter implements TrainingBackendAdapter {
|
|
735
|
+
private readonly options;
|
|
736
|
+
readonly name: string;
|
|
737
|
+
constructor(options: HttpTrainingAdapterOptions);
|
|
738
|
+
runUnlearning(input: WhiteboxUnlearningInput, context: WhiteboxJobContext): Promise<WhiteboxUnlearningOutput>;
|
|
739
|
+
runEvaluation(input: WhiteboxEvaluationInput, context: WhiteboxJobContext): Promise<WhiteboxEvaluationOutput>;
|
|
740
|
+
}
|
|
741
|
+
type NativeAdapterConfig = ({
|
|
742
|
+
provider: 'local_command';
|
|
743
|
+
} & LocalCommandAdapterOptions) | ({
|
|
744
|
+
provider: 'http';
|
|
745
|
+
} & HttpTrainingAdapterOptions);
|
|
746
|
+
declare const createNativeTrainingAdapter: (config: NativeAdapterConfig) => TrainingBackendAdapter;
|
|
747
|
+
|
|
748
|
+
type Forg3tDeploymentProfile = 'cloud_managed' | 'customer_online' | 'customer_airgapped';
|
|
749
|
+
type Forg3tAdapterMode = 'local_command' | 'http';
|
|
750
|
+
interface DeploymentCompatibilityOptions {
|
|
751
|
+
profile: Forg3tDeploymentProfile;
|
|
752
|
+
adapterMode: Forg3tAdapterMode;
|
|
753
|
+
apiUrl: string;
|
|
754
|
+
allowedApiHosts?: string[];
|
|
755
|
+
allowHttpInAirgapped?: boolean;
|
|
756
|
+
}
|
|
757
|
+
type WhiteboxWorkerBaseOptions = Pick<WhiteboxWorkerOptions, 'projectId'> & Partial<Omit<WhiteboxWorkerOptions, 'projectId'>>;
|
|
758
|
+
declare const ENTERPRISE_STRICT_QUALITY_GATE_POLICY: Required<WhiteboxQualityGatePolicy>;
|
|
759
|
+
declare function assertDeploymentCompatibility(options: DeploymentCompatibilityOptions): void;
|
|
760
|
+
declare function buildWhiteboxWorkerOptions(profile: Forg3tDeploymentProfile, baseOptions: WhiteboxWorkerBaseOptions): WhiteboxWorkerOptions;
|
|
240
761
|
|
|
241
|
-
export { type ApiKey, type AuditEvent, type AuditEventFilters, type AuditEventListResponse, type ClaimAssertion, type ClaimJobsRequest, type ClaimScope, type ClaimType, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateWebhookRequest, type EvidenceArtifact, type EvidencePdfResponse, Forg3tApiConnectionError, Forg3tAuthenticationError, Forg3tClient, type Forg3tClientOptions, Forg3tError, Forg3tNotFoundError, Forg3tRateLimitError, type Job, type JobConfig, type JobError, type JobResult, type JobStatus, type JobType, type PaginationParams, type Project, type SubmitJobRequest, type UnlearningClaim, type UpdateWebhookRequest, type Webhook, type WebhookDelivery, type WebhookDeliveryFilters };
|
|
762
|
+
export { AccessLevel, type AdapterCommandSpec, type ApiKey, type AuditEvent, type AuditEventFilters, type AuditEventListResponse, type BaseAdapterConfig, type BootstrapTenantRequest, type BootstrapTenantResponse, type BuildModelUnlearningJobInput, type ClaimAssertion, type ClaimJobsRequest, type ClaimScope, type ClaimType, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateIntegrationRequest, type CreateUnlearningRequestParams, type CreateWebhookRequest, type CurrentUserResponse, DEFAULT_WHITEBOX_QUALITY_GATE_POLICY, type DeploymentCompatibilityOptions, ENTERPRISE_STRICT_QUALITY_GATE_POLICY, type EvidenceArtifact, type EvidencePdfResponse, type EvidenceStatusResponse, type ExecutionPlan, type ExecutionStep, type Forg3tAdapterMode, Forg3tApiConnectionError, Forg3tAuthenticationError, Forg3tClient, type Forg3tClientOptions, type Forg3tDeploymentProfile, Forg3tError, Forg3tNotFoundError, Forg3tNotImplementedError, Forg3tRateLimitError, HttpTrainingAdapter, type HttpTrainingAdapterOptions, type Integration, IntegrationMode, IntegrationType, type Job, type JobConfig, type JobError, type JobMutationOptions, type JobResult, type JobStatus, type JobType, type LangChainAdapterConfig, type LocalCommandAdapterOptions, LocalCommandTrainingAdapter, type ModelArtifactReference, type NativeAdapterConfig, type OpenRouterAdapterConfig, type PaginationParams, type Project, type RevokeApiKeyResponse, type SubmitJobRequest, type TrainingBackendAdapter, type UnlearningClaim, type UnlearningExecutionModelRef, type UnlearningExecutionPlanSpec, type UnlearningExecutionSpec, type UnlearningExecutionTargetSpec, type UnlearningJobSummary, type UnlearningRequest, type UnlearningScope, type UnlearningTarget, type UpdateWebhookRequest, WHITEBOX_QUALITY_GATE_PRESETS, WHITEBOX_QUALITY_GATE_PRESET_EXPLANATIONS, type Webhook, type WebhookDelivery, type WebhookDeliveryFilters, type WhiteboxEvaluationInput, type WhiteboxEvaluationOutput, type WhiteboxJobContext, type WhiteboxQualityGateDecision, type WhiteboxQualityGatePolicy, type WhiteboxQualityGatePreset, type WhiteboxTargetSpec, type WhiteboxUnlearningInput, type WhiteboxUnlearningOutput, type WhiteboxUnlearningPlan, WhiteboxWorker, type WhiteboxWorkerBaseOptions, type WhiteboxWorkerLogger, type WhiteboxWorkerOptions, assertDeploymentCompatibility, buildModelUnlearningPayload, buildWhiteboxWorkerOptions, createNativeTrainingAdapter, evaluateWhiteboxQualityGate, resolveWhiteboxQualityGatePolicy };
|