aira-sdk 2.4.0 → 3.0.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
@@ -24,7 +24,7 @@ export declare class Aira {
24
24
  *
25
25
  * Returns an `Authorization` with a status:
26
26
  * - "authorized" → safe to execute the action, then call `notarize()`
27
- * - "pending_approval" → enqueue `action_id` and wait for human approval
27
+ * - "pending_approval" → enqueue `action_uuid` and wait for human approval
28
28
  *
29
29
  * If a policy denies the action, this throws `AiraError` with code
30
30
  * `POLICY_DENIED` (HTTP 403). Duplicate idempotent requests throw
package/dist/client.js CHANGED
@@ -138,7 +138,7 @@ class Aira {
138
138
  *
139
139
  * Returns an `Authorization` with a status:
140
140
  * - "authorized" → safe to execute the action, then call `notarize()`
141
- * - "pending_approval" → enqueue `action_id` and wait for human approval
141
+ * - "pending_approval" → enqueue `action_uuid` and wait for human approval
142
142
  *
143
143
  * If a policy denies the action, this throws `AiraError` with code
144
144
  * `POLICY_DENIED` (HTTP 403). Duplicate idempotent requests throw
@@ -153,7 +153,7 @@ class Aira {
153
153
  instruction_hash: params.instructionHash,
154
154
  model_id: params.modelId,
155
155
  model_version: params.modelVersion,
156
- parent_action_id: params.parentActionId,
156
+ parent_action_uuid: params.parentActionId,
157
157
  endpoint_url: params.endpointUrl,
158
158
  store_details: params.storeDetails || undefined,
159
159
  idempotency_key: params.idempotencyKey,
@@ -247,7 +247,7 @@ class Aira {
247
247
  return this.post(`/agents/${slug}/decommission`, {});
248
248
  }
249
249
  async transferAgent(slug, toOrgId, reason) {
250
- return this.post(`/agents/${slug}/transfer`, buildBody({ to_org_id: toOrgId, reason }));
250
+ return this.post(`/agents/${slug}/transfer`, buildBody({ to_org_uuid: toOrgId, reason }));
251
251
  }
252
252
  async getAgentActions(slug, page = 1) {
253
253
  const data = await this.get(`/agents/${slug}/actions`, { page });
@@ -277,7 +277,7 @@ class Aira {
277
277
  // ==================== Evidence ====================
278
278
  async createEvidencePackage(params) {
279
279
  return this.post("/evidence/packages", buildBody({
280
- title: params.title, action_ids: params.actionIds, description: params.description, agent_slugs: params.agentSlugs,
280
+ title: params.title, action_uuids: params.actionIds, description: params.description, agent_slugs: params.agentSlugs,
281
281
  }));
282
282
  }
283
283
  async listEvidencePackages(page = 1) {
@@ -327,7 +327,7 @@ class Aira {
327
327
  async createEscrowAccount(params) {
328
328
  return this.post("/escrow/accounts", buildBody({
329
329
  purpose: params?.purpose, currency: params?.currency ?? "EUR",
330
- agent_id: params?.agentId, counterparty_org_id: params?.counterpartyOrgId,
330
+ agent_id: params?.agentId, counterparty_org_uuid: params?.counterpartyOrgId,
331
331
  }));
332
332
  }
333
333
  async listEscrowAccounts(page = 1) {
@@ -339,17 +339,17 @@ class Aira {
339
339
  }
340
340
  async escrowDeposit(accountId, amount, description, referenceActionId) {
341
341
  return this.post(`/escrow/accounts/${accountId}/deposit`, buildBody({
342
- amount, description, reference_action_id: referenceActionId,
342
+ amount, description, reference_action_uuid: referenceActionId,
343
343
  }));
344
344
  }
345
345
  async escrowRelease(accountId, amount, description, referenceActionId) {
346
346
  return this.post(`/escrow/accounts/${accountId}/release`, buildBody({
347
- amount, description, reference_action_id: referenceActionId,
347
+ amount, description, reference_action_uuid: referenceActionId,
348
348
  }));
349
349
  }
350
350
  async escrowDispute(accountId, amount, description, referenceActionId) {
351
351
  return this.post(`/escrow/accounts/${accountId}/dispute`, buildBody({
352
- amount, description, reference_action_id: referenceActionId,
352
+ amount, description, reference_action_uuid: referenceActionId,
353
353
  }));
354
354
  }
355
355
  // ==================== Chat ====================
@@ -419,7 +419,7 @@ class Aira {
419
419
  /** Submit a signed attestation of a successful interaction. */
420
420
  async attestReputation(slug, counterpartyDid, actionId, attestation, signature) {
421
421
  return this.post(`/agents/${slug}/reputation/attest`, {
422
- counterparty_did: counterpartyDid, action_id: actionId, attestation, signature,
422
+ counterparty_did: counterpartyDid, action_uuid: actionId, attestation, signature,
423
423
  });
424
424
  }
425
425
  /** Verify a reputation score by returning inputs and score_hash. */
@@ -549,7 +549,7 @@ class Aira {
549
549
  framework: params.framework,
550
550
  period_start: params.periodStart,
551
551
  period_end: params.periodEnd,
552
- action_id: params.actionId,
552
+ action_uuid: params.actionId,
553
553
  agent_filter: params.agentFilter,
554
554
  });
555
555
  return this.post("/compliance/reports", body);
@@ -16,7 +16,7 @@
16
16
  * This handler implements the two-step flow as follows:
17
17
  *
18
18
  * 1. handleToolStart → aira.authorize()
19
- * - If the backend returns "authorized" we cache the action_id
19
+ * - If the backend returns "authorized" we cache the action_uuid
20
20
  * keyed by LangChain's `runId`, then return so the tool executes.
21
21
  * - If the backend throws POLICY_DENIED we propagate the error,
22
22
  * which prevents the tool from running at all (real gate).
@@ -51,7 +51,7 @@ export declare class AiraCallbackHandler {
51
51
  private actionTypes;
52
52
  private trustPolicy?;
53
53
  private strict;
54
- /** runId → action_id cache so handleEnd can notarize the right action. */
54
+ /** runId → action_uuid cache so handleEnd can notarize the right action. */
55
55
  private inFlight;
56
56
  constructor(client: Aira, agentId: string, options?: AiraCallbackHandlerOptions);
57
57
  /**
@@ -17,7 +17,7 @@
17
17
  * This handler implements the two-step flow as follows:
18
18
  *
19
19
  * 1. handleToolStart → aira.authorize()
20
- * - If the backend returns "authorized" we cache the action_id
20
+ * - If the backend returns "authorized" we cache the action_uuid
21
21
  * keyed by LangChain's `runId`, then return so the tool executes.
22
22
  * - If the backend throws POLICY_DENIED we propagate the error,
23
23
  * which prevents the tool from running at all (real gate).
@@ -46,7 +46,7 @@ class AiraCallbackHandler {
46
46
  actionTypes;
47
47
  trustPolicy;
48
48
  strict;
49
- /** runId → action_id cache so handleEnd can notarize the right action. */
49
+ /** runId → action_uuid cache so handleEnd can notarize the right action. */
50
50
  inFlight = new Map();
51
51
  constructor(client, agentId, options) {
52
52
  this.client = client;
@@ -81,11 +81,11 @@ class AiraCallbackHandler {
81
81
  });
82
82
  if (auth.status === "pending_approval") {
83
83
  // Real gate — block the tool from running until a human approves.
84
- const err = new Error(`Aira: action '${actionType}' is pending human approval (action_id=${auth.action_id}). Tool execution blocked.`);
84
+ const err = new Error(`Aira: action '${actionType}' is pending human approval (action_uuid=${auth.action_uuid}). Tool execution blocked.`);
85
85
  err.code = "PENDING_APPROVAL";
86
86
  throw err;
87
87
  }
88
- this.inFlight.set(runId, auth.action_id);
88
+ this.inFlight.set(runId, auth.action_uuid);
89
89
  }
90
90
  catch (e) {
91
91
  const err = e;
@@ -39,7 +39,7 @@ function getTools() {
39
39
  return [
40
40
  {
41
41
  name: "authorize_action",
42
- description: "Step 1 of the Aira two-step flow. Authorize an action BEFORE it executes. Returns an action_id with status 'authorized' or 'pending_approval'. Throws POLICY_DENIED if a policy blocks the action.",
42
+ description: "Step 1 of the Aira two-step flow. Authorize an action BEFORE it executes. Returns an action_uuid with status 'authorized' or 'pending_approval'. Throws POLICY_DENIED if a policy blocks the action.",
43
43
  inputSchema: {
44
44
  type: "object",
45
45
  properties: {
@@ -59,11 +59,11 @@ function getTools() {
59
59
  inputSchema: {
60
60
  type: "object",
61
61
  properties: {
62
- action_id: { type: "string", description: "action_id returned from authorize_action" },
62
+ action_uuid: { type: "string", description: "action_uuid returned from authorize_action" },
63
63
  outcome: { type: "string", enum: ["completed", "failed"], description: "Did the action succeed?" },
64
64
  outcome_details: { type: "string", description: "Optional description of the outcome" },
65
65
  },
66
- required: ["action_id"],
66
+ required: ["action_uuid"],
67
67
  },
68
68
  },
69
69
  {
@@ -72,9 +72,9 @@ function getTools() {
72
72
  inputSchema: {
73
73
  type: "object",
74
74
  properties: {
75
- action_id: { type: "string", description: "Action UUID" },
75
+ action_uuid: { type: "string", description: "Action UUID" },
76
76
  },
77
- required: ["action_id"],
77
+ required: ["action_uuid"],
78
78
  },
79
79
  },
80
80
  {
@@ -83,9 +83,9 @@ function getTools() {
83
83
  inputSchema: {
84
84
  type: "object",
85
85
  properties: {
86
- action_id: { type: "string", description: "Action UUID" },
86
+ action_uuid: { type: "string", description: "Action UUID" },
87
87
  },
88
- required: ["action_id"],
88
+ required: ["action_uuid"],
89
89
  },
90
90
  },
91
91
  {
@@ -94,9 +94,9 @@ function getTools() {
94
94
  inputSchema: {
95
95
  type: "object",
96
96
  properties: {
97
- receipt_id: { type: "string", description: "Receipt UUID" },
97
+ receipt_uuid: { type: "string", description: "Receipt UUID" },
98
98
  },
99
- required: ["receipt_id"],
99
+ required: ["receipt_uuid"],
100
100
  },
101
101
  },
102
102
  {
@@ -138,10 +138,10 @@ function getTools() {
138
138
  inputSchema: {
139
139
  type: "object",
140
140
  properties: {
141
- action_id: { type: "string", description: "Action UUID to co-sign" },
141
+ action_uuid: { type: "string", description: "Action UUID to co-sign" },
142
142
  counterparty_did: { type: "string", description: "DID of the counterparty agent" },
143
143
  },
144
- required: ["action_id", "counterparty_did"],
144
+ required: ["action_uuid", "counterparty_did"],
145
145
  },
146
146
  },
147
147
  ];
@@ -162,22 +162,22 @@ async function handleToolCall(client, name, args) {
162
162
  }
163
163
  if (name === "notarize_action") {
164
164
  const result = await client.notarize({
165
- actionId: args.action_id,
165
+ actionId: args.action_uuid,
166
166
  outcome: args.outcome ?? "completed",
167
167
  outcomeDetails: args.outcome_details,
168
168
  });
169
169
  return [{ type: "text", text: JSON.stringify(result) }];
170
170
  }
171
171
  if (name === "get_action") {
172
- const result = await client.getAction(args.action_id);
172
+ const result = await client.getAction(args.action_uuid);
173
173
  return [{ type: "text", text: JSON.stringify(result) }];
174
174
  }
175
175
  if (name === "verify_action") {
176
- const result = await client.verifyAction(args.action_id);
176
+ const result = await client.verifyAction(args.action_uuid);
177
177
  return [{ type: "text", text: JSON.stringify(result) }];
178
178
  }
179
179
  if (name === "get_receipt") {
180
- const result = await client.getReceipt(args.receipt_id);
180
+ const result = await client.getReceipt(args.receipt_uuid);
181
181
  return [{ type: "text", text: JSON.stringify(result) }];
182
182
  }
183
183
  if (name === "resolve_did") {
@@ -194,7 +194,7 @@ async function handleToolCall(client, name, args) {
194
194
  return [{ type: "text", text: JSON.stringify(result) }];
195
195
  }
196
196
  if (name === "request_mutual_sign") {
197
- const result = await client.requestMutualSign(args.action_id, args.counterparty_did);
197
+ const result = await client.requestMutualSign(args.action_uuid, args.counterparty_did);
198
198
  return [{ type: "text", text: JSON.stringify(result) }];
199
199
  }
200
200
  return [{ type: "text", text: JSON.stringify({ error: `Unknown tool: ${name}` }) }];
@@ -49,7 +49,7 @@ export declare class AiraGuardrail {
49
49
  /**
50
50
  * REAL GATE: call `authorize()` for a tool invocation.
51
51
  *
52
- * Returns the action_id on success, throws on POLICY_DENIED or
52
+ * Returns the action_uuid on success, throws on POLICY_DENIED or
53
53
  * pending_approval. Arg keys are logged (not values) to avoid leaking
54
54
  * sensitive user input into audit trails.
55
55
  */
@@ -56,7 +56,7 @@ class AiraGuardrail {
56
56
  /**
57
57
  * REAL GATE: call `authorize()` for a tool invocation.
58
58
  *
59
- * Returns the action_id on success, throws on POLICY_DENIED or
59
+ * Returns the action_uuid on success, throws on POLICY_DENIED or
60
60
  * pending_approval. Arg keys are logged (not values) to avoid leaking
61
61
  * sensitive user input into audit trails.
62
62
  */
@@ -70,11 +70,11 @@ class AiraGuardrail {
70
70
  modelId: this.modelId,
71
71
  });
72
72
  if (auth.status === "pending_approval") {
73
- const err = new Error(`Aira: tool '${toolName}' is pending human approval (action_id=${auth.action_id}). Tool execution blocked.`);
73
+ const err = new Error(`Aira: tool '${toolName}' is pending human approval (action_uuid=${auth.action_uuid}). Tool execution blocked.`);
74
74
  err.code = "PENDING_APPROVAL";
75
75
  throw err;
76
76
  }
77
- return auth.action_id;
77
+ return auth.action_uuid;
78
78
  }
79
79
  catch (e) {
80
80
  const err = e;
@@ -69,7 +69,7 @@ class AiraVercelMiddleware {
69
69
  modelId: this.modelId,
70
70
  });
71
71
  if (auth.status === "authorized") {
72
- await this.client.notarize({ actionId: auth.action_id, outcome: "completed" });
72
+ await this.client.notarize({ actionId: auth.action_uuid, outcome: "completed" });
73
73
  }
74
74
  // If pending_approval — just leave it; nothing to execute for audit-only.
75
75
  }
@@ -134,11 +134,11 @@ class AiraVercelMiddleware {
134
134
  modelId: self.modelId,
135
135
  });
136
136
  if (auth.status === "pending_approval") {
137
- const err = new Error(`Aira: tool '${toolName}' is pending human approval (action_id=${auth.action_id}). Tool execution blocked.`);
137
+ const err = new Error(`Aira: tool '${toolName}' is pending human approval (action_uuid=${auth.action_uuid}). Tool execution blocked.`);
138
138
  err.code = "PENDING_APPROVAL";
139
139
  throw err;
140
140
  }
141
- actionId = auth.action_id;
141
+ actionId = auth.action_uuid;
142
142
  }
143
143
  catch (e) {
144
144
  const err = e;
package/dist/session.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * AiraSession — scoped session with pre-filled defaults for `authorize()`.
3
3
  *
4
4
  * Under the two-step flow, only `authorize()` takes agent/model metadata;
5
- * `notarize()` operates on an existing action_id. This session therefore
5
+ * `notarize()` operates on an existing action_uuid. This session therefore
6
6
  * merges defaults on `authorize()` only and provides a thin passthrough
7
7
  * for `notarize()` so callers can use a single object end-to-end.
8
8
  */
package/dist/session.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * AiraSession — scoped session with pre-filled defaults for `authorize()`.
4
4
  *
5
5
  * Under the two-step flow, only `authorize()` takes agent/model metadata;
6
- * `notarize()` operates on an existing action_id. This session therefore
6
+ * `notarize()` operates on an existing action_uuid. This session therefore
7
7
  * merges defaults on `authorize()` only and provides a thin passthrough
8
8
  * for `notarize()` so callers can use a single object end-to-end.
9
9
  */
package/dist/types.d.ts CHANGED
@@ -13,12 +13,12 @@ export declare const FRAMEWORK_ANNEX_IV: "eu_ai_act_annex_iv";
13
13
  *
14
14
  * Status tells you what to do next:
15
15
  * - "authorized" → execute the action, then call `notarize()`
16
- * - "pending_approval" → enqueue the action_id and wait for human approval
16
+ * - "pending_approval" → enqueue the action_uuid and wait for human approval
17
17
  *
18
18
  * POLICY_DENIED is raised as an `AiraError` — not returned as a status.
19
19
  */
20
20
  export interface Authorization {
21
- action_id: string;
21
+ action_uuid: string;
22
22
  status: "authorized" | "pending_approval";
23
23
  created_at: string;
24
24
  request_id: string;
@@ -31,11 +31,11 @@ export interface Authorization {
31
31
  * the receipt fields stay null — only the audit trail is recorded.
32
32
  */
33
33
  export interface ActionReceipt {
34
- action_id: string;
34
+ action_uuid: string;
35
35
  status: "notarized" | "failed";
36
36
  created_at: string;
37
37
  request_id: string;
38
- receipt_id: string | null;
38
+ receipt_uuid: string | null;
39
39
  payload_hash: string | null;
40
40
  signature: string | null;
41
41
  timestamp_token: string | null;
@@ -81,19 +81,19 @@ export interface OutputPolicyUpdate {
81
81
  }
82
82
  /** Full action details including receipt and authorizations. */
83
83
  export interface ActionDetail {
84
- action_id: string;
85
- org_id: string;
84
+ action_uuid: string;
85
+ org_uuid: string;
86
86
  action_type: string;
87
87
  action_details_hash: string;
88
88
  agent_id: string | null;
89
89
  model_id: string | null;
90
90
  instruction_hash: string | null;
91
- parent_action_id: string | null;
91
+ parent_action_uuid: string | null;
92
92
  status: string;
93
93
  legal_hold: boolean;
94
94
  created_at: string;
95
95
  receipt: {
96
- receipt_id: string;
96
+ receipt_uuid: string;
97
97
  payload_hash: string;
98
98
  signature: string;
99
99
  public_key_id: string;
@@ -144,7 +144,7 @@ export interface EvidencePackage {
144
144
  id: string;
145
145
  title: string;
146
146
  description: string | null;
147
- action_ids: string[];
147
+ action_uuids: string[];
148
148
  package_hash: string;
149
149
  signature: string;
150
150
  status: string;
@@ -174,7 +174,7 @@ export interface EscrowAccount {
174
174
  created_at: string;
175
175
  request_id: string;
176
176
  agent_id?: string | null;
177
- counterparty_org_id?: string | null;
177
+ counterparty_org_uuid?: string | null;
178
178
  purpose?: string | null;
179
179
  transactions?: EscrowTransaction[];
180
180
  }
@@ -189,7 +189,7 @@ export interface EscrowTransaction {
189
189
  status: string;
190
190
  created_at: string;
191
191
  description?: string | null;
192
- reference_action_id?: string | null;
192
+ reference_action_uuid?: string | null;
193
193
  }
194
194
  /**
195
195
  * Result of a public action receipt verification.
@@ -209,8 +209,8 @@ export interface VerifyResult {
209
209
  message: string;
210
210
  verified_at: string;
211
211
  request_id: string;
212
- receipt_id?: string | null;
213
- action_id?: string | null;
212
+ receipt_uuid?: string | null;
213
+ action_uuid?: string | null;
214
214
  payload_hash?: string | null;
215
215
  signature?: string | null;
216
216
  public_key?: string | null;
@@ -239,8 +239,8 @@ export interface PaginatedList<T = Record<string, unknown>> {
239
239
  * (and optionally already notarized).
240
240
  */
241
241
  export interface CosignResult {
242
- cosignature_id: string;
243
- action_id: string;
242
+ cosignature_uuid: string;
243
+ action_uuid: string;
244
244
  cosigner_email: string;
245
245
  cosigned_at: string;
246
246
  request_id: string;
@@ -257,7 +257,7 @@ export declare class AiraError extends Error {
257
257
  statusCode: number;
258
258
  /** Error code string (e.g. "POLICY_DENIED", "INVALID_STATE"). */
259
259
  code: string;
260
- /** Optional backend-supplied context (policy_id, action_id, etc.). */
260
+ /** Optional backend-supplied context (policy_uuid, action_uuid, etc.). */
261
261
  details: Record<string, unknown>;
262
262
  constructor(statusCode: number, code: string, message: string, details?: Record<string, unknown>);
263
263
  }
@@ -267,10 +267,10 @@ export interface ComplianceReport {
267
267
  status: "pending" | "generating" | "ready" | "failed";
268
268
  created_at: string;
269
269
  request_id?: string;
270
- org_id?: string;
270
+ org_uuid?: string;
271
271
  period_start?: string | null;
272
272
  period_end?: string | null;
273
- action_id?: string | null;
273
+ action_uuid?: string | null;
274
274
  agent_filter?: string[] | null;
275
275
  receipt_count?: number | null;
276
276
  pdf_size_bytes?: number | null;
@@ -291,7 +291,7 @@ export interface ComplianceReportListResponse {
291
291
  request_id: string;
292
292
  }
293
293
  export interface ComplianceReportVerification {
294
- report_id: string;
294
+ report_uuid: string;
295
295
  valid: boolean;
296
296
  checks: Record<string, unknown>;
297
297
  descriptor?: Record<string, unknown> | null;
package/dist/types.js CHANGED
@@ -23,7 +23,7 @@ class AiraError extends Error {
23
23
  statusCode;
24
24
  /** Error code string (e.g. "POLICY_DENIED", "INVALID_STATE"). */
25
25
  code;
26
- /** Optional backend-supplied context (policy_id, action_id, etc.). */
26
+ /** Optional backend-supplied context (policy_uuid, action_uuid, etc.). */
27
27
  details;
28
28
  constructor(statusCode, code, message, details = {}) {
29
29
  super(`[${code}] ${message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aira-sdk",
3
- "version": "2.4.0",
3
+ "version": "3.0.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",