@tryvira/sdk 0.1.75 → 0.1.93

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.
@@ -0,0 +1,2016 @@
1
+ export interface RuntimeRequest {
2
+ organizationId: string;
3
+ projectId: string;
4
+ environmentId: string;
5
+ revisionId: string;
6
+ idempotencyKey: string;
7
+ nonce: string;
8
+ expiresAt: number;
9
+ }
10
+ export interface SdkRequest {
11
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
12
+ path: string;
13
+ query?: Readonly<Record<string, string>>;
14
+ body?: Readonly<Record<string, unknown>>;
15
+ }
16
+ export type SdkFailureMode = "throw" | "open";
17
+ export interface ViraClientOptions {
18
+ baseUrl: string;
19
+ /** Explicit opt-in for plain HTTP on loopback during local development only. */
20
+ allowInsecureLocalhost?: boolean;
21
+ apiKey?: string;
22
+ /** Host-managed OAuth access token provider; called once per API request. */
23
+ accessTokenProvider?: () => string | null | undefined | Promise<string | null | undefined>;
24
+ /** Server-side only: fresh Studio-signed operator delegation, never a browser OAuth token. */
25
+ operatorDelegationTokenProvider?: () => string | null | undefined | Promise<string | null | undefined>;
26
+ fetcher?: typeof fetch;
27
+ timeoutMs?: number;
28
+ retries?: number;
29
+ failureMode?: SdkFailureMode;
30
+ defaultHeaders?: Readonly<Record<string, string>>;
31
+ /** Select a verified organization unit for unit-bound projects. */
32
+ organizationUnitId?: string;
33
+ /** Connection selected by connectOnce or supplied by the host integration. */
34
+ connectionId?: string;
35
+ }
36
+ export interface ViraResponse<T = unknown> {
37
+ status: number;
38
+ body: T;
39
+ requestId: string;
40
+ }
41
+ export interface EvaluationImprovementProposalRecord {
42
+ id: string;
43
+ organizationId: string;
44
+ projectId: string;
45
+ environmentId: string;
46
+ sourceEvaluationId: string;
47
+ sourceFindingIds: readonly string[];
48
+ basePackId: string;
49
+ basePackDigest: string;
50
+ behaviorSet: Readonly<Record<string, unknown>>;
51
+ status: 'DRAFT' | 'REVIEW_REQUIRED' | 'APPROVED_FOR_EVALUATION' | 'REJECTED' | 'CANDIDATE_CREATED';
52
+ changes: readonly Readonly<Record<string, unknown>>[];
53
+ proposalDigest: string;
54
+ origin?: 'COMPARATIVE_EVALUATION' | 'TEACH_RUN';
55
+ }
56
+ export interface EvaluationImprovementProposalCreateResult {
57
+ proposal: EvaluationImprovementProposalRecord;
58
+ behaviorSetValidation: {
59
+ complete: true;
60
+ missing: readonly [];
61
+ };
62
+ reviewRequired: true;
63
+ directPublishAllowed: false;
64
+ }
65
+ export interface SemanticTaskRecord {
66
+ id: string;
67
+ organizationId: string;
68
+ projectId: string;
69
+ environmentId: string;
70
+ taskKey: string;
71
+ description: string;
72
+ version: number;
73
+ }
74
+ export interface SemanticTaskListResult {
75
+ tasks: SemanticTaskRecord[];
76
+ limit: number;
77
+ nextCursor?: string;
78
+ }
79
+ export interface SemanticTaskCreateResult {
80
+ task: SemanticTaskRecord;
81
+ }
82
+ export interface SemanticTaskListOptions {
83
+ limit?: number;
84
+ cursor?: string;
85
+ search?: string;
86
+ }
87
+ export interface BehaviorPointRecord {
88
+ id: string;
89
+ organizationId: string;
90
+ projectId: string;
91
+ environmentId: string;
92
+ key: string;
93
+ taskId: string;
94
+ taskIds: string[];
95
+ constraints: unknown;
96
+ }
97
+ export interface BehaviorPointListResult {
98
+ controlPoints: BehaviorPointRecord[];
99
+ limit: number;
100
+ nextCursor?: string;
101
+ }
102
+ export interface BehaviorPointCreateResult {
103
+ behaviorPoint: BehaviorPointRecord;
104
+ }
105
+ export interface BehaviorPointDeleteReceipt {
106
+ id: string;
107
+ kind: "behavior-points";
108
+ }
109
+ export interface BehaviorPointDeleteResult {
110
+ deleted: true;
111
+ id: string;
112
+ kind: "behavior-points";
113
+ receipt: BehaviorPointDeleteReceipt | null;
114
+ }
115
+ export interface BehaviorPointListOptions {
116
+ limit?: number;
117
+ cursor?: string;
118
+ search?: string;
119
+ }
120
+ export interface RuntimeTraceEvent {
121
+ id: string;
122
+ receipt_id: string;
123
+ organization_id: string;
124
+ project_id: string;
125
+ environment_id: string;
126
+ event: string;
127
+ attributes_json: string;
128
+ authority_digest: string | null;
129
+ created_at: string;
130
+ attributes: Record<string, unknown>;
131
+ [key: string]: unknown;
132
+ }
133
+ export interface RuntimeTraceSearchResult {
134
+ route: "/v1/runtime/traces/search";
135
+ traceCount: number;
136
+ traces: RuntimeTraceEvent[];
137
+ nextCursor: string | null;
138
+ source: "postgres-control-plane-read-model";
139
+ }
140
+ export interface StrategyExecutionRecord {
141
+ id: string | null;
142
+ traceId: string | null;
143
+ status: string | null;
144
+ mode: string | null;
145
+ authorityDigest?: string;
146
+ behaviorPointId?: string;
147
+ canonicalRevisionId?: string;
148
+ programId?: string;
149
+ programDigest?: string;
150
+ strategyArtifactDigest?: string;
151
+ strategyDigest?: string;
152
+ variantId?: string;
153
+ strategyId?: string;
154
+ strategyKey?: string;
155
+ currentStepKey: string | null;
156
+ sequence: number | null;
157
+ stepExecutions: number | null;
158
+ modelCalls?: number;
159
+ toolCalls?: number;
160
+ decisionCalls?: number;
161
+ repairAttempts?: number;
162
+ costMicros?: number;
163
+ createdAt: string | null;
164
+ updatedAt: string | null;
165
+ finalOutput?: string;
166
+ behaviorPlan?: unknown;
167
+ }
168
+ export interface StrategyStepReceipt {
169
+ id: string | null;
170
+ stepKey: string | null;
171
+ stepType: string | null;
172
+ status: string | null;
173
+ attempt: number | null;
174
+ toolInvocationRecorded?: boolean;
175
+ modelRequestId?: string;
176
+ receiptDigest?: string;
177
+ externalHostExecuted?: {
178
+ source: string | null;
179
+ status: string | null;
180
+ };
181
+ createdAt: string | null;
182
+ }
183
+ export interface StrategyExecutionCreditReadback {
184
+ metered: boolean;
185
+ executionId: string;
186
+ traceId: string;
187
+ aiSystemId: string;
188
+ consumingOrganizationUnitId: string;
189
+ reservationStatus: string;
190
+ reservationId?: string;
191
+ ledgerEntryId?: string | null;
192
+ actualMicrocredits?: string | null;
193
+ ratedReceiptIds: string[];
194
+ /** Exact decimal string; do not convert to a floating-point number. */
195
+ ratedMicrocredits: string;
196
+ }
197
+ /** Read-only provider-to-credit evidence. Amounts and mutation rights are
198
+ * never sourced from the JS SDK. Admin settlement is a separate privileged API. */
199
+ export interface AIUsageReconciliationReview {
200
+ executionId: string;
201
+ organizationUnitId: string;
202
+ aiSystemId: string;
203
+ reservationId: string | null;
204
+ reservationStatus: string;
205
+ status: string;
206
+ operatorAction: string;
207
+ settlementStatus: string;
208
+ settlementIssues: string[];
209
+ reviewDigest: string;
210
+ expectedProviderRequests: number;
211
+ ratedProviderRequests: number;
212
+ ratedReceiptIds: string[];
213
+ missingProviderRequestIds: string[];
214
+ unexpectedProviderRequestIds: string[];
215
+ }
216
+ export interface AIUsageReconciliationEnvelope {
217
+ review: AIUsageReconciliationReview;
218
+ }
219
+ export interface StrategyExecutionReleaseReadback {
220
+ releaseId: string;
221
+ aiSystemId: string;
222
+ releaseContentDigest: string;
223
+ evaluationId: string;
224
+ evaluationDigest: string;
225
+ canonicalRevisionId: string;
226
+ programId: string;
227
+ programDigest: string;
228
+ strategyArtifactDigest: string;
229
+ strategyDigest: string;
230
+ strategyId: string;
231
+ variantId: string;
232
+ approvedBy: string;
233
+ approvedAt: string;
234
+ }
235
+ export interface StrategyExecutionEnvelope {
236
+ execution: StrategyExecutionRecord;
237
+ replayed?: boolean;
238
+ credit?: StrategyExecutionCreditReadback;
239
+ release?: StrategyExecutionReleaseReadback | null;
240
+ }
241
+ export interface StrategyExecutionList {
242
+ executions: StrategyExecutionRecord[];
243
+ limit: number;
244
+ nextCursor?: string;
245
+ }
246
+ export interface StrategyExecutionTrace {
247
+ execution: StrategyExecutionRecord;
248
+ receipts: StrategyStepReceipt[];
249
+ credit?: StrategyExecutionCreditReadback;
250
+ release?: StrategyExecutionReleaseReadback | null;
251
+ }
252
+ export interface StrategyExecutionQueued {
253
+ queued: true;
254
+ executionId: string;
255
+ traceId: string;
256
+ job: {
257
+ id: string;
258
+ state: string;
259
+ };
260
+ }
261
+ export interface StrategyExecutionOutcome {
262
+ status: string;
263
+ currentStepKey: string | null;
264
+ receipts: StrategyStepReceipt[];
265
+ reason?: string;
266
+ modelCalls: number;
267
+ toolCalls: number;
268
+ decisionCalls: number;
269
+ repairAttempts: number;
270
+ totalRecoveries: number;
271
+ costMicros: number;
272
+ }
273
+ export interface StrategyExecutionResult {
274
+ execution: StrategyExecutionRecord;
275
+ result: StrategyExecutionOutcome;
276
+ }
277
+ export interface BehaviorProjection {
278
+ rendered: string;
279
+ projectionDigest: string;
280
+ programDigest: string;
281
+ [key: string]: unknown;
282
+ }
283
+ export interface ProjectionReceipt {
284
+ projectionDigest: string;
285
+ programDigest: string;
286
+ artifactDigest: string;
287
+ receiptDigest: string;
288
+ [key: string]: unknown;
289
+ }
290
+ export interface RuntimeResolution {
291
+ behaviorPoint: string;
292
+ strategySelection?: ClientBody | null;
293
+ behaviorProjection?: BehaviorProjection;
294
+ projectionReceipt?: ProjectionReceipt;
295
+ projectionMode?: "active" | "unavailable" | "not-applicable";
296
+ [key: string]: unknown;
297
+ }
298
+ export type TaskRunMode = "SINGLE" | "STRATEGY" | "COMPOUND" | "HYBRID";
299
+ export interface ScopedListOptions {
300
+ limit?: number;
301
+ cursor?: string;
302
+ status?: string;
303
+ search?: string;
304
+ }
305
+ export type TaskRunRequestedMode = TaskRunMode | "AUTO";
306
+ export interface TaskRunChildMode {
307
+ semanticTaskKey: string;
308
+ mode: "SINGLE" | "STRATEGY";
309
+ }
310
+ export type SemanticAbstainReason = "EXACT_NEGATIVE_MATCH" | "NO_EXACT_MATCH" | "PROVIDER_TASK_NOT_FOUND" | "PROVIDER_EXCLUDED_TASK" | "PROVIDER_CONFIDENCE_BELOW_THRESHOLD" | "PROVIDER_WINNER_MARGIN" | "SEMANTIC_PROVIDER_TIMEOUT";
311
+ export interface SemanticActivationReceipt extends Record<string, unknown> {
312
+ outcome: "select" | "continue" | "switch" | "clarify" | "abstain" | "unknown";
313
+ taskKey?: string;
314
+ confidence: number;
315
+ runnerUpConfidence: number;
316
+ abstainReason?: SemanticAbstainReason;
317
+ clarifyReason?: "AMBIGUOUS_MATCH" | "PROVIDER_LOW_CONFIDENCE";
318
+ }
319
+ export interface SemanticResolveBody extends Record<string, unknown> {
320
+ receipt?: SemanticActivationReceipt;
321
+ }
322
+ export interface TaskRunRouteRequest {
323
+ input: string;
324
+ aiSystemId?: string;
325
+ requestId?: string;
326
+ requestedMode?: TaskRunRequestedMode;
327
+ intentCount?: number;
328
+ hostCapabilities?: readonly string[];
329
+ hybridPlan?: readonly TaskRunChildMode[];
330
+ connectionId?: string;
331
+ }
332
+ export interface TaskRunBudget {
333
+ maxChildren?: number;
334
+ maxCalls?: number;
335
+ maxLatencyMs?: number;
336
+ maxCostMicros?: number;
337
+ }
338
+ export interface TaskRunAdmissionRequest {
339
+ taskRunId: string;
340
+ requestId: string;
341
+ aiSystemId: string;
342
+ input: unknown;
343
+ ownerActorRef?: string;
344
+ requestedMode?: TaskRunRequestedMode;
345
+ hostCapabilities?: readonly string[];
346
+ hybridPlan?: readonly TaskRunChildMode[];
347
+ compoundPlanId?: string;
348
+ conversationId?: string;
349
+ episodeId?: string;
350
+ traceRootRef?: string;
351
+ budget?: TaskRunBudget;
352
+ connectionId?: string;
353
+ }
354
+ export interface TaskRunChildEvidence {
355
+ nodeKey: string;
356
+ childRunId: string;
357
+ scopeEvidenceStatus: 'VERIFIED' | 'LEGACY_UNBOUND';
358
+ semanticTaskKey: string;
359
+ mode: string;
360
+ status: string;
361
+ receiptId: string;
362
+ authorityDigest: string;
363
+ artifactDigest: string;
364
+ inputDigest: string;
365
+ outputDigest: string;
366
+ stepReceiptIds: string[];
367
+ effectReceiptIds: string[];
368
+ singleHost?: {
369
+ evidenceStatus: 'AWAITING_ACCELERATOR' | 'AWAITING_APPROVAL' | 'APPROVED' | 'IN_FLIGHT' | 'VERIFIED';
370
+ invocationId: string;
371
+ commercialEvidenceStatus: 'NOT_CHARGEABLE';
372
+ requestContext?: Record<string, unknown>;
373
+ toolKey?: string;
374
+ proposal?: Record<string, unknown>;
375
+ acceleratorReceiptDigest?: string;
376
+ acceleratorRatedReceiptId?: string;
377
+ completionDigest?: string;
378
+ resultDigest?: string;
379
+ };
380
+ managedHost?: {
381
+ evidenceStatus: 'PENDING' | 'PENDING_COMPLETION' | 'PROPOSAL_VERIFIED' | 'VERIFIED';
382
+ commercialEvidenceStatus: 'RECONCILIATION_REQUIRED' | 'SETTLED_VERIFIED';
383
+ reservationId: string;
384
+ ratedReceiptId?: string;
385
+ runtimeReceiptId?: string;
386
+ outputDigest?: string;
387
+ gatewayReceiptDigest?: string;
388
+ accelerator?: {
389
+ receiptDigest: string;
390
+ engineEvidenceDigest: string;
391
+ contextDigest: string;
392
+ engineEpoch: string;
393
+ deploymentId: string;
394
+ usage: {
395
+ input_tokens: number;
396
+ output_tokens: number;
397
+ };
398
+ proposalOnly: boolean;
399
+ };
400
+ };
401
+ temporal?: {
402
+ evidenceStatus: 'PENDING' | 'VIOLATION' | 'VERIFIED';
403
+ receipts: Array<{
404
+ contractKey: string;
405
+ phase: 'pre_model' | 'post_model' | 'pre_effect' | 'post_effect' | 'completion' | 'deadline';
406
+ receiptId: string;
407
+ status: 'SATISFIED' | 'VIOLATION';
408
+ sequence: number;
409
+ contractDigest: string;
410
+ receiptDigest: string;
411
+ violations: string[];
412
+ deadlineAt?: string;
413
+ }>;
414
+ recoveryReceiptIds: string[];
415
+ };
416
+ strategy?: {
417
+ evidenceStatus: 'NOT_RECORDED' | 'PENDING' | 'LEGACY_UNBOUND' | 'VERIFIED';
418
+ executionId?: string;
419
+ status?: string;
420
+ traceId?: string;
421
+ canonicalRevisionId?: string;
422
+ programId?: string;
423
+ programDigest?: string;
424
+ release?: StrategyExecutionReleaseReadback;
425
+ credit?: StrategyExecutionCreditReadback;
426
+ stepReceipts?: Array<{
427
+ id: string;
428
+ stepKey: string;
429
+ status: string;
430
+ receiptDigest: string;
431
+ }>;
432
+ };
433
+ compound?: {
434
+ evidenceStatus: 'LEGACY_UNBOUND' | 'IN_PROGRESS' | 'NODE_RECEIPTS_VERIFIED';
435
+ planId?: string;
436
+ planDigest?: string;
437
+ nodes?: Array<{
438
+ nodeKey: string;
439
+ semanticTaskKey: string;
440
+ status: string;
441
+ receiptId: string | null;
442
+ artifactDigest: string;
443
+ authorityDigest: string;
444
+ inputDigest: string;
445
+ outputDigest: string | null;
446
+ dependencies: string[];
447
+ scopeEvidenceStatus: 'PARENT_BOUND';
448
+ commercialEvidenceStatus: 'NOT_ATTESTED';
449
+ }>;
450
+ };
451
+ }
452
+ export interface TaskRunEvidence {
453
+ taskRunId: string;
454
+ mode: TaskRunMode;
455
+ status: string;
456
+ stateVersion: number | null;
457
+ organizationUnitId: string;
458
+ aiSystemId: string;
459
+ planDigest: string;
460
+ policySnapshotDigest: string | null;
461
+ authorityDigest: string | null;
462
+ checkpointExecutionDigest: string | null;
463
+ children: TaskRunChildEvidence[];
464
+ source: 'postgres-taskrun-strategy-release-credit-evidence';
465
+ }
466
+ export interface TaskRunEvidenceResult {
467
+ evidence: TaskRunEvidence;
468
+ }
469
+ export interface TaskRunPromptRequest {
470
+ aiSystemId: string;
471
+ input: unknown;
472
+ taskRunId?: string;
473
+ requestId?: string;
474
+ conversationId?: string;
475
+ episodeId?: string;
476
+ traceRootRef?: string;
477
+ budget?: TaskRunBudget;
478
+ connectionId?: string;
479
+ hostCapabilities?: readonly string[];
480
+ }
481
+ export interface ConnectOnceResult {
482
+ system: ClientBody;
483
+ connection: AISystemConnectionSummary;
484
+ handshake: AISystemConnectionCreateHandshake;
485
+ }
486
+ export interface StrategyContinuationInput {
487
+ authorityDigest?: string;
488
+ state?: Readonly<Record<string, unknown>>;
489
+ references?: Readonly<Record<string, unknown>>;
490
+ }
491
+ export type ViraLearningNamespaces = {
492
+ evaluations: {
493
+ createPlan: (input: ClientBody, options?: {
494
+ idempotencyKey?: string;
495
+ }) => Promise<ViraResponse<ClientBody> | null>;
496
+ get: (id: string) => Promise<ViraResponse<ClientBody> | null>;
497
+ compare: (id: string) => Promise<ViraResponse<ClientBody> | null>;
498
+ reviewFinding: (evaluationId: string, findingId: string, input: {
499
+ decision: 'ACCEPT' | 'REJECT' | 'EDIT' | 'MORE_EVIDENCE';
500
+ reason?: string;
501
+ }, options?: {
502
+ idempotencyKey?: string;
503
+ }) => Promise<ViraResponse<ClientBody> | null>;
504
+ proposeImprovement: (id: string, input: ClientBody, options?: {
505
+ idempotencyKey?: string;
506
+ }) => Promise<ViraResponse<EvaluationImprovementProposalCreateResult> | null>;
507
+ };
508
+ teach: {
509
+ review: (id: string, action?: 'request-review' | 'approve' | 'reject', options?: {
510
+ idempotencyKey?: string;
511
+ }) => Promise<ViraResponse<ClientBody> | null>;
512
+ createCandidate: (input: ClientBody, options?: {
513
+ idempotencyKey?: string;
514
+ }) => Promise<ViraResponse<ClientBody> | null>;
515
+ evaluateCandidate: (id: string, input: ClientBody, options?: {
516
+ idempotencyKey?: string;
517
+ }) => Promise<ViraResponse<ClientBody> | null>;
518
+ };
519
+ packs: {
520
+ createRevision: (input: ClientBody, options?: {
521
+ idempotencyKey?: string;
522
+ }) => Promise<ViraResponse<ClientBody> | null>;
523
+ getRevision: (id: string) => Promise<ViraResponse<ClientBody> | null>;
524
+ diffRevision: (id: string) => Promise<ViraResponse<ClientBody> | null>;
525
+ transitionRevision: (id: string, transition: 'validate' | 'request-approval' | 'approve' | 'release' | 'reject', options?: {
526
+ idempotencyKey?: string;
527
+ }) => Promise<ViraResponse<ClientBody> | null>;
528
+ };
529
+ };
530
+ export declare class ViraApiError extends Error {
531
+ readonly status: number;
532
+ readonly body: unknown;
533
+ readonly requestId: string;
534
+ constructor(message: string, status: number, body: unknown, requestId: string);
535
+ }
536
+ type ClientBody = Record<string, unknown>;
537
+ export interface DiscoveryCandidate extends ClientBody {
538
+ id: string;
539
+ kind: string;
540
+ key: string;
541
+ organizationId: string;
542
+ projectId: string;
543
+ environmentId: string;
544
+ reviewState?: string;
545
+ label?: string;
546
+ evidenceIds?: string[];
547
+ }
548
+ export interface DiscoveryCandidateListResult {
549
+ candidates: readonly DiscoveryCandidate[];
550
+ limit: number;
551
+ nextCursor?: string;
552
+ }
553
+ export interface DiscoveryCandidateReviewResult {
554
+ candidate: DiscoveryCandidate;
555
+ }
556
+ export interface DiscoveryCandidatePublishResult {
557
+ record: ClientBody & {
558
+ id: string;
559
+ };
560
+ semanticRegistry?: {
561
+ organizationId: string;
562
+ projectId: string;
563
+ environmentId: string;
564
+ version: number;
565
+ registryDigest: string;
566
+ tasks: readonly ClientBody[];
567
+ };
568
+ }
569
+ export interface AISystemInventoryItem {
570
+ id: string;
571
+ kind: string;
572
+ key: string;
573
+ evidenceEventId: string;
574
+ organizationId: string;
575
+ projectId: string;
576
+ environmentId: string;
577
+ status?: string;
578
+ reviewState?: string;
579
+ createdAt?: string;
580
+ }
581
+ export interface AISystemInventoryResult {
582
+ inventory: readonly AISystemInventoryItem[];
583
+ }
584
+ export interface AISystemConnectionSummary {
585
+ id: string;
586
+ aiSystemId: string;
587
+ adapterType: string;
588
+ adapterVersion: string;
589
+ capabilities?: readonly string[];
590
+ capabilitiesDigest: string;
591
+ authorityBindingDigest: string;
592
+ authorityBindingVersion: number;
593
+ status: string;
594
+ healthState: string;
595
+ lastObservedAt: string | null;
596
+ createdAt?: string;
597
+ updatedAt?: string;
598
+ }
599
+ export interface AISystemConnectionCreateHandshake {
600
+ adapterType: string;
601
+ accepted: readonly string[];
602
+ rejected: readonly string[];
603
+ configValid: boolean;
604
+ reusedExistingConnection?: boolean;
605
+ adapterVersionTransition?: {
606
+ from: string;
607
+ to: string;
608
+ mode: "UNCHANGED" | "REUSE_COMPATIBLE";
609
+ };
610
+ }
611
+ export interface AISystemConnectionCreateResult {
612
+ connection: AISystemConnectionSummary;
613
+ handshake: AISystemConnectionCreateHandshake;
614
+ credentialProfile?: {
615
+ id: string;
616
+ name: string;
617
+ provider: string;
618
+ status: string;
619
+ };
620
+ }
621
+ export interface HostActionAuthorizationResult {
622
+ abi: "vira.action-decision.v1";
623
+ proposal_id: string;
624
+ request_context_digest: string;
625
+ allowed: boolean;
626
+ authority_receipt_digest: string;
627
+ reason_code?: string;
628
+ decision_digest: string;
629
+ scope: {
630
+ organizationId: string;
631
+ projectId: string;
632
+ environmentId: string;
633
+ organizationUnitId?: string;
634
+ };
635
+ }
636
+ export interface ConnectionHealthResult {
637
+ connectionId: string;
638
+ status: string;
639
+ healthState: string | null;
640
+ lastObservedAt: string | null;
641
+ }
642
+ export interface AISystemConnectionDetailResult {
643
+ connection: AISystemConnectionSummary;
644
+ systemId: string;
645
+ scope: Readonly<Record<string, unknown>>;
646
+ }
647
+ export interface ConnectionTestResult {
648
+ connectionId: string;
649
+ status: string;
650
+ evidence: "LOCAL_CONTRACT_ONLY";
651
+ diagnostics: {
652
+ capabilities: readonly string[];
653
+ handshake: {
654
+ adapterType: string;
655
+ accepted: readonly string[];
656
+ rejected: readonly string[];
657
+ configValid: boolean;
658
+ };
659
+ observedAt: string | null;
660
+ };
661
+ }
662
+ export interface ObservationAdmissionEvent {
663
+ eventId: string;
664
+ eventDigest: string;
665
+ }
666
+ export interface ObservationAdmissionResult {
667
+ accepted: number;
668
+ events: readonly ObservationAdmissionEvent[];
669
+ }
670
+ export type OrganizationUnitKind = "business_unit" | "department" | "team";
671
+ export type OrganizationUnitStatus = "ACTIVE" | "ARCHIVED";
672
+ export interface OrganizationUnitRecord {
673
+ id: string;
674
+ organizationId: string;
675
+ parentUnitId: string | null;
676
+ name: string;
677
+ kind: OrganizationUnitKind;
678
+ status: OrganizationUnitStatus;
679
+ createdAt: string;
680
+ updatedAt: string;
681
+ }
682
+ export interface OrganizationUnitListResult {
683
+ organizationId: string;
684
+ units: readonly OrganizationUnitRecord[];
685
+ }
686
+ export type AICreditLedgerEntryType = "grant" | "debit" | "refund";
687
+ export interface AICreditLedgerEntry {
688
+ id: string;
689
+ organizationId: string;
690
+ billingAccountId: string;
691
+ projectId: string | null;
692
+ organizationUnitId: string | null;
693
+ actorId: string | null;
694
+ entryType: AICreditLedgerEntryType;
695
+ amountMicrocredits: number;
696
+ idempotencyKey: string;
697
+ source: string;
698
+ occurredAt: string;
699
+ reversesEntryId: string | null;
700
+ }
701
+ export type AICreditReservationState = "reserved" | "settled" | "released";
702
+ export interface AICreditReservationRecord {
703
+ id: string;
704
+ organizationId: string;
705
+ billingAccountId: string;
706
+ organizationUnitId: string | null;
707
+ projectId: string | null;
708
+ aiSystemId: string | null;
709
+ periodStart: string;
710
+ periodEnd: string;
711
+ amountMicrocredits: number;
712
+ state: AICreditReservationState;
713
+ idempotencyKey: string;
714
+ createdAt: string;
715
+ updatedAt: string;
716
+ actualMicrocredits: number | null;
717
+ ledgerEntryId: string | null;
718
+ usageReceiptId: string | null;
719
+ }
720
+ export interface AICreditWalletResult {
721
+ organizationId: string;
722
+ billingAccountId: string;
723
+ balanceMicrocredits: number;
724
+ entries: readonly AICreditLedgerEntry[];
725
+ source: "ai-credit-wallet-ledger";
726
+ }
727
+ export interface AICreditReservationResult {
728
+ organizationId: string;
729
+ billingAccountId: string;
730
+ reservation: AICreditReservationRecord;
731
+ source: "atomic-ai-credit-admission";
732
+ }
733
+ export type AICreditBudgetScope = "organization" | "organization_unit" | "project" | "ai_system";
734
+ export interface AICreditBudget {
735
+ id: string;
736
+ organizationId: string;
737
+ billingAccountId: string;
738
+ scopeType: AICreditBudgetScope;
739
+ scopeId: string;
740
+ periodStart: string;
741
+ periodEnd: string;
742
+ limitMicrocredits: number;
743
+ version: number;
744
+ idempotencyKey: string;
745
+ source: string;
746
+ actorId: string;
747
+ createdAt: string;
748
+ }
749
+ export interface AICreditBudgetUsage {
750
+ scopeType: AICreditBudgetScope;
751
+ scopeId: string;
752
+ periodStart: string;
753
+ periodEnd: string;
754
+ consumedMicrocredits: number;
755
+ reservedMicrocredits: number;
756
+ }
757
+ export interface AICreditBudgetList {
758
+ organizationId: string;
759
+ billingAccountId: string;
760
+ budgets: readonly AICreditBudget[];
761
+ usage: readonly AICreditBudgetUsage[];
762
+ source: "versioned-ai-credit-budget-repository";
763
+ }
764
+ export type AICreditChargeClass = "managed" | "byok" | "free";
765
+ export interface AICreditUsageQuantities {
766
+ input_tokens?: number;
767
+ output_tokens?: number;
768
+ cached_input_tokens?: number;
769
+ embedding_tokens?: number;
770
+ tool_invocations?: number;
771
+ compute_milliseconds?: number;
772
+ }
773
+ export interface RatedAIUsageRating {
774
+ chargeClass: AICreditChargeClass;
775
+ quantities: AICreditUsageQuantities;
776
+ pricingVersion: string | null;
777
+ providerCurrency: string | null;
778
+ providerCostMinor: number;
779
+ customerMicrocredits: number;
780
+ }
781
+ export interface RatedAIUsageReceipt {
782
+ schemaVersion: 1;
783
+ receiptId: string;
784
+ reservationId: string;
785
+ organizationId: string;
786
+ billingAccountId: string;
787
+ projectId: string | null;
788
+ consumingOrganizationUnitId: string | null;
789
+ aiSystemId: string | null;
790
+ providerId: string;
791
+ modelId: string;
792
+ providerRequestId: string;
793
+ occurredAt: string;
794
+ chargeClass: AICreditChargeClass;
795
+ quantities: AICreditUsageQuantities;
796
+ rating: RatedAIUsageRating;
797
+ receiptDigest: string;
798
+ }
799
+ export interface AICreditUsageReceiptList {
800
+ organizationId: string;
801
+ billingAccountId: string;
802
+ receipts: readonly RatedAIUsageReceipt[];
803
+ source: "rated-ai-usage-receipts";
804
+ }
805
+ export interface AICreditUsageSummaryGroup {
806
+ month: string;
807
+ consumingOrganizationUnitId: string | null;
808
+ providerId: string;
809
+ modelId: string;
810
+ chargeClass: AICreditChargeClass;
811
+ pricingVersion: string | null;
812
+ providerCurrency: string | null;
813
+ receiptCount: number;
814
+ providerCostMinor: number;
815
+ customerMicrocredits: number;
816
+ }
817
+ export interface AICreditUsageSummary {
818
+ organizationId: string;
819
+ billingAccountId: string;
820
+ groups: readonly AICreditUsageSummaryGroup[];
821
+ source: "rated-ai-usage-monthly-summary";
822
+ }
823
+ export type AISystemUnitGrant = {
824
+ aiSystemId: string;
825
+ organizationId: string;
826
+ projectId: string;
827
+ environmentId: string;
828
+ ownerUnitId: string;
829
+ consumingUnitId: string;
830
+ permissions: readonly string[];
831
+ status: 'ACTIVE' | 'REVOKED';
832
+ createdBy: string;
833
+ updatedBy: string;
834
+ createdAt: string;
835
+ updatedAt: string;
836
+ revokedAt: string | null;
837
+ };
838
+ export type AISystemRecord = ClientBody & {
839
+ id: string;
840
+ organizationId: string;
841
+ projectId: string;
842
+ environmentId: string;
843
+ organizationUnitId?: string | null;
844
+ ownerUnitId?: string | null;
845
+ consumingUnitGrants?: readonly AISystemUnitGrant[];
846
+ };
847
+ export type AISystemListResult = {
848
+ systems: readonly AISystemRecord[];
849
+ limit: number;
850
+ nextCursor?: string;
851
+ };
852
+ export type ProductCapabilitySurface = 'studio' | 'sdk' | 'python' | 'mcp' | 'api';
853
+ export type ProductCapabilityCatalogSurface = ProductCapabilitySurface | 'all';
854
+ export interface ProductCapabilityScope {
855
+ organizationId: string;
856
+ projectId: string;
857
+ environmentId: string;
858
+ organizationUnitId?: string;
859
+ }
860
+ export interface ProductCapabilityDescriptor {
861
+ key: string;
862
+ description: string;
863
+ requiredRoles: readonly string[];
864
+ rolePolicy?: 'all' | 'any';
865
+ surfaces: readonly ProductCapabilitySurface[];
866
+ effectful: boolean;
867
+ available: boolean;
868
+ missingRoles: readonly string[];
869
+ reason: 'ROLE_REQUIRED' | null;
870
+ }
871
+ export interface ControlOperationCatalogEntry {
872
+ operationId: string;
873
+ method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
874
+ path: string;
875
+ deprecated: boolean;
876
+ requestSchemaDeclared: boolean;
877
+ successResponseStatuses: readonly string[];
878
+ successResponsesSchemaDeclared: boolean;
879
+ securitySchemes: readonly string[];
880
+ requiredRoles: readonly string[];
881
+ authorityMetadata: 'operation-security-declared' | 'inherited-security-declared' | 'explicit-public-no-auth' | 'role-metadata-only' | 'not-declared';
882
+ authorizationMetadata: 'required-roles-declared' | 'runtime-policy-not-enumerated' | 'not-applicable';
883
+ }
884
+ export interface ControlOperationCatalog {
885
+ source: 'contracts/control-api.openapi.json';
886
+ openApiSha256: string;
887
+ operations: readonly ControlOperationCatalogEntry[];
888
+ }
889
+ export interface ProductCapabilityCatalogResult {
890
+ scope: ProductCapabilityScope;
891
+ surface: ProductCapabilityCatalogSurface;
892
+ capabilities: readonly ProductCapabilityDescriptor[];
893
+ capabilityAvailabilityMeaning: string;
894
+ controlOperationCatalog: ControlOperationCatalog;
895
+ source: 'scoped-product-capability-catalog';
896
+ }
897
+ type ClientObservationScope = {
898
+ organizationId: string;
899
+ projectId: string;
900
+ environmentId: string;
901
+ };
902
+ type ClientObservation = ClientObservationScope & {
903
+ eventId: string;
904
+ eventType: string;
905
+ aiSystemId: string;
906
+ connectionId: string;
907
+ /** Optional composed-scope members. They are carried as server-readable
908
+ * identity, never as model/client authority. */
909
+ workspaceId?: string;
910
+ userId?: string;
911
+ sessionId?: string;
912
+ [key: string]: unknown;
913
+ };
914
+ export interface ViraHttpRequestOptions {
915
+ apiKey?: string;
916
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
917
+ body?: unknown;
918
+ idempotencyKey?: string;
919
+ fetcher?: typeof fetch;
920
+ timeoutMs?: number;
921
+ retries?: number;
922
+ defaultHeaders?: Readonly<Record<string, string>>;
923
+ }
924
+ /** Shared transport policy for SDK-adjacent integrations such as MCP. */
925
+ export declare function viraHttpRequest<T = unknown>(url: string | URL, options: ViraHttpRequestOptions): Promise<ViraResponse<T>>;
926
+ /** Small, authority-aware client over the existing versioned control API. */
927
+ export declare class ViraClient {
928
+ readonly evaluations: ViraLearningNamespaces['evaluations'];
929
+ readonly teach: ViraLearningNamespaces['teach'];
930
+ readonly packs: ViraLearningNamespaces['packs'];
931
+ private readonly baseUrl;
932
+ private readonly apiKey?;
933
+ private readonly accessTokenProvider?;
934
+ private readonly operatorDelegationTokenProvider?;
935
+ private readonly fetcher;
936
+ private readonly timeoutMs;
937
+ private readonly retries;
938
+ private readonly failureMode;
939
+ private readonly defaultHeaders;
940
+ private boundConnectionId?;
941
+ constructor(options: ViraClientOptions);
942
+ listOrganizationUnits(): Promise<ViraResponse<OrganizationUnitListResult> | null>;
943
+ listOrganizationBillingAdmins(): Promise<ViraResponse<ClientBody> | null>;
944
+ setOrganizationBillingAdmin(actorId: string, status?: "ACTIVE" | "REVOKED", options?: {
945
+ idempotencyKey?: string;
946
+ }): Promise<ViraResponse<ClientBody> | null>;
947
+ getAICreditWallet(): Promise<ViraResponse<AICreditWalletResult> | null>;
948
+ listAICreditBudgets(): Promise<ViraResponse<AICreditBudgetList> | null>;
949
+ listAIUsageReceipts(input?: {
950
+ organizationUnitId?: string;
951
+ limit?: number;
952
+ }): Promise<ViraResponse<AICreditUsageReceiptList> | null>;
953
+ getAIUsageSummary(input?: {
954
+ organizationUnitId?: string;
955
+ }): Promise<ViraResponse<AICreditUsageSummary> | null>;
956
+ reserveAICredits(input: {
957
+ organizationId: string;
958
+ projectId: string;
959
+ environmentId: string;
960
+ organizationUnitId?: string;
961
+ amountMicrocredits: number;
962
+ periodStart: string;
963
+ periodEnd: string;
964
+ idempotencyKey: string;
965
+ aiSystemId?: string;
966
+ }, options?: {
967
+ idempotencyKey?: string;
968
+ }): Promise<ViraResponse<AICreditReservationResult> | null>;
969
+ releaseAICreditReservation(reservationId: string, options?: {
970
+ idempotencyKey?: string;
971
+ }): Promise<ViraResponse<ClientBody> | null>;
972
+ listInbox(options?: {
973
+ limit?: number;
974
+ cursor?: string;
975
+ search?: string;
976
+ }): Promise<ViraResponse<ClientBody> | null>;
977
+ markInboxRead(notificationId: string, options?: {
978
+ idempotencyKey?: string;
979
+ }): Promise<ViraResponse<ClientBody> | null>;
980
+ listNotificationDestinations(): Promise<ViraResponse<ClientBody> | null>;
981
+ createNotificationDestination(input: {
982
+ label: string;
983
+ provider: "slack" | "microsoft_teams";
984
+ endpoint: string;
985
+ }, options: {
986
+ idempotencyKey: string;
987
+ }): Promise<ViraResponse<ClientBody> | null>;
988
+ revokeNotificationDestination(destinationId: string, options?: {
989
+ idempotencyKey?: string;
990
+ }): Promise<ViraResponse<ClientBody> | null>;
991
+ createOrganizationUnit(input: {
992
+ name: string;
993
+ kind: "business_unit" | "department" | "team";
994
+ id?: string;
995
+ parentUnitId?: string | null;
996
+ }, options?: {
997
+ idempotencyKey?: string;
998
+ }): Promise<ViraResponse<ClientBody> | null>;
999
+ previewOrganizationUnitArchive(unitId: string): Promise<ViraResponse<ClientBody> | null>;
1000
+ archiveOrganizationUnit(unitId: string, options: {
1001
+ confirm: boolean;
1002
+ idempotencyKey?: string;
1003
+ }): Promise<ViraResponse<ClientBody> | null>;
1004
+ listOrganizationUnitMembers(unitId: string): Promise<ViraResponse<ClientBody> | null>;
1005
+ setOrganizationUnitMember(unitId: string, actorId: string, input: {
1006
+ role: "department_admin" | "teacher" | "reviewer" | "billing_admin" | "viewer";
1007
+ status?: "ACTIVE" | "REVOKED";
1008
+ }, options?: {
1009
+ idempotencyKey?: string;
1010
+ }): Promise<ViraResponse<ClientBody> | null>;
1011
+ listProjectOrganizationUnits(projectId: string): Promise<ViraResponse<ClientBody> | null>;
1012
+ bindProjectOrganizationUnit(projectId: string, unitId: string, input?: {
1013
+ primaryOwner?: boolean;
1014
+ }, options?: {
1015
+ idempotencyKey?: string;
1016
+ }): Promise<ViraResponse<ClientBody> | null>;
1017
+ private request;
1018
+ connectSystem(input: {
1019
+ name: string;
1020
+ systemType: string;
1021
+ organizationId: string;
1022
+ projectId: string;
1023
+ environmentId: string;
1024
+ idempotencyKey?: string;
1025
+ }): Promise<ViraResponse<{
1026
+ system: ClientBody;
1027
+ }> | null>;
1028
+ /** Advisory only. Does not approve, reserve or transfer an AI System. */
1029
+ getAISystemOwnershipTransferReadiness(systemId: string): Promise<ViraResponse<ClientBody> | null>;
1030
+ /** Recipient consents to a NEW empty AI System, never transfer of history. */
1031
+ acceptAISystemClone(systemId: string, input: {
1032
+ expectedOwnerUnitId: string;
1033
+ newName: string;
1034
+ reason: string;
1035
+ }): Promise<ViraResponse<ClientBody> | null>;
1036
+ /** Owner prepares blank successor; provider credentials and traffic remain put. */
1037
+ prepareAISystemClone(systemId: string, input: {
1038
+ expectedOwnerUnitId: string;
1039
+ targetUnitId: string;
1040
+ acceptanceAuditId: string;
1041
+ reason: string;
1042
+ }): Promise<ViraResponse<ClientBody> | null>;
1043
+ /** Advisory clone preflight; never changes provider routing or ownership. */
1044
+ getAISystemCloneCutoverReadiness(systemId: string, input: {
1045
+ newAiSystemId: string;
1046
+ preparationAuditId: string;
1047
+ }): Promise<ViraResponse<ClientBody> | null>;
1048
+ /** Read target-unit STAGED route version; no access to credentials or traffic. */
1049
+ getAISystemCutoverRouteStage(systemId: string): Promise<ViraResponse<ClientBody> | null>;
1050
+ /** Link a completed, currently approved F16 Strategy execution to this STAGED receipt. */
1051
+ recordAISystemCutoverBehaviorEvidence(systemId: string, input: {
1052
+ expectedVersion: number;
1053
+ runtimeReceiptId: string;
1054
+ strategyExecutionId: string;
1055
+ }): Promise<ViraResponse<ClientBody> | null>;
1056
+ /** Explicit billable connectivity probe, not model behavior certification. */
1057
+ enqueueAISystemCutoverProviderProbe(systemId: string, input: {
1058
+ expectedVersion: number;
1059
+ runtimeReceiptId: string;
1060
+ reason: string;
1061
+ acknowledgeBillable: true;
1062
+ }): Promise<ViraResponse<ClientBody> | null>;
1063
+ /** Revoke exactly one STAGED route version; no live traffic is modified. */
1064
+ withdrawAISystemCutoverRouteStage(systemId: string, input: {
1065
+ expectedVersion: number;
1066
+ reason: string;
1067
+ }): Promise<ViraResponse<ClientBody> | null>;
1068
+ /** Inspect the committed route generation without exposing provider secrets. */
1069
+ getAISystemLiveRoute(systemId: string): Promise<ViraResponse<ClientBody> | null>;
1070
+ /** Independent target-department acceptance; never activates by itself. */
1071
+ acceptAISystemLiveActivation(systemId: string, input: {
1072
+ expectedVersion: number;
1073
+ expectedGeneration: number;
1074
+ runtimeReceiptId: string;
1075
+ reason: string;
1076
+ }): Promise<ViraResponse<ClientBody> | null>;
1077
+ /** Organization owner commits with a separately issued target approval. */
1078
+ activateAISystemLiveRoute(systemId: string, input: {
1079
+ targetUnitId: string;
1080
+ activationConsentAuditId: string;
1081
+ reason: string;
1082
+ }): Promise<ViraResponse<ClientBody> | null>;
1083
+ /** Independent approval to restore SOURCE for one exact ACTIVE generation. */
1084
+ acceptAISystemLiveRollback(systemId: string, input: {
1085
+ expectedGeneration: number;
1086
+ reason: string;
1087
+ }): Promise<ViraResponse<ClientBody> | null>;
1088
+ /** Roll back exactly once, guarded by previous-generation and host fences. */
1089
+ rollbackAISystemLiveRoute(systemId: string, input: {
1090
+ targetUnitId: string;
1091
+ rollbackConsentAuditId: string;
1092
+ reason: string;
1093
+ }): Promise<ViraResponse<ClientBody> | null>;
1094
+ /**
1095
+ * Reconcile an UNCERTAIN host model/tool call only with a server-verified
1096
+ * completed effect receipt. No provider retry or AI Credit mutation.
1097
+ */
1098
+ reconcileAISystemHostInvocation(systemId: string, input: {
1099
+ invocationId: string;
1100
+ resultReceiptId: string;
1101
+ reason: string;
1102
+ }): Promise<ViraResponse<ClientBody> | null>;
1103
+ /**
1104
+ * Release only an uninvoked, failed F4 provider probe's RESERVED AI Credits.
1105
+ * No unknown-outcome refund, duplicate model call, or automatic settlement.
1106
+ */
1107
+ releaseUninvokedAISystemProbeCredit(systemId: string, input: {
1108
+ probeJobId: string;
1109
+ reservationId: string;
1110
+ reason: string;
1111
+ }): Promise<ViraResponse<ClientBody> | null>;
1112
+ /**
1113
+ * Read-only bounded blocker identities for manual departmental reconciliation.
1114
+ * This does not retry providers, release credits or approve ACTIVE routing.
1115
+ */
1116
+ inspectAISystemCutoverDrainCases(systemId: string, input: {
1117
+ expectedVersion: number;
1118
+ }): Promise<ViraResponse<ClientBody> | null>;
1119
+ /**
1120
+ * Operator-only readback of queued/in-flight F4 jobs, unresolved provider
1121
+ * invocations and outstanding departmental credit holds across versions.
1122
+ * Never authorizes ACTIVE traffic or triggers a model call.
1123
+ */
1124
+ inspectAISystemCutoverDrain(systemId: string, input: {
1125
+ expectedVersion: number;
1126
+ }): Promise<ViraResponse<ClientBody> | null>;
1127
+ /** Read proof of a runtime policy admission; not provider success or cutover. */
1128
+ inspectAISystemCutoverAdmission(systemId: string, input: {
1129
+ expectedVersion: number;
1130
+ runtimeReceiptId?: string;
1131
+ }): Promise<ViraResponse<ClientBody> | null>;
1132
+ /** Target admin consents only to a STAGED route, not traffic switching. */
1133
+ acceptAISystemCutoverRoute(systemId: string, input: {
1134
+ successorAiSystemId: string;
1135
+ successorConnectionId: string;
1136
+ preparationAuditId: string;
1137
+ expectedVersion: number | null;
1138
+ reason: string;
1139
+ }): Promise<ViraResponse<ClientBody> | null>;
1140
+ /** Independent organization owner CAS-stages an inert route record. */
1141
+ stageAISystemCutoverRoute(systemId: string, input: {
1142
+ successorAiSystemId: string;
1143
+ successorConnectionId: string;
1144
+ preparationAuditId: string;
1145
+ expectedVersion: number | null;
1146
+ routeAcceptanceAuditId: string;
1147
+ reason: string;
1148
+ }): Promise<ViraResponse<ClientBody> | null>;
1149
+ /** Target department admin signs a 10-minute, scope-locked acceptance. */
1150
+ acceptAISystemOwnershipTransfer(systemId: string, input: {
1151
+ expectedOwnerUnitId: string;
1152
+ reason: string;
1153
+ }): Promise<ViraResponse<ClientBody> | null>;
1154
+ /** Existing organization owner finalizes an independently accepted transfer. */
1155
+ commitAISystemOwnershipTransfer(systemId: string, input: {
1156
+ expectedOwnerUnitId: string;
1157
+ targetUnitId: string;
1158
+ acceptanceAuditId: string;
1159
+ reason: string;
1160
+ }): Promise<ViraResponse<ClientBody> | null>;
1161
+ listAISystems(options?: ScopedListOptions): Promise<ViraResponse<AISystemListResult> | null>;
1162
+ deleteAISystem(systemId: string, options?: {
1163
+ confirm?: boolean;
1164
+ idempotencyKey?: string;
1165
+ }): Promise<ViraResponse<ClientBody> | null>;
1166
+ deleteAISystemCascade(systemId: string, options?: {
1167
+ confirm?: boolean;
1168
+ deleteObservations?: boolean;
1169
+ idempotencyKey?: string;
1170
+ }): Promise<ViraResponse<ClientBody> | null>;
1171
+ getAISystem(systemId: string): Promise<ViraResponse<{
1172
+ system: AISystemRecord;
1173
+ }> | null>;
1174
+ connectAdapter(systemId: string, input: {
1175
+ id?: string;
1176
+ adapterType: string;
1177
+ adapterVersion: string;
1178
+ capabilities?: readonly string[];
1179
+ config?: unknown;
1180
+ idempotencyKey?: string;
1181
+ }): Promise<ViraResponse<AISystemConnectionCreateResult> | null>;
1182
+ connectOnce(input: {
1183
+ id?: string;
1184
+ name: string;
1185
+ systemType: string;
1186
+ organizationId: string;
1187
+ projectId: string;
1188
+ environmentId: string;
1189
+ adapterType: string;
1190
+ adapterVersion: string;
1191
+ capabilities?: readonly string[];
1192
+ config?: unknown;
1193
+ idempotencyKey?: string;
1194
+ reuseExistingConnectionOnConflict?: boolean;
1195
+ }): Promise<ViraResponse<ConnectOnceResult> | null>;
1196
+ /** Canonical verb-noun name; connectOnce remains for source compatibility. */
1197
+ connectAiSystem(input: Parameters<ViraClient['connectOnce']>[0]): Promise<ViraResponse<ConnectOnceResult> | null>;
1198
+ observe(event: ClientObservation, options?: {
1199
+ idempotencyKey?: string;
1200
+ }): Promise<ViraResponse<ObservationAdmissionResult> | null>;
1201
+ listObservations(input?: {
1202
+ limit?: number;
1203
+ cursor?: string;
1204
+ }): Promise<ViraResponse<ClientBody> | null>;
1205
+ getObservation(eventId: string): Promise<ViraResponse<ClientBody> | null>;
1206
+ /** Admin-only: supersede one admitted event with another in the same unit. */
1207
+ supersedeObservation(input: {
1208
+ tombstoneEventId: string;
1209
+ targetEventId: string;
1210
+ targetEventVersion: string;
1211
+ reason?: string;
1212
+ }, options?: {
1213
+ idempotencyKey?: string;
1214
+ }): Promise<ViraResponse<ClientBody> | null>;
1215
+ /** Admin-only: create or replay a department-scoped historical backfill. */
1216
+ beginObservationBackfill(input: {
1217
+ id: string;
1218
+ windowStart: string;
1219
+ windowEnd: string;
1220
+ reason?: string;
1221
+ checkpointRequired?: boolean;
1222
+ }, options?: {
1223
+ idempotencyKey?: string;
1224
+ }): Promise<ViraResponse<ClientBody> | null>;
1225
+ /** Admin-only: finalize processed events within the department backfill window. */
1226
+ completeObservationBackfill(id: string, options?: {
1227
+ idempotencyKey?: string;
1228
+ reason?: string;
1229
+ }): Promise<ViraResponse<ClientBody> | null>;
1230
+ /** Read-only advisory status; finalization rechecks under PostgreSQL locks. */
1231
+ getObservationBackfillReadiness(id: string): Promise<ViraResponse<ClientBody> | null>;
1232
+ /** Read-only: scoped lineage and checkpoint summary, without raw cursor. */
1233
+ getObservationBackfillHistory(id: string): Promise<ViraResponse<ClientBody> | null>;
1234
+ /** Admin-only: keep completed history and activate a reviewed successor. */
1235
+ reviseObservationBackfill(id: string, input: {
1236
+ successorId: string;
1237
+ reason: string;
1238
+ }, options?: {
1239
+ idempotencyKey?: string;
1240
+ }): Promise<ViraResponse<ClientBody> | null>;
1241
+ /** Read-only. The SDK cannot manufacture a trusted runtime evidence receipt. */
1242
+ listTrajectoryRuntimeEvidence(trajectoryKey: string): Promise<ViraResponse<ClientBody> | null>;
1243
+ trace(event: ClientObservationScope & {
1244
+ eventId: string;
1245
+ aiSystemId: string;
1246
+ connectionId: string;
1247
+ traceId?: string;
1248
+ spanId?: string;
1249
+ [key: string]: unknown;
1250
+ }, options?: {
1251
+ idempotencyKey?: string;
1252
+ }): Promise<ViraResponse<ObservationAdmissionResult> | null>;
1253
+ searchRuntimeTraces(query?: {
1254
+ limit?: number;
1255
+ cursor?: string;
1256
+ query?: string;
1257
+ event?: string;
1258
+ }): Promise<ViraResponse<RuntimeTraceSearchResult> | null>;
1259
+ startOptimization(input: Record<string, unknown>, options?: {
1260
+ idempotencyKey?: string;
1261
+ }): Promise<ViraResponse<ClientBody> | null>;
1262
+ resumeOptimization(input: Record<string, unknown>, options?: {
1263
+ idempotencyKey?: string;
1264
+ }): Promise<ViraResponse<ClientBody> | null>;
1265
+ promoteOptimizationRun(runId: string, evaluationId: string, expectedVersion: number | null, options?: {
1266
+ idempotencyKey?: string;
1267
+ }): Promise<ViraResponse<ClientBody> | null>;
1268
+ getOptimizationRun(runId: string): Promise<ViraResponse<ClientBody> | null>;
1269
+ reviewOptimizationRun(runId: string): Promise<ViraResponse<ClientBody> | null>;
1270
+ reattachOptimizationRun(runId: string, options?: {
1271
+ idempotencyKey?: string;
1272
+ }): Promise<ViraResponse<ClientBody> | null>;
1273
+ cancelOptimizationRun(runId: string, options?: {
1274
+ idempotencyKey?: string;
1275
+ }): Promise<ViraResponse<ClientBody> | null>;
1276
+ outcome(event: ClientObservationScope & {
1277
+ eventId: string;
1278
+ aiSystemId: string;
1279
+ connectionId: string;
1280
+ [key: string]: unknown;
1281
+ }, options?: {
1282
+ idempotencyKey?: string;
1283
+ }): Promise<ViraResponse<ObservationAdmissionResult> | null>;
1284
+ feedback(event: ClientObservationScope & {
1285
+ eventId: string;
1286
+ aiSystemId: string;
1287
+ connectionId: string;
1288
+ [key: string]: unknown;
1289
+ }, options?: {
1290
+ idempotencyKey?: string;
1291
+ }): Promise<ViraResponse<ObservationAdmissionResult> | null>;
1292
+ recordBusinessOutcome(event: Parameters<ViraClient['outcome']>[0], options?: {
1293
+ idempotencyKey?: string;
1294
+ }): Promise<ViraResponse<ObservationAdmissionResult> | null>;
1295
+ recordUserFeedback(event: Parameters<ViraClient['feedback']>[0], options?: {
1296
+ idempotencyKey?: string;
1297
+ }): Promise<ViraResponse<ObservationAdmissionResult> | null>;
1298
+ observeBatch(events: readonly (ClientObservationScope & {
1299
+ eventId: string;
1300
+ eventType: string;
1301
+ aiSystemId: string;
1302
+ connectionId: string;
1303
+ [key: string]: unknown;
1304
+ })[], options?: {
1305
+ idempotencyKey?: string;
1306
+ }): Promise<ViraResponse<ObservationAdmissionResult> | null>;
1307
+ observeSdk(delivery: ClientBody, options?: {
1308
+ idempotencyKey?: string;
1309
+ }): Promise<ViraResponse<ObservationAdmissionResult> | null>;
1310
+ discover(options?: {
1311
+ reviewState?: string;
1312
+ limit?: number;
1313
+ cursor?: string;
1314
+ search?: string;
1315
+ }): Promise<ViraResponse<DiscoveryCandidateListResult> | null>;
1316
+ reviewDiscoveryCandidate(kind: string, key: string, input: ClientBody, options?: {
1317
+ idempotencyKey?: string;
1318
+ }): Promise<ViraResponse<DiscoveryCandidateReviewResult> | null>;
1319
+ /** Explicit canonical publication; API approval and scope checks still apply. */
1320
+ publishDiscoveryCandidate(kind: string, key: string, input?: {
1321
+ taskId?: string;
1322
+ controlPointId?: string;
1323
+ }, options?: {
1324
+ idempotencyKey?: string;
1325
+ }): Promise<ViraResponse<DiscoveryCandidatePublishResult> | null>;
1326
+ createSignalDiscoveryProposal(input: ClientBody, options?: {
1327
+ idempotencyKey?: string;
1328
+ }): Promise<ViraResponse<ClientBody> | null>;
1329
+ reviewSignalDiscoveryProposal(proposalId: string, decision: "APPROVE" | "REJECT", options?: {
1330
+ idempotencyKey?: string;
1331
+ }): Promise<ViraResponse<ClientBody> | null>;
1332
+ materializeSignalDiscovery(proposalId: string, input?: ClientBody, options?: {
1333
+ idempotencyKey?: string;
1334
+ }): Promise<ViraResponse<ClientBody> | null>;
1335
+ createSignalMapping(input: ClientBody, options?: {
1336
+ idempotencyKey?: string;
1337
+ }): Promise<ViraResponse<ClientBody> | null>;
1338
+ getSignalMapping(mappingId: string): Promise<ViraResponse<ClientBody> | null>;
1339
+ reviewSignalMapping(mappingId: string, input?: ClientBody, options?: {
1340
+ idempotencyKey?: string;
1341
+ }): Promise<ViraResponse<ClientBody> | null>;
1342
+ connectionHealth(connectionId: string): Promise<ViraResponse<ConnectionHealthResult> | null>;
1343
+ getConnection(connectionId: string): Promise<ViraResponse<AISystemConnectionDetailResult> | null>;
1344
+ listSystemConnections(systemId: string, options?: ScopedListOptions): Promise<ViraResponse<ClientBody> | null>;
1345
+ inventory(systemId: string): Promise<ViraResponse<AISystemInventoryResult> | null>;
1346
+ listPacks(options?: ScopedListOptions): Promise<ViraResponse<{
1347
+ packs: readonly ClientBody[];
1348
+ }> | null>;
1349
+ getPack(packId: string): Promise<ViraResponse<ClientBody> | null>;
1350
+ deletePack(packId: string, options?: {
1351
+ confirm?: boolean;
1352
+ idempotencyKey?: string;
1353
+ }): Promise<ViraResponse<ClientBody> | null>;
1354
+ importPack(input: {
1355
+ manifest?: unknown;
1356
+ objects?: Record<string, unknown>;
1357
+ archiveBase64?: string;
1358
+ fileName?: string;
1359
+ idempotencyKey?: string;
1360
+ }): Promise<ViraResponse<ClientBody> | null>;
1361
+ installPack(packId: string, variables?: Record<string, unknown>): Promise<ViraResponse<ClientBody> | null>;
1362
+ diagnosePack(packId: string, input?: {
1363
+ runtimeBindings?: readonly string[];
1364
+ knownVerifiers?: readonly string[];
1365
+ }): Promise<ViraResponse<ClientBody> | null>;
1366
+ evaluatePack(packId: string, input: {
1367
+ evaluationId: string;
1368
+ }): Promise<ViraResponse<ClientBody> | null>;
1369
+ approvePack(packId: string, options?: {
1370
+ manualApproval?: boolean;
1371
+ reason?: string;
1372
+ }): Promise<ViraResponse<ClientBody> | null>;
1373
+ releasePack(packId: string): Promise<ViraResponse<ClientBody> | null>;
1374
+ previewPackUpgrade(packId: string, incoming: ClientBody): Promise<ViraResponse<ClientBody> | null>;
1375
+ executeRuntime(input: RuntimeRequest & Record<string, unknown>): Promise<ViraResponse<ClientBody> | null>;
1376
+ resolveRuntime(input: {
1377
+ behaviorPoint?: string;
1378
+ executionBoundary?: Record<string, unknown>;
1379
+ semanticContext?: Record<string, unknown>;
1380
+ signalAttestationRefs?: readonly {
1381
+ stableKey: string;
1382
+ mappingId: string;
1383
+ eventId: string;
1384
+ }[];
1385
+ idempotencyKey?: string;
1386
+ }): Promise<ViraResponse<RuntimeResolution> | null>;
1387
+ /** Resolve a runtime route from a governed execution boundary and semantic context. */
1388
+ resolveBoundary(input: {
1389
+ executionBoundary: Record<string, unknown>;
1390
+ semanticContext?: Record<string, unknown>;
1391
+ idempotencyKey?: string;
1392
+ }): Promise<ViraResponse<RuntimeResolution> | null>;
1393
+ /** Inspect historical rate candidates using an authenticated delegated user session. */
1394
+ inspectLegacyPricing(reservationId: string): Promise<ViraResponse<{
1395
+ status: "REVIEW_REQUIRED";
1396
+ reviewDigest: string;
1397
+ review: Record<string, unknown>;
1398
+ }> | null>;
1399
+ /** Create a short-lived proposal. This never pins rates or debits credits. */
1400
+ proposeLegacyPricing(input: {
1401
+ reservationId: string;
1402
+ reviewDigest: string;
1403
+ evidenceReference: string;
1404
+ }): Promise<ViraResponse<{
1405
+ status: "AWAITING_INDEPENDENT_APPROVAL";
1406
+ proposalId: string;
1407
+ reviewDigest: string;
1408
+ expiresAt: string;
1409
+ }> | null>;
1410
+ /** Approve only from a different active actor/session; the server enforces independence. */
1411
+ approveLegacyPricing(input: {
1412
+ reservationId: string;
1413
+ reviewDigest: string;
1414
+ proposalId: string;
1415
+ }): Promise<ViraResponse<{
1416
+ status: "PINNED_FOR_RECONCILIATION";
1417
+ reservationId: string;
1418
+ reviewDigest: string;
1419
+ }> | null>;
1420
+ inspectLegacyPromotionReconciliation(input?: ClientBody): Promise<ViraResponse<ClientBody> | null>;
1421
+ proposeLegacyPromotionReconciliation(input: ClientBody): Promise<ViraResponse<ClientBody> | null>;
1422
+ approveLegacyPromotionReconciliation(input: ClientBody): Promise<ViraResponse<ClientBody> | null>;
1423
+ historyLegacyPromotionReconciliation(input?: ClientBody): Promise<ViraResponse<ClientBody> | null>;
1424
+ inspectLegacyRecordRemediation(input?: ClientBody): Promise<ViraResponse<ClientBody> | null>;
1425
+ proposeLegacyRecordRemediation(input: ClientBody): Promise<ViraResponse<ClientBody> | null>;
1426
+ approveLegacyRecordRemediation(input: ClientBody): Promise<ViraResponse<ClientBody> | null>;
1427
+ historyLegacyRecordRemediation(input?: ClientBody): Promise<ViraResponse<ClientBody> | null>;
1428
+ inspectSubjectSignalConsent(input: {
1429
+ eventId: string;
1430
+ mappingId: string;
1431
+ }): Promise<ViraResponse<ClientBody> | null>;
1432
+ grantSubjectSignalConsent(input: {
1433
+ eventId: string;
1434
+ mappingId: string;
1435
+ consentBindingDigest: string;
1436
+ confirmSelfSubject: true;
1437
+ confirmServiceDeliveryConsent: true;
1438
+ }): Promise<ViraResponse<ClientBody> | null>;
1439
+ withdrawSubjectSignalConsent(input: {
1440
+ consentId: string;
1441
+ }): Promise<ViraResponse<ClientBody> | null>;
1442
+ admitSubjectTeachEvidence(input: ClientBody): Promise<ViraResponse<ClientBody> | null>;
1443
+ withdrawSubjectTeachEvidence(input: {
1444
+ evidenceId: string;
1445
+ }): Promise<ViraResponse<ClientBody> | null>;
1446
+ historySubjectTeachEvidence(input?: ClientBody): Promise<ViraResponse<ClientBody> | null>;
1447
+ private validateLegacyPricingIdentity;
1448
+ /** Provider account usage only; never a managed charge or TaskRun completion. */
1449
+ verifyExternalProviderUsage(input: {
1450
+ aiSystemId: string;
1451
+ connectionId: string;
1452
+ generationId: string;
1453
+ providerId: "openai" | "openrouter" | "xai" | "gemini";
1454
+ }): Promise<ViraResponse<{
1455
+ evidence: {
1456
+ schemaVersion: 1;
1457
+ providerId: "openai" | "openrouter" | "xai" | "gemini";
1458
+ providerRequestId: string;
1459
+ modelId: string;
1460
+ upstreamProvider: string;
1461
+ occurredAt: string;
1462
+ inputTokens: number;
1463
+ outputTokens: number;
1464
+ chargeClass: "byok";
1465
+ authority: "PROVIDER_ACCOUNT_VERIFIED";
1466
+ settlementStatus: "NOT_CHARGEABLE";
1467
+ managedCreditEligible: false;
1468
+ taskRunCompletionEligible: false;
1469
+ customerMicrocredits: 0;
1470
+ };
1471
+ evidenceDigest: string;
1472
+ }> | null>;
1473
+ /** Explicit first-party model transport. BYOK host observations remain non-chargeable. */
1474
+ executeManagedChat(input: {
1475
+ aiSystemId: string;
1476
+ connectionId: string;
1477
+ operationId: string;
1478
+ model: string;
1479
+ messages: readonly Record<string, unknown>[];
1480
+ max_tokens?: number;
1481
+ max_completion_tokens?: number;
1482
+ temperature?: number;
1483
+ top_p?: number;
1484
+ response_format?: Record<string, unknown>;
1485
+ tools?: readonly Record<string, unknown>[];
1486
+ tool_choice?: unknown;
1487
+ parallel_tool_calls?: boolean;
1488
+ }): Promise<ViraResponse<ClientBody> | null>;
1489
+ /** Classify input only; use resolveRuntime for one BehaviorPoint or resolveTaskRun/startTaskRun for TaskRun routing and execution. */
1490
+ resolveSemantic(input: {
1491
+ input: string;
1492
+ aiSystemId?: string;
1493
+ profile?: Record<string, unknown>;
1494
+ sessionId?: string;
1495
+ selection?: Record<string, unknown>;
1496
+ candidates?: readonly string[];
1497
+ timeoutMs?: number;
1498
+ requestId?: string;
1499
+ executionBoundary?: Record<string, unknown>;
1500
+ idempotencyKey?: string;
1501
+ }): Promise<ViraResponse<ClientBody> | null>;
1502
+ resolveSemanticRuntime(input: {
1503
+ input: string;
1504
+ aiSystemId?: string;
1505
+ profile?: Record<string, unknown>;
1506
+ sessionId?: string;
1507
+ timeoutMs?: number;
1508
+ requestId?: string;
1509
+ revisionId?: string;
1510
+ executionBoundary?: Record<string, unknown>;
1511
+ signalAttestationRefs?: readonly {
1512
+ stableKey: string;
1513
+ mappingId: string;
1514
+ eventId: string;
1515
+ }[];
1516
+ idempotencyKey?: string;
1517
+ }): Promise<{
1518
+ semantic: ViraResponse<ClientBody>;
1519
+ runtime: ViraResponse<RuntimeResolution> | null;
1520
+ taskKeys: string[];
1521
+ capsules: ClientBody[];
1522
+ multiTask: boolean;
1523
+ } | null>;
1524
+ authorizeHostAction(input: {
1525
+ executionId: string;
1526
+ sessionId: string;
1527
+ dataVersion: string;
1528
+ scope: {
1529
+ organizationId: string;
1530
+ projectId: string;
1531
+ environmentId: string;
1532
+ organizationUnitId?: string;
1533
+ };
1534
+ context: Record<string, unknown>;
1535
+ proposal: Record<string, unknown>;
1536
+ approval?: Record<string, unknown>;
1537
+ signalAttestationRefs?: readonly {
1538
+ stableKey: string;
1539
+ mappingId: string;
1540
+ eventId: string;
1541
+ }[];
1542
+ aiSystemId?: string;
1543
+ }): Promise<ViraResponse<HostActionAuthorizationResult> | null>;
1544
+ /** Queue the approved SINGLE effect on the worker, never execute it locally. */
1545
+ queueTaskRunHostDispatch(input: {
1546
+ taskRunId: string;
1547
+ childRunId: string;
1548
+ aiSystemId: string;
1549
+ sessionId: string;
1550
+ scope: {
1551
+ organizationId: string;
1552
+ projectId: string;
1553
+ environmentId: string;
1554
+ organizationUnitId: string;
1555
+ };
1556
+ context: Record<string, unknown>;
1557
+ proposal: Record<string, unknown>;
1558
+ approvalId: string;
1559
+ }): Promise<ViraResponse<{
1560
+ status: "QUEUED";
1561
+ invocationId: string;
1562
+ clientExecutionAllowed: false;
1563
+ }>>;
1564
+ createHostActionApproval(input: {
1565
+ sessionId: string;
1566
+ dataVersion: string;
1567
+ proposal: Record<string, unknown>;
1568
+ confirmation: {
1569
+ proposalId: string;
1570
+ toolName: string;
1571
+ argumentsDigest: string;
1572
+ requestContextDigest: string;
1573
+ acknowledgedAt: string;
1574
+ };
1575
+ ttlSeconds?: number;
1576
+ }): Promise<ViraResponse<ClientBody> | null>;
1577
+ listBehaviorStrategies(options?: ScopedListOptions): Promise<ViraResponse<ClientBody> | null>;
1578
+ deleteBehaviorStrategy(strategyId: string, options?: {
1579
+ confirm?: boolean;
1580
+ idempotencyKey?: string;
1581
+ }): Promise<ViraResponse<ClientBody> | null>;
1582
+ getBehaviorStrategy(strategyId: string): Promise<ViraResponse<ClientBody> | null>;
1583
+ createBehaviorStrategy(definition: Record<string, unknown>, id?: string): Promise<ViraResponse<ClientBody> | null>;
1584
+ listSemanticTasks(options?: SemanticTaskListOptions): Promise<ViraResponse<SemanticTaskListResult> | null>;
1585
+ deleteSemanticTask(taskId: string, options?: {
1586
+ confirm?: boolean;
1587
+ idempotencyKey?: string;
1588
+ }): Promise<ViraResponse<ClientBody> | null>;
1589
+ createSemanticTask(task: {
1590
+ taskKey: string;
1591
+ description?: string;
1592
+ version?: number;
1593
+ aliases?: readonly string[];
1594
+ examples?: readonly string[];
1595
+ negativeExamples?: readonly string[];
1596
+ }, options?: {
1597
+ id?: string;
1598
+ idempotencyKey?: string;
1599
+ }): Promise<ViraResponse<SemanticTaskCreateResult> | null>;
1600
+ listBehaviorPoints(options?: BehaviorPointListOptions): Promise<ViraResponse<BehaviorPointListResult> | null>;
1601
+ deleteBehaviorPoint(pointId: string, options?: {
1602
+ confirm?: boolean;
1603
+ idempotencyKey?: string;
1604
+ }): Promise<ViraResponse<BehaviorPointDeleteResult> | null>;
1605
+ createBehaviorPoint(point: {
1606
+ key: string;
1607
+ taskId?: string;
1608
+ taskIds?: readonly string[];
1609
+ constraints?: unknown;
1610
+ }, options?: {
1611
+ id?: string;
1612
+ idempotencyKey?: string;
1613
+ }): Promise<ViraResponse<BehaviorPointCreateResult> | null>;
1614
+ createBehaviorStrategyVariant(strategyId: string, variant: Record<string, unknown>, options?: {
1615
+ idempotencyKey?: string;
1616
+ }): Promise<ViraResponse<ClientBody> | null>;
1617
+ validateBehaviorStrategy(strategyId: string): Promise<ViraResponse<ClientBody> | null>;
1618
+ activateBehaviorStrategy(strategyId: string): Promise<ViraResponse<ClientBody> | null>;
1619
+ simulateBehaviorStrategy(strategyId: string, initialState?: Record<string, unknown>): Promise<ViraResponse<ClientBody> | null>;
1620
+ startStrategyExecution(input: {
1621
+ artifactDigest: string;
1622
+ /** Optional explicitly selected release; server validates its approved lineage. */
1623
+ releaseId?: string;
1624
+ organizationId: string;
1625
+ projectId: string;
1626
+ environmentId: string;
1627
+ revisionId: string;
1628
+ idempotencyKey: string;
1629
+ nonce: string;
1630
+ expiresAt: number;
1631
+ decisionPlanId: string;
1632
+ candidates: readonly Record<string, unknown>[];
1633
+ policy: string;
1634
+ behaviorPoint?: string;
1635
+ executionBoundary?: Record<string, unknown>;
1636
+ allowedIds?: readonly string[];
1637
+ calibrationId?: string;
1638
+ postModelJudge?: unknown;
1639
+ shadow?: unknown;
1640
+ traceId?: string;
1641
+ executionId?: string;
1642
+ state?: Record<string, unknown>;
1643
+ /** Explicit successor identity; not a source-to-target traffic switch. */
1644
+ aiSystemId?: string;
1645
+ connectionId?: string;
1646
+ /** Request bounded STAGED verification, never a caller-generated route pin. */
1647
+ cutoverRouteValidation?: {
1648
+ mode: 'STAGED_VALIDATION';
1649
+ sourceAiSystemId: string;
1650
+ expectedVersion: number;
1651
+ };
1652
+ }): Promise<ViraResponse<StrategyExecutionEnvelope | StrategyExecutionQueued | StrategyExecutionResult> | null>;
1653
+ getStrategyExecution(executionId: string): Promise<ViraResponse<StrategyExecutionEnvelope> | null>;
1654
+ /** Uses the existing Strategy execution read-authorizer and unit-scoped
1655
+ * credentials. Never exposes an amount-based settlement method. */
1656
+ getAIUsageReconciliation(executionId: string): Promise<ViraResponse<AIUsageReconciliationEnvelope> | null>;
1657
+ getJob(jobId: string): Promise<ViraResponse<ClientBody> | null>;
1658
+ getConflictInspection(inspectionId: string): Promise<ViraResponse<ClientBody> | null>;
1659
+ inspectConflicts(input: {
1660
+ proposed: readonly unknown[];
1661
+ active: readonly unknown[];
1662
+ controls: readonly unknown[];
1663
+ id?: string;
1664
+ }, options?: {
1665
+ idempotencyKey?: string;
1666
+ }): Promise<ViraResponse<ClientBody> | null>;
1667
+ resolveConflictInspection(inspectionId: string, status: 'APPROVED' | 'REJECTED', options?: {
1668
+ authorityDigest?: string;
1669
+ idempotencyKey?: string;
1670
+ }): Promise<ViraResponse<ClientBody> | null>;
1671
+ listStrategyExecutions(options?: {
1672
+ limit?: number;
1673
+ cursor?: string;
1674
+ }): Promise<ViraResponse<StrategyExecutionList> | null>;
1675
+ getStrategyExecutionTrace(executionId: string): Promise<ViraResponse<StrategyExecutionTrace> | null>;
1676
+ continueStrategyExecution(executionId: string, continuation?: string | StrategyContinuationInput): Promise<ViraResponse<StrategyExecutionResult> | null>;
1677
+ cancelStrategyExecution(executionId: string): Promise<ViraResponse<StrategyExecutionEnvelope> | null>;
1678
+ listCompoundTaskPlans(options?: {
1679
+ limit?: number;
1680
+ cursor?: string;
1681
+ }): Promise<ViraResponse<ClientBody> | null>;
1682
+ saveCompoundTaskPlan(plan: Record<string, unknown>, options?: {
1683
+ idempotencyKey?: string;
1684
+ }): Promise<ViraResponse<ClientBody> | null>;
1685
+ getCompoundTaskPlan(planId: string): Promise<ViraResponse<ClientBody> | null>;
1686
+ resolveTaskRun(input: TaskRunRouteRequest): Promise<ViraResponse<ClientBody> | null>;
1687
+ startTaskRun(input: TaskRunAdmissionRequest, options?: {
1688
+ idempotencyKey?: string;
1689
+ }): Promise<ViraResponse<ClientBody> | null>;
1690
+ startTaskRunFromPrompt(input: TaskRunPromptRequest, options?: {
1691
+ idempotencyKey?: string;
1692
+ }): Promise<ViraResponse<ClientBody> | null>;
1693
+ getTaskRun(taskRunId: string): Promise<ViraResponse<ClientBody> | null>;
1694
+ getTaskRunEvidence(taskRunId: string): Promise<ViraResponse<TaskRunEvidenceResult> | null>;
1695
+ listTaskRunEvents(taskRunId: string): Promise<ViraResponse<ClientBody> | null>;
1696
+ continueTaskRun(taskRunId: string, expectedVersion: number, options?: {
1697
+ cursor?: string;
1698
+ idempotencyKey?: string;
1699
+ }): Promise<ViraResponse<ClientBody> | null>;
1700
+ cancelTaskRun(taskRunId: string, expectedVersion?: number | undefined, options?: {
1701
+ idempotencyKey?: string;
1702
+ }): Promise<ViraResponse<ClientBody> | null>;
1703
+ retryTaskRun(taskRunId: string, expectedVersion: number, options?: {
1704
+ idempotencyKey?: string;
1705
+ }): Promise<ViraResponse<ClientBody> | null>;
1706
+ listBehaviorPrograms(options?: ScopedListOptions): Promise<ViraResponse<{
1707
+ programs: readonly ClientBody[];
1708
+ }> | null>;
1709
+ listCapabilities(options?: {
1710
+ surface?: ProductCapabilitySurface;
1711
+ }): Promise<ViraResponse<ProductCapabilityCatalogResult> | null>;
1712
+ /** Read the scope actually admitted by the credential, never a caller claim.
1713
+ * Useful before attaching a host to a department-bound machine key. */
1714
+ resolveCredentialScope(expected?: Partial<ProductCapabilityScope>, options?: {
1715
+ requireDepartment?: boolean;
1716
+ }): Promise<ProductCapabilityScope>;
1717
+ getBehaviorProgram(programId: string): Promise<ViraResponse<{
1718
+ program: ClientBody;
1719
+ }> | null>;
1720
+ deleteBehaviorProgram(programId: string, options?: {
1721
+ confirm?: boolean;
1722
+ idempotencyKey?: string;
1723
+ }): Promise<ViraResponse<ClientBody> | null>;
1724
+ deleteBehaviorProgramCascade(programId: string, options?: {
1725
+ confirm?: boolean;
1726
+ purgeRuntime?: boolean;
1727
+ idempotencyKey?: string;
1728
+ }): Promise<ViraResponse<ClientBody> | null>;
1729
+ /** Authenticated draft only. Never releases or activates a behavior policy. */
1730
+ createBehaviorPolicySource(source: {
1731
+ sourceLevel: 'organization' | 'organization_unit';
1732
+ sourceId?: string;
1733
+ policyKey: string;
1734
+ revision: number;
1735
+ hard: boolean;
1736
+ modules: readonly Record<string, unknown>[];
1737
+ temporalContracts?: readonly Record<string, unknown>[];
1738
+ recoveryPlans?: readonly Record<string, unknown>[];
1739
+ }): Promise<ViraResponse<ClientBody> | null>;
1740
+ listBehaviorPolicySources(input: {
1741
+ sourceLevel: 'organization' | 'organization_unit';
1742
+ sourceId?: string;
1743
+ policyKey: string;
1744
+ }): Promise<ViraResponse<ClientBody> | null>;
1745
+ getBehaviorPolicySource(sourceRevisionId: string): Promise<ViraResponse<ClientBody> | null>;
1746
+ /** Conflict preview only. Returned canActivate=false is intentional. */
1747
+ previewBehaviorPolicyBinding(input: {
1748
+ sourceRevisionId: string;
1749
+ sourceDigest: string;
1750
+ programId: string;
1751
+ mode?: 'ACTIVATE' | 'REPLACE' | 'ROLLBACK';
1752
+ expectedCurrentBindingDigest?: string;
1753
+ }): Promise<ViraResponse<ClientBody> | null>;
1754
+ /** Preview's digest is a concurrency precondition, never approval. */
1755
+ getCurrentBehaviorPolicyBinding(policyKey: string, options?: {
1756
+ sourceLevel?: 'organization' | 'organization_unit';
1757
+ sourceId?: string;
1758
+ }): Promise<ViraResponse<ClientBody> | null>;
1759
+ /** One non-retryable, server-reviewed PostgreSQL transaction. */
1760
+ commitBehaviorPolicyBinding(input: {
1761
+ mode: 'ACTIVATE' | 'REPLACE' | 'ROLLBACK';
1762
+ sourceRevisionId: string;
1763
+ sourceDigest: string;
1764
+ programId: string;
1765
+ programDigest: string;
1766
+ expectedPolicySnapshotDigest: string;
1767
+ expectedCurrentBindingDigest?: string;
1768
+ reason: string;
1769
+ }): Promise<ViraResponse<ClientBody> | null>;
1770
+ /** Read-only full blast-radius simulation. Digest is a CAS precondition, not approval. */
1771
+ previewWideBehaviorPolicyImpact(input: {
1772
+ mode: 'ACTIVATE' | 'REPLACE' | 'ROLLBACK';
1773
+ sourceRevisionId: string;
1774
+ sourceDigest: string;
1775
+ expectedCurrentBindingDigest?: string;
1776
+ }): Promise<ViraResponse<ClientBody> | null>;
1777
+ /** Independent owner approval + server-revalidated impact under one transaction. */
1778
+ commitWideBehaviorPolicyBinding(input: {
1779
+ mode: 'ACTIVATE' | 'REPLACE' | 'ROLLBACK';
1780
+ sourceRevisionId: string;
1781
+ sourceDigest: string;
1782
+ expectedImpactDigest: string;
1783
+ expectedCurrentBindingDigest?: string;
1784
+ reason: string;
1785
+ }): Promise<ViraResponse<ClientBody> | null>;
1786
+ createBehaviorProgram(program: ClientBody, options?: {
1787
+ idempotencyKey?: string;
1788
+ }): Promise<ViraResponse<{
1789
+ program: ClientBody;
1790
+ }> | null>;
1791
+ attestCapabilities(attestation: ClientBody, options?: {
1792
+ idempotencyKey?: string;
1793
+ }): Promise<ViraResponse<ClientBody> | null>;
1794
+ resolveCapabilities(attestationId: string, request: ClientBody, options?: {
1795
+ idempotencyKey?: string;
1796
+ }): Promise<ViraResponse<ClientBody> | null>;
1797
+ recordCapabilityTrace(decisionDigest: string, trace: ClientBody, options?: {
1798
+ idempotencyKey?: string;
1799
+ }): Promise<ViraResponse<ClientBody> | null>;
1800
+ resolveModelServing(request: ClientBody, options?: {
1801
+ idempotencyKey?: string;
1802
+ }): Promise<ViraResponse<ClientBody> | null>;
1803
+ recordModelServingTrace(trace: ClientBody, selection: ClientBody, options?: {
1804
+ idempotencyKey?: string;
1805
+ }): Promise<ViraResponse<ClientBody> | null>;
1806
+ submitTeachEvidence(evidence: ClientBody, options?: {
1807
+ idempotencyKey?: string;
1808
+ }): Promise<ViraResponse<ClientBody> | null>;
1809
+ submitTeachConversationEvidence(evidence: ClientBody, options?: {
1810
+ idempotencyKey?: string;
1811
+ }): Promise<ViraResponse<ClientBody> | null>;
1812
+ listConversationArchive(input?: {
1813
+ limit?: number;
1814
+ cursor?: string;
1815
+ }): Promise<ViraResponse<ClientBody> | null>;
1816
+ importConversationArchive(conversations: readonly ClientBody[], options?: {
1817
+ idempotencyKey?: string;
1818
+ }): Promise<ViraResponse<ClientBody> | null>;
1819
+ revokeConversation(evidenceId: string, reason: string, options?: {
1820
+ idempotencyKey?: string;
1821
+ }): Promise<ViraResponse<ClientBody> | null>;
1822
+ createTeachAnalysis(evidenceIds: readonly string[], options?: {
1823
+ idempotencyKey?: string;
1824
+ analysisId?: string;
1825
+ controlPointId?: string;
1826
+ summary?: string;
1827
+ }): Promise<ViraResponse<ClientBody> | null>;
1828
+ getTeachAnalysis(analysisId: string): Promise<ViraResponse<ClientBody> | null>;
1829
+ listTeachAnalyses(): Promise<ViraResponse<ClientBody> | null>;
1830
+ createCrossConversationTeachAnalysis(input: {
1831
+ conversationRefs: readonly ClientBody[];
1832
+ analysisId?: string;
1833
+ controlPointId?: string;
1834
+ objective?: string;
1835
+ }, options?: {
1836
+ idempotencyKey?: string;
1837
+ }): Promise<ViraResponse<ClientBody> | null>;
1838
+ createTeachProposal(input: ClientBody, options?: {
1839
+ idempotencyKey?: string;
1840
+ }): Promise<ViraResponse<ClientBody> | null>;
1841
+ getTeachRunBehaviorSet(teachRunId: string): Promise<ViraResponse<ClientBody> | null>;
1842
+ listTeachRuns(input?: {
1843
+ limit?: number;
1844
+ cursor?: string;
1845
+ status?: string;
1846
+ }): Promise<ViraResponse<ClientBody> | null>;
1847
+ getTeachRunRecommendation(teachRunId: string): Promise<ViraResponse<ClientBody> | null>;
1848
+ acceptTeachRecommendation(teachRunId: string, actorId: string, options?: {
1849
+ idempotencyKey?: string;
1850
+ }): Promise<ViraResponse<ClientBody> | null>;
1851
+ rejectTeachRecommendation(teachRunId: string, reason: string, options?: {
1852
+ idempotencyKey?: string;
1853
+ }): Promise<ViraResponse<ClientBody> | null>;
1854
+ editTeachRecommendation(teachRunId: string, input: {
1855
+ revisionId: string;
1856
+ reason: string;
1857
+ behaviorSet: ClientBody;
1858
+ }, options?: {
1859
+ idempotencyKey?: string;
1860
+ }): Promise<ViraResponse<ClientBody> | null>;
1861
+ transitionTeachProposal(proposalId: string, transition: 'review' | 'evaluate' | 'promote', input?: ClientBody, options?: {
1862
+ idempotencyKey?: string;
1863
+ }): Promise<ViraResponse<ClientBody> | null>;
1864
+ requestTeachProposalChanges(proposalId: string, feedback: string, options?: {
1865
+ idempotencyKey?: string;
1866
+ }): Promise<ViraResponse<ClientBody> | null>;
1867
+ /** Start a standalone or comparative evaluation; use evaluatePack for Pack lifecycle evaluation. */
1868
+ startEvaluation(input: ClientBody, options?: {
1869
+ idempotencyKey?: string;
1870
+ }): Promise<ViraResponse<ClientBody> | null>;
1871
+ /** Request a server-executed OFF/current-ON/candidate-ON comparison.
1872
+ * The server owns arm execution and receipts; callers cannot submit outputs.
1873
+ */
1874
+ startComparativeEvaluation(input: ClientBody & {
1875
+ comparisonPlan: ClientBody;
1876
+ }, options?: {
1877
+ idempotencyKey?: string;
1878
+ }): Promise<ViraResponse<ClientBody> | null>;
1879
+ evaluateQuality(input: ClientBody, options?: {
1880
+ idempotencyKey?: string;
1881
+ }): Promise<ViraResponse<ClientBody> | null>;
1882
+ getEvaluation(evaluationId: string): Promise<ViraResponse<ClientBody> | null>;
1883
+ listEvaluations(input?: {
1884
+ limit?: number;
1885
+ cursor?: string;
1886
+ status?: string;
1887
+ }): Promise<ViraResponse<ClientBody> | null>;
1888
+ getEvaluationComparison(evaluationId: string): Promise<ViraResponse<ClientBody> | null>;
1889
+ reviewComparativeFinding(evaluationId: string, findingId: string, input: {
1890
+ decision: 'ACCEPT' | 'REJECT' | 'EDIT' | 'MORE_EVIDENCE';
1891
+ reason?: string;
1892
+ }, options?: {
1893
+ idempotencyKey?: string;
1894
+ }): Promise<ViraResponse<ClientBody> | null>;
1895
+ createEvaluationPlan(input: ClientBody, options?: {
1896
+ idempotencyKey?: string;
1897
+ }): Promise<ViraResponse<ClientBody> | null>;
1898
+ getEvaluationPlan(planId: string): Promise<ViraResponse<ClientBody> | null>;
1899
+ sealEvaluationPlan(planId: string, options?: {
1900
+ idempotencyKey?: string;
1901
+ }): Promise<ViraResponse<ClientBody> | null>;
1902
+ createImprovementProposal(evaluationId: string, input: ClientBody, options?: {
1903
+ idempotencyKey?: string;
1904
+ }): Promise<ViraResponse<EvaluationImprovementProposalCreateResult> | null>;
1905
+ getImprovementProposal(proposalId: string): Promise<ViraResponse<ClientBody> | null>;
1906
+ reviewImprovementProposal(proposalId: string, action?: 'request-review' | 'approve' | 'reject', options?: {
1907
+ idempotencyKey?: string;
1908
+ }): Promise<ViraResponse<ClientBody> | null>;
1909
+ editImprovementProposalAsNew(proposalId: string, input: {
1910
+ id: string;
1911
+ behaviorSet: ClientBody;
1912
+ reason: string;
1913
+ }, options?: {
1914
+ idempotencyKey?: string;
1915
+ }): Promise<ViraResponse<ClientBody> | null>;
1916
+ createBehaviorRevisionCandidate(input: ClientBody, options?: {
1917
+ idempotencyKey?: string;
1918
+ }): Promise<ViraResponse<ClientBody> | null>;
1919
+ evaluateBehaviorRevisionCandidate(candidateId: string, input: ClientBody, options?: {
1920
+ idempotencyKey?: string;
1921
+ }): Promise<ViraResponse<ClientBody> | null>;
1922
+ transitionBehaviorRevisionCandidate(candidateId: string, transition: 'evaluate' | 'accept' | 'reject' | 'pack', input?: ClientBody, options?: {
1923
+ idempotencyKey?: string;
1924
+ }): Promise<ViraResponse<ClientBody> | null>;
1925
+ createPackRevision(input: ClientBody, options?: {
1926
+ idempotencyKey?: string;
1927
+ }): Promise<ViraResponse<ClientBody> | null>;
1928
+ getPackRevision(revisionId: string): Promise<ViraResponse<ClientBody> | null>;
1929
+ getPackRevisionDiff(revisionId: string): Promise<ViraResponse<ClientBody> | null>;
1930
+ transitionPackRevision(revisionId: string, transition: 'validate' | 'request-approval' | 'approve' | 'release' | 'reject', options?: {
1931
+ idempotencyKey?: string;
1932
+ }): Promise<ViraResponse<ClientBody> | null>;
1933
+ materializePackRevision(revisionId: string, input: ClientBody, options?: {
1934
+ idempotencyKey?: string;
1935
+ }): Promise<ViraResponse<ClientBody> | null>;
1936
+ createRelease(input: ClientBody, options?: {
1937
+ idempotencyKey?: string;
1938
+ }): Promise<ViraResponse<ClientBody> | null>;
1939
+ createManualRelease(input: ClientBody, options?: {
1940
+ idempotencyKey?: string;
1941
+ }): Promise<ViraResponse<ClientBody> | null>;
1942
+ releaseProgramManually(input: {
1943
+ programId: string;
1944
+ reason: string;
1945
+ }, options?: {
1946
+ idempotencyKey?: string;
1947
+ }): Promise<ViraResponse<ClientBody> | null>;
1948
+ retireProgramPointer(pointerKey: string, input: {
1949
+ confirm: true;
1950
+ expectedVersion: number;
1951
+ reason: string;
1952
+ }, options?: {
1953
+ idempotencyKey?: string;
1954
+ }): Promise<ViraResponse<ClientBody> | null>;
1955
+ recordDeploymentComparison(deploymentId: string, comparison: ClientBody, options?: {
1956
+ idempotencyKey?: string;
1957
+ }): Promise<ViraResponse<ClientBody> | null>;
1958
+ recordDeploymentHealth(deploymentId: string, health: ClientBody, options?: {
1959
+ idempotencyKey?: string;
1960
+ }): Promise<ViraResponse<ClientBody> | null>;
1961
+ compileBehaviorCapsule(input: {
1962
+ programId: string;
1963
+ input: string;
1964
+ selection?: Record<string, unknown>;
1965
+ candidates?: readonly string[];
1966
+ idempotencyKey?: string;
1967
+ }): Promise<ViraResponse<ClientBody> | null>;
1968
+ serveBehaviorProjection(input: {
1969
+ programId?: string;
1970
+ input: string;
1971
+ provider: string;
1972
+ protocol?: string;
1973
+ idempotencyKey?: string;
1974
+ }): Promise<ViraResponse<ClientBody> | null>;
1975
+ testConnection(connectionId: string): Promise<ViraResponse<ConnectionTestResult> | null>;
1976
+ listAISystemUnitGrants(aiSystemId: string): Promise<ViraResponse<ClientBody> | null>;
1977
+ grantAISystemUnitAccess(aiSystemId: string, input: {
1978
+ unitId: string;
1979
+ permissions: readonly string[];
1980
+ }, options?: {
1981
+ idempotencyKey?: string;
1982
+ }): Promise<ViraResponse<ClientBody> | null>;
1983
+ revokeAISystemUnitAccess(aiSystemId: string, unitId: string, options?: {
1984
+ idempotencyKey?: string;
1985
+ }): Promise<ViraResponse<ClientBody> | null>;
1986
+ }
1987
+ export declare function buildRuntimeRequest(input: RuntimeRequest & Record<string, unknown>, options?: {
1988
+ includeAIIdentity?: boolean;
1989
+ allowStagedValidation?: boolean;
1990
+ }): RuntimeRequest & Record<string, unknown>;
1991
+ export declare function buildPublicContentRequest(input: {
1992
+ slug: string;
1993
+ version?: string;
1994
+ }): SdkRequest;
1995
+ export declare function buildDocsQueryRequest(input: {
1996
+ query: string;
1997
+ operation?: "search" | "ask";
1998
+ }): SdkRequest;
1999
+ export declare function buildAISystemRequest(input: {
2000
+ name: string;
2001
+ systemType: string;
2002
+ organizationId: string;
2003
+ projectId: string;
2004
+ environmentId: string;
2005
+ }): SdkRequest;
2006
+ export declare function buildObservationRequest(event: {
2007
+ organizationId: string;
2008
+ projectId: string;
2009
+ environmentId: string;
2010
+ eventId: string;
2011
+ eventType: string;
2012
+ aiSystemId: string;
2013
+ connectionId: string;
2014
+ [key: string]: unknown;
2015
+ }): SdkRequest;
2016
+ export {};