aira-sdk 3.4.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -253,8 +253,10 @@ gatewayOpenAIConfig({
253
253
 
254
254
  - [Documentation](https://docs.airaproof.com)
255
255
  - [API Reference](https://docs.airaproof.com/docs/api-reference)
256
- - [Gateway Guide](https://docs.airaproof.com/docs/gateway)
256
+ - [Interactive API (Swagger)](https://api.airaproof.com/docs)
257
+ - [Interactive API (ReDoc)](https://api.airaproof.com/redoc)
258
+ - [OpenAPI Spec](https://api.airaproof.com/openapi.json)
259
+ - [Gateway Guide](https://docs.airaproof.com/docs/guides/gateway)
257
260
  - [Dashboard](https://app.airaproof.com)
258
- - [Interactive Demo](https://app.airaproof.com/demo)
259
261
  - [GitHub](https://github.com/aira-proof/typescript-sdk)
260
262
  - [Python SDK](https://pypi.org/project/aira-sdk/)
package/dist/client.d.ts CHANGED
@@ -43,6 +43,47 @@ export declare class Aira {
43
43
  updatePolicy(policyId: string, params: Record<string, any>): Promise<Record<string, any>>;
44
44
  /** Delete a policy. */
45
45
  deletePolicy(policyId: string): Promise<Record<string, any>>;
46
+ /** Activate a policy. */
47
+ activatePolicy(policyId: string): Promise<Record<string, any>>;
48
+ /** Deactivate a policy. */
49
+ deactivatePolicy(policyId: string): Promise<Record<string, any>>;
50
+ /** Test a policy against an action context without executing it. */
51
+ dryRunPolicy(policyId: string, actionContext: Record<string, any>): Promise<Record<string, any>>;
52
+ /** Scan text for PII, PHI, secrets, and prompt injection. */
53
+ sanitizeText(params: {
54
+ content: string;
55
+ policy?: string;
56
+ mode?: string;
57
+ aiModel?: string;
58
+ }): Promise<Record<string, any>>;
59
+ /** Reverse tokenization — map tokens back to original values. */
60
+ detokenize(params: {
61
+ content: string;
62
+ tokenMapping: Record<string, string>;
63
+ }): Promise<Record<string, any>>;
64
+ /** Create a webhook subscription. */
65
+ createWebhook(params: {
66
+ url: string;
67
+ events?: string[];
68
+ secret?: string;
69
+ }): Promise<Record<string, any>>;
70
+ /** List all webhooks for the organization. */
71
+ listWebhooks(): Promise<Array<Record<string, any>>>;
72
+ /** Delete a webhook. */
73
+ deleteWebhook(webhookId: string): Promise<Record<string, any>>;
74
+ /** Get usage summary for the current billing period. */
75
+ getUsage(): Promise<Record<string, any>>;
76
+ /** List individual usage events. */
77
+ listUsageEvents(params?: {
78
+ page?: number;
79
+ perPage?: number;
80
+ }): Promise<Record<string, any>>;
81
+ /** List available models. */
82
+ listModels(includeDisabled?: boolean): Promise<Array<Record<string, any>>>;
83
+ /** Get model preferences (disabled models list). */
84
+ getModelPreferences(): Promise<Record<string, any>>;
85
+ /** Update which models are disabled. */
86
+ updateModelPreferences(disabledModels: string[]): Promise<Record<string, any>>;
46
87
  /** Get Aira's policy violations for a GitHub PR. */
47
88
  getPrViolations(owner: string, repo: string, pullNumber: number): Promise<Array<Record<string, any>>>;
48
89
  /**
package/dist/client.js CHANGED
@@ -164,6 +164,76 @@ class Aira {
164
164
  async deletePolicy(policyId) {
165
165
  return this.del(`/policies/${policyId}`);
166
166
  }
167
+ /** Activate a policy. */
168
+ async activatePolicy(policyId) {
169
+ return this.post(`/policies/${policyId}/activate`, {});
170
+ }
171
+ /** Deactivate a policy. */
172
+ async deactivatePolicy(policyId) {
173
+ return this.post(`/policies/${policyId}/deactivate`, {});
174
+ }
175
+ /** Test a policy against an action context without executing it. */
176
+ async dryRunPolicy(policyId, actionContext) {
177
+ return this.post(`/policies/${policyId}/dry-run`, { action_context: actionContext });
178
+ }
179
+ // ==================== Sanitize ====================
180
+ /** Scan text for PII, PHI, secrets, and prompt injection. */
181
+ async sanitizeText(params) {
182
+ return this.post("/sanitize", buildBody({
183
+ content: params.content,
184
+ policy: params.policy ?? "standard",
185
+ mode: params.mode ?? "flag",
186
+ ai_model: params.aiModel,
187
+ }));
188
+ }
189
+ /** Reverse tokenization — map tokens back to original values. */
190
+ async detokenize(params) {
191
+ return this.post("/sanitize/detokenize", {
192
+ content: params.content,
193
+ token_mapping: params.tokenMapping,
194
+ });
195
+ }
196
+ // ==================== Webhooks ====================
197
+ /** Create a webhook subscription. */
198
+ async createWebhook(params) {
199
+ return this.post("/webhooks", buildBody(params));
200
+ }
201
+ /** List all webhooks for the organization. */
202
+ async listWebhooks() {
203
+ return this.get("/webhooks");
204
+ }
205
+ /** Delete a webhook. */
206
+ async deleteWebhook(webhookId) {
207
+ return this.del(`/webhooks/${webhookId}`);
208
+ }
209
+ // ==================== Usage ====================
210
+ /** Get usage summary for the current billing period. */
211
+ async getUsage() {
212
+ return this.get("/usage");
213
+ }
214
+ /** List individual usage events. */
215
+ async listUsageEvents(params) {
216
+ const qs = new URLSearchParams();
217
+ if (params?.page)
218
+ qs.set("page", String(params.page));
219
+ if (params?.perPage)
220
+ qs.set("per_page", String(params.perPage));
221
+ return this.get(`/usage/events?${qs}`);
222
+ }
223
+ // ==================== Models ====================
224
+ /** List available models. */
225
+ async listModels(includeDisabled = false) {
226
+ const suffix = includeDisabled ? "?include_disabled=true" : "";
227
+ return this.get(`/models${suffix}`);
228
+ }
229
+ /** Get model preferences (disabled models list). */
230
+ async getModelPreferences() {
231
+ return this.get("/models/preferences");
232
+ }
233
+ /** Update which models are disabled. */
234
+ async updateModelPreferences(disabledModels) {
235
+ return this.put("/models/preferences", { disabled_models: disabledModels });
236
+ }
167
237
  // ==================== Code Governance ====================
168
238
  /** Get Aira's policy violations for a GitHub PR. */
169
239
  async getPrViolations(owner, repo, pullNumber) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aira-sdk",
3
- "version": "3.4.0",
3
+ "version": "3.5.1",
4
4
  "description": "The authorization and audit layer for AI agents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -68,9 +68,9 @@
68
68
  },
69
69
  "devDependencies": {
70
70
  "@types/node": "^25.5.0",
71
- "@vitest/coverage-v8": "^2.0.0",
72
- "typescript": "^5.4.0",
73
- "vitest": "^2.0.0"
71
+ "@vitest/coverage-v8": "^4.0.0",
72
+ "typescript": "^5.9.0",
73
+ "vitest": "^4.0.0"
74
74
  },
75
75
  "peerDependencies": {
76
76
  "@langchain/core": ">=0.2.0",
@@ -93,6 +93,6 @@
93
93
  }
94
94
  },
95
95
  "engines": {
96
- "node": ">=18"
96
+ "node": ">=22"
97
97
  }
98
98
  }