@auctra/sdk 0.1.2 → 0.2.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 +31 -19
- package/dist/index.d.ts +70 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +74 -18
- package/package.json +14 -4
package/README.md
CHANGED
|
@@ -23,13 +23,18 @@ import { Auctra } from "@auctra/sdk";
|
|
|
23
23
|
|
|
24
24
|
const auctra = new Auctra({
|
|
25
25
|
apiKey: process.env.AUCTRA_API_KEY!,
|
|
26
|
+
timeoutMs: 10_000,
|
|
27
|
+
maxRetries: 2,
|
|
26
28
|
});
|
|
27
29
|
|
|
28
|
-
const decision = await auctra.evaluateAction(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
30
|
+
const decision = await auctra.evaluateAction(
|
|
31
|
+
{
|
|
32
|
+
agentId: "your-agent-uuid",
|
|
33
|
+
actionType: "send_payment",
|
|
34
|
+
payload: { amount: 1200, currency: "USD" },
|
|
35
|
+
},
|
|
36
|
+
{ idempotencyKey: crypto.randomUUID() },
|
|
37
|
+
);
|
|
33
38
|
|
|
34
39
|
if (decision.decision === "allowed") {
|
|
35
40
|
// proceed with action
|
|
@@ -50,26 +55,27 @@ if (decision.decision === "allowed") {
|
|
|
50
55
|
|
|
51
56
|
## API
|
|
52
57
|
|
|
53
|
-
| Method
|
|
54
|
-
|
|
55
|
-
| `evaluateAction(input)`
|
|
56
|
-
| `listAgents()`
|
|
57
|
-
| `createAgent(input)`
|
|
58
|
-
| `listDelegations()`
|
|
59
|
-
| `createDelegation(input)`
|
|
60
|
-
| `revokeDelegation(id)`
|
|
61
|
-
| `listActionRequests()`
|
|
62
|
-
| `approveActionRequest(id)`
|
|
63
|
-
| `rejectActionRequest(id)`
|
|
64
|
-
| `escalateActionRequest(id)` | Escalate
|
|
65
|
-
| `listPolicies()`
|
|
66
|
-
| `listAuditEvents()`
|
|
58
|
+
| Method | Description |
|
|
59
|
+
| ------------------------------------------- | ------------------------------------------------- |
|
|
60
|
+
| `evaluateAction(input, options)` | Idempotently check authority before an agent acts |
|
|
61
|
+
| `listAgents()` | List registered agents |
|
|
62
|
+
| `createAgent(input)` | Register a new agent |
|
|
63
|
+
| `listDelegations()` | List authority delegations |
|
|
64
|
+
| `createDelegation(input)` | Grant bounded authority |
|
|
65
|
+
| `revokeDelegation(id)` | Revoke a delegation |
|
|
66
|
+
| `listActionRequests()` | List recent evaluations |
|
|
67
|
+
| `approveActionRequest(id, approverUserId)` | Approve as an accountable reviewer |
|
|
68
|
+
| `rejectActionRequest(id, approverUserId)` | Reject as an accountable reviewer |
|
|
69
|
+
| `escalateActionRequest(id, approverUserId)` | Escalate as an accountable reviewer |
|
|
70
|
+
| `listPolicies()` | List org policies |
|
|
71
|
+
| `listAuditEvents()` | List audit ledger events |
|
|
67
72
|
|
|
68
73
|
## REST API (curl)
|
|
69
74
|
|
|
70
75
|
```bash
|
|
71
76
|
curl -X POST https://console.auctra.tech/v1/action-requests/evaluate \
|
|
72
77
|
-H "Authorization: Bearer YOUR_API_KEY" \
|
|
78
|
+
-H "Idempotency-Key: $(uuidgen)" \
|
|
73
79
|
-H "Content-Type: application/json" \
|
|
74
80
|
-d '{
|
|
75
81
|
"agentId": "your-agent-uuid",
|
|
@@ -78,6 +84,12 @@ curl -X POST https://console.auctra.tech/v1/action-requests/evaluate \
|
|
|
78
84
|
}'
|
|
79
85
|
```
|
|
80
86
|
|
|
87
|
+
The SDK applies bounded retries only to reads and idempotent evaluations. API failures throw
|
|
88
|
+
`AuctraApiError` with `status`, optional structured `details`, and the server `requestId`.
|
|
89
|
+
|
|
90
|
+
The machine-readable OpenAPI 3.1 contract is available at
|
|
91
|
+
`https://console.auctra.tech/v1/openapi.json`.
|
|
92
|
+
|
|
81
93
|
## License
|
|
82
94
|
|
|
83
95
|
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -16,18 +16,81 @@ export type EvaluateActionResponse = {
|
|
|
16
16
|
export type AuctraClientOptions = {
|
|
17
17
|
apiKey: string;
|
|
18
18
|
baseUrl?: string;
|
|
19
|
+
timeoutMs?: number;
|
|
20
|
+
maxRetries?: number;
|
|
21
|
+
fetch?: typeof fetch;
|
|
19
22
|
};
|
|
23
|
+
export type Agent = {
|
|
24
|
+
id: string;
|
|
25
|
+
identity_id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
description: string | null;
|
|
28
|
+
model_provider: string;
|
|
29
|
+
model_name: string;
|
|
30
|
+
environment: "dev" | "staging" | "production";
|
|
31
|
+
authority_level: "low" | "medium" | "high" | "critical";
|
|
32
|
+
status: "active" | "suspended" | "restricted" | "compromised";
|
|
33
|
+
trust_rating: number;
|
|
34
|
+
sponsor: {
|
|
35
|
+
id: string;
|
|
36
|
+
full_name: string;
|
|
37
|
+
email: string;
|
|
38
|
+
};
|
|
39
|
+
created_at: string;
|
|
40
|
+
};
|
|
41
|
+
export type Delegation = {
|
|
42
|
+
id: string;
|
|
43
|
+
agent: {
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
};
|
|
47
|
+
delegator: {
|
|
48
|
+
id: string;
|
|
49
|
+
full_name: string;
|
|
50
|
+
email: string;
|
|
51
|
+
};
|
|
52
|
+
scope: {
|
|
53
|
+
action_types: string[];
|
|
54
|
+
};
|
|
55
|
+
limits: {
|
|
56
|
+
max_amount?: number;
|
|
57
|
+
currency?: string;
|
|
58
|
+
};
|
|
59
|
+
valid_from: string;
|
|
60
|
+
valid_until: string;
|
|
61
|
+
status: "active" | "revoked" | "expired";
|
|
62
|
+
is_active: boolean;
|
|
63
|
+
created_at: string;
|
|
64
|
+
};
|
|
65
|
+
export declare class AuctraApiError extends Error {
|
|
66
|
+
readonly status: number;
|
|
67
|
+
readonly code?: string;
|
|
68
|
+
readonly details?: unknown;
|
|
69
|
+
readonly requestId?: string;
|
|
70
|
+
constructor(message: string, options: {
|
|
71
|
+
status: number;
|
|
72
|
+
code?: string;
|
|
73
|
+
details?: unknown;
|
|
74
|
+
requestId?: string;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
20
77
|
export declare class Auctra {
|
|
21
78
|
private apiKey;
|
|
22
79
|
private baseUrl;
|
|
80
|
+
private timeoutMs;
|
|
81
|
+
private maxRetries;
|
|
82
|
+
private fetchImpl;
|
|
23
83
|
constructor(options: AuctraClientOptions);
|
|
24
84
|
private request;
|
|
25
|
-
evaluateAction(input: EvaluateActionInput
|
|
85
|
+
evaluateAction(input: EvaluateActionInput, options?: {
|
|
86
|
+
idempotencyKey?: string;
|
|
87
|
+
signal?: AbortSignal;
|
|
88
|
+
}): Promise<EvaluateActionResponse>;
|
|
26
89
|
listAgents(): Promise<{
|
|
27
|
-
agents:
|
|
90
|
+
agents: Agent[];
|
|
28
91
|
}>;
|
|
29
92
|
getAgent(agentId: string): Promise<{
|
|
30
|
-
agent:
|
|
93
|
+
agent: Agent;
|
|
31
94
|
}>;
|
|
32
95
|
createAgent(input: {
|
|
33
96
|
name: string;
|
|
@@ -39,7 +102,7 @@ export declare class Auctra {
|
|
|
39
102
|
sponsorUserId?: string;
|
|
40
103
|
}): Promise<unknown>;
|
|
41
104
|
listDelegations(): Promise<{
|
|
42
|
-
delegations:
|
|
105
|
+
delegations: Delegation[];
|
|
43
106
|
}>;
|
|
44
107
|
createDelegation(input: {
|
|
45
108
|
agentId: string;
|
|
@@ -53,9 +116,9 @@ export declare class Auctra {
|
|
|
53
116
|
listActionRequests(): Promise<{
|
|
54
117
|
action_requests: unknown[];
|
|
55
118
|
}>;
|
|
56
|
-
approveActionRequest(actionRequestId: string, reason?: string): Promise<unknown>;
|
|
57
|
-
rejectActionRequest(actionRequestId: string, reason?: string): Promise<unknown>;
|
|
58
|
-
escalateActionRequest(actionRequestId: string, reason?: string): Promise<unknown>;
|
|
119
|
+
approveActionRequest(actionRequestId: string, approverUserId: string, reason?: string): Promise<unknown>;
|
|
120
|
+
rejectActionRequest(actionRequestId: string, approverUserId: string, reason?: string): Promise<unknown>;
|
|
121
|
+
escalateActionRequest(actionRequestId: string, approverUserId: string, reason?: string): Promise<unknown>;
|
|
59
122
|
listPolicies(): Promise<{
|
|
60
123
|
policies: unknown[];
|
|
61
124
|
}>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,SAAS,GAAG,SAAS,GAAG,kBAAkB,CAAC;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,SAAS,GAAG,SAAS,GAAG,kBAAkB,CAAC;IACrD,UAAU,EAAE,MAAM,C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
requestId;
|
|
6
|
+
constructor(message, options) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = "AuctraApiError";
|
|
9
|
+
this.status = options.status;
|
|
10
|
+
this.code = options.code;
|
|
11
|
+
this.details = options.details;
|
|
12
|
+
this.requestId = options.requestId;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
1
15
|
export class Auctra {
|
|
2
16
|
apiKey;
|
|
3
17
|
baseUrl;
|
|
18
|
+
timeoutMs;
|
|
19
|
+
maxRetries;
|
|
20
|
+
fetchImpl;
|
|
4
21
|
constructor(options) {
|
|
5
22
|
this.apiKey = options.apiKey;
|
|
6
23
|
this.baseUrl = (options.baseUrl ?? "https://console.auctra.tech").replace(/\/$/, "");
|
|
24
|
+
this.timeoutMs = options.timeoutMs ?? 10_000;
|
|
25
|
+
this.maxRetries = options.maxRetries ?? 2;
|
|
26
|
+
this.fetchImpl = options.fetch ?? globalThis.fetch;
|
|
27
|
+
if (!this.fetchImpl)
|
|
28
|
+
throw new Error("A fetch implementation is required");
|
|
7
29
|
}
|
|
8
|
-
async request(method, path, body) {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
30
|
+
async request(method, path, body, options = {}) {
|
|
31
|
+
const retryableRequest = method === "GET" || Boolean(options.idempotencyKey);
|
|
32
|
+
let lastError;
|
|
33
|
+
for (let attempt = 0; attempt <= this.maxRetries; attempt += 1) {
|
|
34
|
+
const timeoutSignal = AbortSignal.timeout(this.timeoutMs);
|
|
35
|
+
const signal = options.signal
|
|
36
|
+
? AbortSignal.any([options.signal, timeoutSignal])
|
|
37
|
+
: timeoutSignal;
|
|
38
|
+
try {
|
|
39
|
+
const response = await this.fetchImpl(`${this.baseUrl}${path}`, {
|
|
40
|
+
method,
|
|
41
|
+
signal,
|
|
42
|
+
headers: {
|
|
43
|
+
...(body ? { "content-type": "application/json" } : {}),
|
|
44
|
+
...(options.idempotencyKey ? { "idempotency-key": options.idempotencyKey } : {}),
|
|
45
|
+
authorization: `Bearer ${this.apiKey}`,
|
|
46
|
+
"x-auctra-sdk-version": "0.2",
|
|
47
|
+
},
|
|
48
|
+
...(body ? { body: JSON.stringify(body) } : {}),
|
|
49
|
+
});
|
|
50
|
+
const data = (await response.json().catch(() => ({})));
|
|
51
|
+
if (response.ok)
|
|
52
|
+
return data;
|
|
53
|
+
const retryableResponse = response.status === 429 || response.status >= 500;
|
|
54
|
+
if (retryableRequest && retryableResponse && attempt < this.maxRetries) {
|
|
55
|
+
await new Promise((resolve) => setTimeout(resolve, 150 * 2 ** attempt));
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
throw new AuctraApiError(typeof data.error === "string" ? data.error : `Auctra API error (${response.status})`, {
|
|
59
|
+
status: response.status,
|
|
60
|
+
code: typeof data.code === "string" ? data.code : undefined,
|
|
61
|
+
details: data.details,
|
|
62
|
+
requestId: response.headers.get("x-request-id") ?? undefined,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
lastError = error;
|
|
67
|
+
if (error instanceof AuctraApiError || !retryableRequest || attempt >= this.maxRetries) {
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
await new Promise((resolve) => setTimeout(resolve, 150 * 2 ** attempt));
|
|
71
|
+
}
|
|
20
72
|
}
|
|
21
|
-
|
|
73
|
+
throw lastError;
|
|
22
74
|
}
|
|
23
|
-
async evaluateAction(input) {
|
|
75
|
+
async evaluateAction(input, options = {}) {
|
|
76
|
+
const idempotencyKey = options.idempotencyKey ?? crypto.randomUUID();
|
|
24
77
|
return this.request("POST", "/v1/action-requests/evaluate", {
|
|
25
78
|
agent_id: input.agentId,
|
|
26
79
|
action_type: input.actionType,
|
|
27
80
|
payload: input.payload ?? {},
|
|
28
|
-
});
|
|
81
|
+
}, { ...options, idempotencyKey });
|
|
29
82
|
}
|
|
30
83
|
async listAgents() {
|
|
31
84
|
return this.request("GET", "/v1/agents");
|
|
@@ -63,19 +116,22 @@ export class Auctra {
|
|
|
63
116
|
async listActionRequests() {
|
|
64
117
|
return this.request("GET", "/v1/action-requests");
|
|
65
118
|
}
|
|
66
|
-
async approveActionRequest(actionRequestId, reason) {
|
|
119
|
+
async approveActionRequest(actionRequestId, approverUserId, reason) {
|
|
67
120
|
return this.request("POST", `/v1/action-requests/${actionRequestId}/approve`, {
|
|
68
121
|
reason,
|
|
122
|
+
approver_user_id: approverUserId,
|
|
69
123
|
});
|
|
70
124
|
}
|
|
71
|
-
async rejectActionRequest(actionRequestId, reason) {
|
|
125
|
+
async rejectActionRequest(actionRequestId, approverUserId, reason) {
|
|
72
126
|
return this.request("POST", `/v1/action-requests/${actionRequestId}/reject`, {
|
|
73
127
|
reason,
|
|
128
|
+
approver_user_id: approverUserId,
|
|
74
129
|
});
|
|
75
130
|
}
|
|
76
|
-
async escalateActionRequest(actionRequestId, reason) {
|
|
131
|
+
async escalateActionRequest(actionRequestId, approverUserId, reason) {
|
|
77
132
|
return this.request("POST", `/v1/action-requests/${actionRequestId}/escalate`, {
|
|
78
133
|
reason,
|
|
134
|
+
approver_user_id: approverUserId,
|
|
79
135
|
});
|
|
80
136
|
}
|
|
81
137
|
async listPolicies() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@auctra/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Authority delegation SDK for AI agents — evaluate agent actions against delegated authority and org policies",
|
|
5
5
|
"homepage": "https://auctra.tech/docs",
|
|
6
6
|
"bugs": {
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
"import": "./dist/index.js"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
-
"files": [
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
19
22
|
"scripts": {
|
|
20
23
|
"build": "tsc",
|
|
21
24
|
"prepublishOnly": "npm run build"
|
|
@@ -29,12 +32,19 @@
|
|
|
29
32
|
"access": "public",
|
|
30
33
|
"registry": "https://registry.npmjs.org"
|
|
31
34
|
},
|
|
32
|
-
"keywords": [
|
|
35
|
+
"keywords": [
|
|
36
|
+
"auctra",
|
|
37
|
+
"ai-agents",
|
|
38
|
+
"authority",
|
|
39
|
+
"delegation",
|
|
40
|
+
"governance",
|
|
41
|
+
"agents"
|
|
42
|
+
],
|
|
33
43
|
"license": "MIT",
|
|
34
44
|
"devDependencies": {
|
|
35
45
|
"typescript": "^5.8.3"
|
|
36
46
|
},
|
|
37
47
|
"engines": {
|
|
38
|
-
"node": ">=
|
|
48
|
+
"node": ">=20"
|
|
39
49
|
}
|
|
40
50
|
}
|