aira-sdk 3.5.3 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Authorization, ActionReceipt, ActionDetail, AgentDetail, AgentVersion, CosignResult, EvidencePackage, ComplianceSnapshot, EscrowAccount, EscrowTransaction, VerifyResult, PaginatedList, ComplianceReport, ComplianceReportListResponse, ComplianceReportVerification, ActionExplanation, ExplanationVerification, OutputPolicy, OutputPolicyUpdate, DoraIncident, IctThirdParty, DoraTest } from "./types";
1
+ import { Authorization, ActionReceipt, ActionDetail, AgentDetail, AgentVersion, CosignResult, EvidencePackage, ComplianceSnapshot, EscrowAccount, EscrowTransaction, VerifyResult, PaginatedList, ComplianceReport, ComplianceReportListResponse, ComplianceReportVerification, ActionExplanation, ExplanationVerification, OutputPolicy, OutputPolicyUpdate, DoraIncident, IctThirdParty, DoraTest, Policy, PolicyEvaluation, SanitizeResult, DetokenizeResult, WebhookInfo, UsageSummary, UsageEventList, ModelInfo, ModelPreferences, DriftStatus, BehavioralBaseline, DriftAlert, PrViolation } from "./types";
2
2
  import { AiraSession } from "./session";
3
3
  export interface AiraOptions {
4
4
  apiKey: string;
@@ -32,60 +32,60 @@ export declare class Aira {
32
32
  }>;
33
33
  aiPrompt?: string;
34
34
  aiModels?: string[];
35
- scanConfig?: Record<string, any>;
35
+ scanConfig?: Record<string, unknown>;
36
36
  description?: string;
37
- }): Promise<Record<string, any>>;
37
+ }): Promise<Policy>;
38
38
  /** List all active policies. */
39
- listPolicies(): Promise<Array<Record<string, any>>>;
39
+ listPolicies(): Promise<Policy[]>;
40
40
  /** Get a single policy by ID. */
41
- getPolicy(policyId: string): Promise<Record<string, any>>;
41
+ getPolicy(policyId: string): Promise<Policy>;
42
42
  /** Update a policy. Pass only fields to change. */
43
- updatePolicy(policyId: string, params: Record<string, any>): Promise<Record<string, any>>;
43
+ updatePolicy(policyId: string, params: Record<string, unknown>): Promise<Policy>;
44
44
  /** Delete a policy. */
45
- deletePolicy(policyId: string): Promise<Record<string, any>>;
45
+ deletePolicy(policyId: string): Promise<Record<string, unknown>>;
46
46
  /** Activate a policy. */
47
- activatePolicy(policyId: string): Promise<Record<string, any>>;
47
+ activatePolicy(policyId: string): Promise<Policy>;
48
48
  /** Deactivate a policy. */
49
- deactivatePolicy(policyId: string): Promise<Record<string, any>>;
49
+ deactivatePolicy(policyId: string): Promise<Policy>;
50
50
  /** Test a policy against an action context without executing it. */
51
- dryRunPolicy(policyId: string, actionContext: Record<string, any>): Promise<Record<string, any>>;
51
+ dryRunPolicy(policyId: string, actionContext: Record<string, unknown>): Promise<PolicyEvaluation>;
52
52
  /** Scan text for PII, PHI, secrets, and prompt injection. */
53
53
  sanitizeText(params: {
54
54
  content: string;
55
55
  policy?: string;
56
56
  mode?: string;
57
57
  aiModel?: string;
58
- }): Promise<Record<string, any>>;
58
+ }): Promise<SanitizeResult>;
59
59
  /** Reverse tokenization — map tokens back to original values. */
60
60
  detokenize(params: {
61
61
  content: string;
62
62
  tokenMapping: Record<string, string>;
63
- }): Promise<Record<string, any>>;
63
+ }): Promise<DetokenizeResult>;
64
64
  /** Create a webhook subscription. */
65
65
  createWebhook(params: {
66
66
  url: string;
67
67
  events?: string[];
68
68
  secret?: string;
69
- }): Promise<Record<string, any>>;
69
+ }): Promise<WebhookInfo>;
70
70
  /** List all webhooks for the organization. */
71
- listWebhooks(): Promise<Array<Record<string, any>>>;
71
+ listWebhooks(): Promise<WebhookInfo[]>;
72
72
  /** Delete a webhook. */
