@forg3t/sdk 0.1.3 → 0.1.4

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