aira-sdk 0.3.0 → 0.3.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
@@ -64,7 +64,7 @@ import { Aira } from "aira-sdk";
64
64
  import { AiraCallbackHandler } from "aira-sdk/extras/langchain";
65
65
 
66
66
  const aira = new Aira({ apiKey: "aira_live_xxx" });
67
- const handler = new AiraCallbackHandler({ client: aira, agentId: "research-agent", modelId: "gpt-4o" });
67
+ const handler = new AiraCallbackHandler({ client: aira, agentId: "research-agent", modelId: "gpt-5.2" });
68
68
 
69
69
  // Every tool call and chain completion gets a signed receipt
70
70
  const result = await chain.invoke({ input: "Analyze Q1 revenue" }, { callbacks: [handler] });
@@ -83,7 +83,7 @@ const middleware = new AiraVercelMiddleware({ client: aira, agentId: "assistant-
83
83
 
84
84
  // Wrap your Vercel AI calls — receipts at invocation and completion
85
85
  const result = await middleware.wrapGenerateText({
86
- model: openai("gpt-4o"),
86
+ model: openai("gpt-5.2"),
87
87
  prompt: "Summarize the contract terms",
88
88
  });
89
89
  ```
@@ -196,7 +196,7 @@ Supported event types: `action.notarized`, `action.authorized`, `agent.registere
196
196
 
197
197
  ## Core SDK Methods
198
198
 
199
- All 56 methods on `Aira`. Every write operation produces a cryptographic receipt.
199
+ All 52 methods on `Aira`. Every write operation produces a cryptographic receipt.
200
200
 
201
201
  | Category | Method | Description |
202
202
  |---|---|---|
@@ -224,15 +224,9 @@ All 56 methods on `Aira`. Every write operation produces a cryptographic receipt
224
224
  | | `revokeCredential()` | Revoke agent's Verifiable Credential |
225
225
  | | `requestMutualSign()` | Initiate mutual notarization with counterparty |
226
226
  | | `completeMutualSign()` | Complete mutual notarization (counterparty signs) |
227
- | | `getMutualSignStatus()` | Check status of a mutual sign request |
228
227
  | | `getReputation()` | Get agent reputation score and tier |
229
228
  | | `listReputationHistory()` | List reputation score history |
230
- | | `setEndpointPolicy()` | Set endpoint verification policy |
231
- | | `getEndpointPolicy()` | Get current endpoint policy |
232
229
  | | `resolveDid()` | Resolve any DID to its DID Document |
233
- | | `checkTrust()` | Run full trust check against a counterparty |
234
- | | `listCredentials()` | List all credentials for an agent |
235
- | | `getTrustBundle()` | Get DID + VC + reputation in one call |
236
230
  | **Cases** | `runCase()` | Multi-model consensus adjudication |
237
231
  | | `getCase()` | Retrieve case result |
238
232
  | | `listCases()` | List cases |
@@ -320,6 +314,45 @@ console.log(rep.score); // 84
320
314
  console.log(rep.tier); // "Verified"
321
315
  ```
322
316
 
317
+ ### Endpoint Verification
318
+
319
+ Control which external APIs your agents can call. When `endpointUrl` is passed to `notarize()`, Aira checks it against your org's whitelist. Unrecognized endpoints are blocked in strict mode.
320
+
321
+ #### Notarize with endpointUrl
322
+
323
+ ```typescript
324
+ const receipt = await aira.notarize({
325
+ actionType: "api_call",
326
+ details: "Charged customer $49.99 for subscription renewal",
327
+ agentId: "billing-agent",
328
+ modelId: "claude-sonnet-4-6",
329
+ endpointUrl: "https://api.stripe.com/v1/charges",
330
+ });
331
+ ```
332
+
333
+ #### Handle ENDPOINT_NOT_WHITELISTED
334
+
335
+ ```typescript
336
+ import { Aira, AiraError } from "aira-sdk";
337
+
338
+ try {
339
+ const receipt = await aira.notarize({
340
+ actionType: "api_call",
341
+ details: "Send SMS via new provider",
342
+ agentId: "notifications-agent",
343
+ endpointUrl: "https://api.newprovider.com/v1/sms",
344
+ });
345
+ } catch (e) {
346
+ if (e instanceof AiraError && e.code === "ENDPOINT_NOT_WHITELISTED") {
347
+ console.log(`Blocked: ${e.message}`);
348
+ console.log(`Approval request: ${e.details.approval_id}`);
349
+ console.log(`Suggested pattern: ${e.details.url_pattern_suggested}`);
350
+ } else {
351
+ throw e;
352
+ }
353
+ }
354
+ ```
355
+
323
356
  ### Trust Policy in Integrations
324
357
 
325
358
  Pass a `trustPolicy` to any framework integration to run automated trust checks before agent interactions:
@@ -328,7 +361,7 @@ Pass a `trustPolicy` to any framework integration to run automated trust checks
328
361
  import { AiraCallbackHandler } from "aira-sdk/extras/langchain";
329
362
 
330
363
  const handler = new AiraCallbackHandler(aira, "research-agent", {
331
- modelId: "gpt-4o",
364
+ modelId: "gpt-5.2",
332
365
  trustPolicy: {
333
366
  verifyCounterparty: true, // resolve counterparty DID
334
367
  minReputation: 60, // warn if reputation score below 60
package/dist/client.js CHANGED
@@ -259,7 +259,7 @@ class Aira {
259
259
  }
260
260
  // ==================== Chat ====================
261
261
  async ask(message, params) {
262
- return this.post("/chat", buildBody({ message, history: params?.history, model: params?.model }));
262
+ return this.post("/chat", buildBody({ message, history: params?.history, model_id: params?.model }));
263
263
  }
264
264
  // ==================== DID ====================
265
265
  /** Get full DID info for an agent. */
package/dist/types.d.ts CHANGED
@@ -1,12 +1,15 @@
1
1
  /** Cryptographic receipt from notarizing an action. */
2
2
  export interface ActionReceipt {
3
3
  action_id: string;
4
+ receipt_id: string;
4
5
  payload_hash: string;
5
6
  signature: string;
6
- receipt_id: string;
7
- action_type: string;
8
- agent_id: string | null;
7
+ timestamp_token: string | null;
9
8
  created_at: string;
9
+ request_id: string;
10
+ action_type?: string;
11
+ agent_id?: string | null;
12
+ warnings?: string[] | null;
10
13
  }
11
14
  /** Full action details including receipt and authorizations. */
12
15
  export interface ActionDetail {
@@ -66,46 +69,62 @@ export interface EvidencePackage {
66
69
  id: string;
67
70
  title: string;
68
71
  description: string | null;
72
+ action_ids: string[];
69
73
  package_hash: string;
70
74
  signature: string;
71
- action_count: number;
75
+ status: string;
72
76
  created_at: string;
77
+ request_id: string;
78
+ agent_slugs?: string[] | null;
73
79
  }
74
80
  /** Compliance snapshot. */
75
81
  export interface ComplianceSnapshot {
76
82
  id: string;
77
83
  framework: string;
78
- agent_slug: string | null;
79
- findings: Record<string, string>;
80
84
  status: string;
85
+ findings: Record<string, string>;
86
+ snapshot_hash: string;
87
+ signature: string;
88
+ snapshot_at: string;
81
89
  created_at: string;
90
+ request_id: string;
91
+ agent_id?: string | null;
82
92
  }
83
93
  /** Escrow account. */
84
94
  export interface EscrowAccount {
85
95
  id: string;
86
- status: string;
87
96
  currency: string;
88
97
  balance: string;
89
- purpose: string | null;
98
+ status: string;
90
99
  created_at: string;
100
+ request_id: string;
101
+ agent_id?: string | null;
102
+ counterparty_org_id?: string | null;
103
+ purpose?: string | null;
104
+ transactions?: EscrowTransaction[];
91
105
  }
92
106
  /** Escrow transaction (deposit, release, dispute). */
93
107
  export interface EscrowTransaction {
94
108
  id: string;
95
109
  transaction_type: string;
96
110
  amount: string;
97
- description: string | null;
111
+ currency: string;
98
112
  transaction_hash: string;
99
113
  signature: string;
114
+ status: string;
100
115
  created_at: string;
116
+ description?: string | null;
117
+ reference_action_id?: string | null;
101
118
  }
102
119
  /** Public verification result. */
103
120
  export interface VerifyResult {
104
121
  valid: boolean;
105
- receipt_id: string | null;
106
- verified_at: string;
107
122
  public_key_id: string;
108
123
  message: string;
124
+ verified_at: string;
125
+ request_id: string;
126
+ receipt_id?: string | null;
127
+ action_id?: string | null;
109
128
  }
110
129
  /** Paginated list response. */
111
130
  export interface PaginatedList<T = Record<string, unknown>> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aira-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "TypeScript SDK for Aira — legal infrastructure for AI agents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",