73
- deleteWebhook(webhookId: string): Promise<Record<string, any>>;
73
+ deleteWebhook(webhookId: string): Promise<Record<string, unknown>>;
74
74
  /** Get usage summary for the current billing period. */
75
- getUsage(): Promise<Record<string, any>>;
75
+ getUsage(): Promise<UsageSummary>;
76
76
  /** List individual usage events. */
77
77
  listUsageEvents(params?: {
78
78
  page?: number;
79
79
  perPage?: number;
80
- }): Promise<Record<string, any>>;
80
+ }): Promise<UsageEventList>;
81
81
  /** List available models. */
82
- listModels(includeDisabled?: boolean): Promise<Array<Record<string, any>>>;
82
+ listModels(includeDisabled?: boolean): Promise<ModelInfo[]>;
83
83
  /** Get model preferences (disabled models list). */
84
- getModelPreferences(): Promise<Record<string, any>>;
84
+ getModelPreferences(): Promise<ModelPreferences>;
85
85
  /** Update which models are disabled. */
86
- updateModelPreferences(disabledModels: string[]): Promise<Record<string, any>>;
86
+ updateModelPreferences(disabledModels: string[]): Promise<ModelPreferences>;
87
87
  /** Get Aira's policy violations for a GitHub PR. */
88
- getPrViolations(owner: string, repo: string, pullNumber: number): Promise<Array<Record<string, any>>>;
88
+ getPrViolations(owner: string, repo: string, pullNumber: number): Promise<PrViolation[]>;
89
89
  /**
90
90
  * Step 1 — Authorize an action BEFORE it executes.
91
91
  *
@@ -310,25 +310,25 @@ export declare class Aira {
310
310
  * Score the agent's recent behavior against its active baseline.
311
311
  * Read-only — does NOT persist an alert. Use this for dashboards.
312
312
  */
313
- getDriftStatus(agentId: string, lookbackHours?: number): Promise<Record<string, unknown>>;
313
+ getDriftStatus(agentId: string, lookbackHours?: number): Promise<DriftStatus>;
314
314
  /** Compute a behavioral baseline from production action history. */
315
315
  computeDriftBaseline(params: {
316
316
  agentId: string;
317
317
  windowStart: string;
318
318
  windowEnd: string;
319
319
  activate?: boolean;
320
- }): Promise<Record<string, unknown>>;
320
+ }): Promise<BehavioralBaseline>;
321
321
  /** Seed a baseline from a config dict (for cold-start agents). */
322
322
  seedSyntheticBaseline(params: {
323
323
  agentId: string;
324
324
  expectedDistribution: Record<string, number>;
325
325
  expectedActionsPerDay: number;
326
326
  activate?: boolean;
327
- }): Promise<Record<string, unknown>>;
327
+ }): Promise<BehavioralBaseline>;
328
328
  /** Score the current window and persist an alert if it exceeds the threshold. */
