aira-sdk 0.4.0 → 1.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/README.md +2 -4
- package/dist/client.js +10 -2
- package/dist/extras/mcp.js +5 -1
- package/dist/types.d.ts +5 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
# Aira TypeScript SDK
|
|
2
|
-
|
|
3
|
-
**AI governance infrastructure.**
|
|
1
|
+
# Aira TypeScript SDK — The authorization and audit layer for AI agents.
|
|
4
2
|
|
|
5
3
|
[](https://www.npmjs.com/package/aira-sdk)
|
|
6
4
|
[](https://opensource.org/licenses/MIT)
|
|
7
5
|
|
|
8
|
-
|
|
6
|
+
Drop Aira into your agent stack in one line. Define policies without changing code. Get cryptographic proof of every decision — for your auditors, your board, or a court. Not because regulation requires it. Because your agents are acting in production right now.
|
|
9
7
|
|
|
10
8
|
```bash
|
|
11
9
|
npm install aira-sdk
|
package/dist/client.js
CHANGED
|
@@ -10,7 +10,7 @@ const MAX_DETAILS_LENGTH = 50_000;
|
|
|
10
10
|
function buildBody(obj) {
|
|
11
11
|
return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined && v !== null));
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function truncateDetails(text) {
|
|
14
14
|
return text.length > MAX_DETAILS_LENGTH ? text.slice(0, MAX_DETAILS_LENGTH) + "...[truncated]" : text;
|
|
15
15
|
}
|
|
16
16
|
class Aira {
|
|
@@ -69,9 +69,17 @@ class Aira {
|
|
|
69
69
|
return this.request("POST", path, body);
|
|
70
70
|
}
|
|
71
71
|
put(path, body) {
|
|
72
|
+
if (this.queue) {
|
|
73
|
+
const qid = this.queue.enqueue("PUT", path, body);
|
|
74
|
+
return Promise.resolve({ _offline: true, _queue_id: qid });
|
|
75
|
+
}
|
|
72
76
|
return this.request("PUT", path, body);
|
|
73
77
|
}
|
|
74
78
|
del(path) {
|
|
79
|
+
if (this.queue) {
|
|
80
|
+
const qid = this.queue.enqueue("DELETE", path, {});
|
|
81
|
+
return Promise.resolve({ _offline: true, _queue_id: qid });
|
|
82
|
+
}
|
|
75
83
|
return this.request("DELETE", path);
|
|
76
84
|
}
|
|
77
85
|
paginated(data) {
|
|
@@ -82,7 +90,7 @@ class Aira {
|
|
|
82
90
|
async notarize(params) {
|
|
83
91
|
const body = buildBody({
|
|
84
92
|
action_type: params.actionType,
|
|
85
|
-
details:
|
|
93
|
+
details: truncateDetails(params.details),
|
|
86
94
|
agent_id: params.agentId,
|
|
87
95
|
agent_version: params.agentVersion,
|
|
88
96
|
model_id: params.modelId,
|
package/dist/extras/mcp.js
CHANGED
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.getTools = getTools;
|
|
13
13
|
exports.handleToolCall = handleToolCall;
|
|
14
14
|
exports.createServer = createServer;
|
|
15
|
+
const types_1 = require("../types");
|
|
15
16
|
/** MCP tool definitions exposed by the Aira server. */
|
|
16
17
|
function getTools() {
|
|
17
18
|
return [
|
|
@@ -138,7 +139,10 @@ async function handleToolCall(client, name, args) {
|
|
|
138
139
|
return [{ type: "text", text: JSON.stringify({ error: `Unknown tool: ${name}` }) }];
|
|
139
140
|
}
|
|
140
141
|
catch (e) {
|
|
141
|
-
|
|
142
|
+
if (e instanceof types_1.AiraError) {
|
|
143
|
+
return [{ type: "text", text: JSON.stringify({ error: e.message, code: e.code }) }];
|
|
144
|
+
}
|
|
145
|
+
return [{ type: "text", text: JSON.stringify({ error: "Internal error", code: "SDK_ERROR" }) }];
|
|
142
146
|
}
|
|
143
147
|
}
|
|
144
148
|
/**
|
package/dist/types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/** Cryptographic receipt from notarizing an action. */
|
|
2
2
|
export interface ActionReceipt {
|
|
3
3
|
action_id: string;
|
|
4
|
-
receipt_id
|
|
5
|
-
payload_hash
|
|
6
|
-
signature
|
|
7
|
-
timestamp_token
|
|
4
|
+
receipt_id?: string;
|
|
5
|
+
payload_hash?: string;
|
|
6
|
+
signature?: string;
|
|
7
|
+
timestamp_token?: string | null;
|
|
8
8
|
created_at: string;
|
|
9
9
|
request_id: string;
|
|
10
10
|
status?: string;
|
|
@@ -71,6 +71,7 @@ export interface AgentVersion {
|
|
|
71
71
|
changelog: string | null;
|
|
72
72
|
status: string;
|
|
73
73
|
published_at: string | null;
|
|
74
|
+
created_at: string;
|
|
74
75
|
}
|
|
75
76
|
/** Sealed evidence package. */
|
|
76
77
|
export interface EvidencePackage {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aira-sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "The authorization and audit layer for AI agents",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|