329
- runDriftCheck(agentId: string, lookbackHours?: number): Promise<Record<string, unknown> | null>;
330
- listDriftAlerts(agentId: string, page?: number, acknowledged?: boolean): Promise<PaginatedList<Record<string, unknown>>>;
331
- acknowledgeDriftAlert(agentId: string, alertId: string): Promise<Record<string, unknown>>;
329
+ runDriftCheck(agentId: string, lookbackHours?: number): Promise<DriftAlert | null>;
330
+ listDriftAlerts(agentId: string, page?: number, acknowledged?: boolean): Promise<PaginatedList<DriftAlert>>;
331
+ acknowledgeDriftAlert(agentId: string, alertId: string): Promise<DriftAlert>;
332
332
  /**
333
333
  * Seal every unsettled receipt for the org into a new settlement.
334
334
  * Admin-only. Returns the new settlement, or null if there were no
package/dist/index.d.ts CHANGED
@@ -4,4 +4,4 @@ export { AiraSession } from "./session";
4
4
  export { OfflineQueue } from "./offline";
5
5
  export type { QueuedRequest } from "./offline";
6
6
  export { gatewayOpenAIConfig, gatewayAnthropicConfig } from "./gateway";
7
- export { AiraError, FRAMEWORK_ANNEX_IV, FRAMEWORK_ART12, FRAMEWORK_ART9, FRAMEWORK_ART6, type Authorization, type ActionReceipt, type ActionDetail, type AgentDetail, type AgentVersion, type CosignResult, type EvidencePackage, type ComplianceSnapshot, type EscrowAccount, type EscrowTransaction, type VerifyResult, type PaginatedList, type ComplianceReport, type ComplianceReportListResponse, type ComplianceReportVerification, type ActionExplanation, type ExplanationEnvelope, type ExplanationVerification, type OutputPolicy, type OutputPolicyUpdate, type OutputScanFlags, type OutputScanHit, type DoraIncident, type IctThirdParty, type DoraTest, } from "./types";
7
+ export { AiraError, FRAMEWORK_ANNEX_IV, FRAMEWORK_ART12, FRAMEWORK_ART9, FRAMEWORK_ART6, type Authorization, type ActionReceipt, type ActionDetail, type AgentDetail, type AgentVersion, type CosignResult, type EvidencePackage, type ComplianceSnapshot, type EscrowAccount, type EscrowTransaction, type VerifyResult, type PaginatedList, type ComplianceReport, type ComplianceReportListResponse, type ComplianceReportVerification, type ActionExplanation, type ExplanationEnvelope, type ExplanationVerification, type OutputPolicy, type OutputPolicyUpdate, type OutputScanFlags, type OutputScanHit, type DoraIncident, type IctThirdParty, type DoraTest, type Policy, type PolicyEvaluation, type SanitizeFinding, type SanitizeResult, type DetokenizeResult, type WebhookInfo, type WebhookDeliveryInfo, type UsageBreakdown, type UsageSummary, type UsageEvent, type UsageEventList, type ModelInfo, type ModelPreferences, type BehavioralBaseline, type DriftCurrentWindow, type DriftStatus, type DriftAlert, type PrViolation, type ContentScanResult, } from "./types";
package/dist/types.d.ts CHANGED
@@ -388,3 +388,205 @@ export interface ExplanationVerification {
388
388
  signing_key_id?: string | null;
389
389
  request_id: string;
390
390
  }
391
+ /** Governance policy. */
392
+ export interface Policy {
393
+ id: string;
394
+ org_uuid: string;
395
+ name: string;
396
+ description: string | null;
397
+ mode: string;
398
+ priority: number;
399
+ conditions: Array<{
400
+ field: string;
401
+ op: string;
402
+ value?: unknown;
403
+ values?: string[];
404
+ }> | null;
405
+ ai_prompt: string | null;
406
+ ai_models: string[] | null;
407
+ scan_config: Record<string, unknown> | null;
408
+ decision: string;
409
+ approvers: string[] | null;
410
+ active: boolean;
411
+ created_at: string;
412
+ updated_at: string | null;
413
+ request_id: string;
414
+ }
415
+ /** Result of a policy dry-run evaluation. */
416
+ export interface PolicyEvaluation {
417
+ decision: string;
418
+ confidence: number | null;
419
+ reasoning: string | null;
420
+ model_votes: Record<string, unknown> | null;
421
+ request_id: string;
422
+ }
423
+ /** Individual finding from a sanitize scan. */
424
+ export interface SanitizeFinding {
425
+ entity_type: string;
426
+ severity: string;
427
+ action_taken: string;
428
+ library: string;
429
+ description: string;
430
+ count: number;
431
+ }
432
+ /** Result of scanning text for PII, PHI, secrets, and prompt injection. */
433
+ export interface SanitizeResult {
434
+ clean: string;
435
+ blocked: boolean;
436
+ mode: string;
437
+ policy: string;
438
+ input_hash: string;
439
+ output_hash: string;
440
+ findings: SanitizeFinding[];
441
+ token_mapping: Record<string, string> | null;
442
+ receipt_id: string | null;
443
+ request_id: string;
444
+ }
445
+ /** Result of reversing tokenization. */
446
+ export interface DetokenizeResult {
447
+ content: string;
448
+ request_id: string;
449
+ }
450
+ /** Webhook subscription. */
451
+ export interface WebhookInfo {
452
+ id: string;
453
+ url: string;
454
+ secret: string | null;
455
+ events: string[];
456
+ status: string;
457
+ created_at: string;
458
+ request_id: string;
459
+ }
460
+ /** A single webhook delivery attempt. */
461
+ export interface WebhookDeliveryInfo {
462
+ id: string;
463
+ event: string;
464
+ payload: Record<string, unknown>;
465
+ status_code: number | null;
466
+ attempt: number;
467
+ status: string;
468
+ delivered_at: string | null;
469
+ created_at: string;
470
+ }
471
+ /** Breakdown of usage by operation type. */
472
+ export interface UsageBreakdown {
473
+ case_runs: number;
474
+ action_authorizations: number;
475
+ chat_messages: number;
476
+ compliance_bundles: number;
477
+ settlements: number;
478
+ drift_checks: number;
479
+ }
480
+ /** Usage summary for the current billing period. */
481
+ export interface UsageSummary {
482
+ usage: number;
483
+ limit: number;
484
+ remaining: number;
485
+ plan: string;
486
+ overage_ops?: number;
487
+ overage_cost?: string;
488
+ overage_enabled?: boolean;
489
+ breakdown?: UsageBreakdown;
490
+ request_id: string;
491
+ }
492
+ /** Individual usage event. */
493
+ export interface UsageEvent {
494
+ id: string;
495
+ event: string;
496
+ units: number;
497
+ run_uuid: string | null;
498
+ metadata: Record<string, unknown> | null;
499
+ created_at: string;
500
+ }
501
+ /** Paginated list of usage events. */
502
+ export interface UsageEventList {
503
+ data: UsageEvent[];
504
+ total: number;
505
+ page: number;
506
+ per_page: number;
507
+ has_more: boolean;
508
+ request_id: string;
509
+ }
510
+ /** Available model info. */
511
+ export interface ModelInfo {
512
+ model_id: string;
513
+ provider: string;
514
+ display_name: string;
515
+ available: boolean;
516
+ max_tokens?: number;
517
+ disabled?: boolean;
518
+ }
519
+ /** Model preferences (disabled models). */
520
+ export interface ModelPreferences {
521
+ disabled_models: string[];
522
+ request_id: string;
523
+ }
524
+ /** Behavioral baseline for an agent. */
525
+ export interface BehavioralBaseline {
526
+ id: string;
527
+ agent_id: string;
528
+ baseline_type: string;
529
+ is_active: boolean;
530
+ window_start: string;
531
+ window_end: string;
532
+ action_type_dist: Record<string, number>;
533
+ total_actions: number;
534
+ avg_actions_per_day: number;
535
+ source_agent_ids: string[] | null;
536
+ request_id?: string | null;
537
+ }
538
+ /** Current-window stats for drift scoring. */
539
+ export interface DriftCurrentWindow {
540
+ agent_id: string;
541
+ window_start: string;
542
+ window_end: string;
543
+ action_type_dist: Record<string, number>;
544
+ total_actions: number;
545
+ avg_actions_per_day: number;
546
+ }
547
+ /** Drift status for an agent against its active baseline. */
548
+ export interface DriftStatus {
549
+ agent_id: string;
550
+ has_baseline: boolean;
551
+ baseline: BehavioralBaseline | null;
552
+ current_window: DriftCurrentWindow | null;
553
+ kl_divergence: number | null;
554
+ volume_ratio: number | null;
555
+ severity: "info" | "warning" | "critical" | null;
556
+ new_action_types: string[] | null;
557
+ is_drifting: boolean;
558
+ request_id: string;
559
+ }
560
+ /** Persisted drift alert. */
561
+ export interface DriftAlert {
562
+ id: string;
563
+ agent_id: string;
564
+ baseline_uuid: string;
565
+ window_start: string;
566
+ window_end: string;
567
+ kl_divergence: number;
568
+ volume_ratio: number;
569
+ severity: "info" | "warning" | "critical";
570
+ new_action_types: string[] | null;
571
+ detected_at: string;
572
+ acknowledged_at: string | null;
573
+ acknowledged_by: string | null;
574
+ }
575
+ /** A policy violation found in a GitHub PR. */
576
+ export interface PrViolation {
577
+ file: string;
578
+ line: number;
579
+ finding: string;
580
+ body: string;
581
+ suggestion: string | null;
582
+ created_at: string;
583
+ }
584
+ /** Result of a content scan against text. */
585
+ export interface ContentScanResult {
586
+ decision: "allow" | "require_approval" | "deny";
587
+ worst_severity: "info" | "warning" | "critical" | null;
588
+ hits: OutputScanHit[];
589
+ mode: string;
590
+ libraries: string[];
591
+ request_id: string;
592
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aira-sdk",
3
- "version": "3.5.3",
3
+ "version": "3.7.0",
4
4
  "description": "The authorization and audit layer for AI agents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",