@auctra/sdk 0.2.1 → 0.3.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/CHANGELOG.md +6 -0
- package/README.md +33 -2
- package/dist/cjs/index.js +48 -2
- package/dist/esm/index.d.ts +122 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +48 -2
- package/package.json +1 -1
- package/src/index.ts +157 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
- Extend `evaluateAction` with trust infrastructure fields: `claimedIntentId`, `parentActionId`, `actor`, and `action` (target, description, riskLevel, metadata).
|
|
6
|
+
- Return intelligence metadata on evaluation: authority validity, root intent validity, intent status, trust summary.
|
|
7
|
+
- Add `listIntents`, `createIntent`, `getIntent`, `getAuthorityGraph`, `getActionEvaluation`, and `getRootIntentChain`.
|
|
8
|
+
|
|
3
9
|
## 0.2.1
|
|
4
10
|
|
|
5
11
|
- Add complete response types for agents, delegations, action requests, policies, audit events, and API keys.
|
package/README.md
CHANGED
|
@@ -48,6 +48,31 @@ if (decision.decision === "allowed") {
|
|
|
48
48
|
}
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
+
### Trust infrastructure (0.3.0+)
|
|
52
|
+
|
|
53
|
+
Declare why an action is happening and trace it back to human-approved intent:
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
const intent = await auctra.createIntent({
|
|
57
|
+
title: "Renew SaaS contracts under $500/month for Q3",
|
|
58
|
+
description: "Procurement agent may renew eligible vendor subscriptions.",
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const decision = await auctra.evaluateAction({
|
|
62
|
+
agentId: "your-agent-uuid",
|
|
63
|
+
actionType: "send_payment",
|
|
64
|
+
claimedIntentId: intent.intent.id,
|
|
65
|
+
action: {
|
|
66
|
+
target: "vendor:slack",
|
|
67
|
+
description: "Renew Slack Team plan",
|
|
68
|
+
riskLevel: "medium",
|
|
69
|
+
},
|
|
70
|
+
payload: { amount: 420, currency: "USD" },
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
console.log(decision.intelligence?.trust_summary);
|
|
74
|
+
```
|
|
75
|
+
|
|
51
76
|
## Get an API key
|
|
52
77
|
|
|
53
78
|
1. [Sign up](https://console.auctra.tech/auth/signup) and create an organization
|
|
@@ -59,8 +84,14 @@ if (decision.decision === "allowed") {
|
|
|
59
84
|
|
|
60
85
|
| Method | Description |
|
|
61
86
|
| ------------------------------------------- | ------------------------------------------------- |
|
|
62
|
-
| `evaluateAction(input, options)` | Idempotently check authority before an agent acts |
|
|
63
|
-
| `
|
|
87
|
+
| `evaluateAction(input, options)` | Idempotently check authority + trust trace before an agent acts |
|
|
88
|
+
| `listIntents()` | List human-approved intents |
|
|
89
|
+
| `createIntent(input)` | Declare a new intent |
|
|
90
|
+
| `getIntent(id)` | Get intent detail and linked actions |
|
|
91
|
+
| `getAuthorityGraph()` | Fetch authority graph nodes and edges |
|
|
92
|
+
| `getActionEvaluation(actionRequestId)` | Get decision record for an action |
|
|
93
|
+
| `getRootIntentChain(actionRequestId)` | Get root human intent chain (trust trace) |
|
|
94
|
+
| `listAgents()` | List registered agents |
|
|
64
95
|
| `createAgent(input)` | Register a new agent |
|
|
65
96
|
| `getAgent(id)` | Get one registered agent |
|
|
66
97
|
| `listDelegations()` | List authority delegations |
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Auctra = exports.AuctraApiError = exports.AUCTRA_SDK_VERSION = void 0;
|
|
4
|
-
exports.AUCTRA_SDK_VERSION = "0.
|
|
4
|
+
exports.AUCTRA_SDK_VERSION = "0.3.0";
|
|
5
5
|
class AuctraApiError extends Error {
|
|
6
6
|
status;
|
|
7
7
|
code;
|
|
@@ -117,7 +117,53 @@ class Auctra {
|
|
|
117
117
|
}
|
|
118
118
|
async evaluateAction(input, options = {}) {
|
|
119
119
|
const idempotencyKey = options.idempotencyKey ?? crypto.randomUUID();
|
|
120
|
-
return this.request("POST", "/v1/action-requests/evaluate", {
|
|
120
|
+
return this.request("POST", "/v1/action-requests/evaluate", {
|
|
121
|
+
agent_id: input.agentId,
|
|
122
|
+
action_type: input.actionType,
|
|
123
|
+
payload: input.payload ?? {},
|
|
124
|
+
claimed_intent_id: input.claimedIntentId,
|
|
125
|
+
parent_action_id: input.parentActionId,
|
|
126
|
+
actor: input.actor
|
|
127
|
+
? {
|
|
128
|
+
id: input.actor.id,
|
|
129
|
+
type: input.actor.type,
|
|
130
|
+
name: input.actor.name,
|
|
131
|
+
}
|
|
132
|
+
: undefined,
|
|
133
|
+
action: input.action
|
|
134
|
+
? {
|
|
135
|
+
target: input.action.target,
|
|
136
|
+
description: input.action.description,
|
|
137
|
+
risk_level: input.action.riskLevel,
|
|
138
|
+
metadata: input.action.metadata,
|
|
139
|
+
}
|
|
140
|
+
: undefined,
|
|
141
|
+
}, { ...options, idempotencyKey });
|
|
142
|
+
}
|
|
143
|
+
async listIntents() {
|
|
144
|
+
return this.request("GET", "/v1/intents");
|
|
145
|
+
}
|
|
146
|
+
async createIntent(input) {
|
|
147
|
+
return this.request("POST", "/v1/intents", {
|
|
148
|
+
title: input.title,
|
|
149
|
+
description: input.description,
|
|
150
|
+
intent_type: input.intentType,
|
|
151
|
+
risk_level: input.riskLevel,
|
|
152
|
+
max_risk_level: input.maxRiskLevel,
|
|
153
|
+
expires_at: input.expiresAt,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
async getIntent(intentId) {
|
|
157
|
+
return this.request("GET", `/v1/intents/${encodeURIComponent(intentId)}`);
|
|
158
|
+
}
|
|
159
|
+
async getAuthorityGraph() {
|
|
160
|
+
return this.request("GET", "/v1/authority/graph");
|
|
161
|
+
}
|
|
162
|
+
async getActionEvaluation(actionRequestId) {
|
|
163
|
+
return this.request("GET", `/v1/action-requests/${encodeURIComponent(actionRequestId)}/evaluation`);
|
|
164
|
+
}
|
|
165
|
+
async getRootIntentChain(actionRequestId) {
|
|
166
|
+
return this.request("GET", `/v1/action-requests/${encodeURIComponent(actionRequestId)}/root-intent`);
|
|
121
167
|
}
|
|
122
168
|
async listAgents() {
|
|
123
169
|
return this.request("GET", "/v1/agents");
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
export declare const AUCTRA_SDK_VERSION = "0.
|
|
1
|
+
export declare const AUCTRA_SDK_VERSION = "0.3.0";
|
|
2
2
|
export type AgentEnvironment = "dev" | "staging" | "production";
|
|
3
3
|
export type AuthorityLevel = "low" | "medium" | "high" | "critical";
|
|
4
4
|
export type Decision = "allowed" | "blocked" | "require_approval";
|
|
5
5
|
export type PolicyType = "spending" | "data_access" | "communication" | "approval";
|
|
6
|
+
export type ActorType = "human" | "agent" | "service" | "tool";
|
|
7
|
+
export type RiskLevel = "low" | "medium" | "high" | "critical";
|
|
6
8
|
export type EvaluateActionInput = {
|
|
7
9
|
agentId: string;
|
|
8
10
|
actionType: string;
|
|
9
11
|
payload?: Record<string, unknown>;
|
|
12
|
+
claimedIntentId?: string;
|
|
13
|
+
parentActionId?: string;
|
|
14
|
+
actor?: {
|
|
15
|
+
id?: string;
|
|
16
|
+
type?: ActorType;
|
|
17
|
+
name?: string;
|
|
18
|
+
};
|
|
19
|
+
action?: {
|
|
20
|
+
target?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
riskLevel?: RiskLevel;
|
|
23
|
+
metadata?: Record<string, unknown>;
|
|
24
|
+
};
|
|
10
25
|
};
|
|
11
26
|
export type EvaluateActionResponse = {
|
|
12
27
|
decision: Decision;
|
|
@@ -17,6 +32,12 @@ export type EvaluateActionResponse = {
|
|
|
17
32
|
sponsor: string;
|
|
18
33
|
matched_policies: string[];
|
|
19
34
|
action_request_id: string;
|
|
35
|
+
intelligence?: {
|
|
36
|
+
authority_valid: boolean;
|
|
37
|
+
root_intent_valid: boolean;
|
|
38
|
+
intent_status: string;
|
|
39
|
+
trust_summary?: string;
|
|
40
|
+
};
|
|
20
41
|
};
|
|
21
42
|
export type RequestOptions = {
|
|
22
43
|
idempotencyKey?: string;
|
|
@@ -107,6 +128,84 @@ export type ActionRequest = {
|
|
|
107
128
|
created_at: string;
|
|
108
129
|
decided_at: string | null;
|
|
109
130
|
};
|
|
131
|
+
export type Intent = {
|
|
132
|
+
id: string;
|
|
133
|
+
title: string;
|
|
134
|
+
description: string | null;
|
|
135
|
+
intent_type: string | null;
|
|
136
|
+
status: string;
|
|
137
|
+
risk_level: RiskLevel;
|
|
138
|
+
max_risk_level: RiskLevel;
|
|
139
|
+
expires_at: string | null;
|
|
140
|
+
created_at: string;
|
|
141
|
+
owner: {
|
|
142
|
+
id: string;
|
|
143
|
+
full_name: string;
|
|
144
|
+
email: string;
|
|
145
|
+
} | null;
|
|
146
|
+
linked_actions: number;
|
|
147
|
+
};
|
|
148
|
+
export type IntentDetail = Omit<Intent, "linked_actions"> & {
|
|
149
|
+
linked_action_records: Array<{
|
|
150
|
+
action_request_id: string;
|
|
151
|
+
action_type: string;
|
|
152
|
+
summary: string;
|
|
153
|
+
decision: string;
|
|
154
|
+
alignment_status: string;
|
|
155
|
+
alignment_score: number | null;
|
|
156
|
+
}>;
|
|
157
|
+
};
|
|
158
|
+
export type CreateIntentInput = {
|
|
159
|
+
title: string;
|
|
160
|
+
description?: string;
|
|
161
|
+
intentType?: string;
|
|
162
|
+
riskLevel?: RiskLevel;
|
|
163
|
+
maxRiskLevel?: RiskLevel;
|
|
164
|
+
expiresAt?: string;
|
|
165
|
+
};
|
|
166
|
+
export type AuthorityGraph = {
|
|
167
|
+
nodes: Array<{
|
|
168
|
+
id: string;
|
|
169
|
+
type: ActorType;
|
|
170
|
+
label: string;
|
|
171
|
+
}>;
|
|
172
|
+
edges: Array<{
|
|
173
|
+
id: string;
|
|
174
|
+
from: string;
|
|
175
|
+
to: string;
|
|
176
|
+
fromType: ActorType;
|
|
177
|
+
toType: ActorType;
|
|
178
|
+
scope: string;
|
|
179
|
+
status: string;
|
|
180
|
+
edgeType: string;
|
|
181
|
+
}>;
|
|
182
|
+
};
|
|
183
|
+
export type ActionEvaluation = {
|
|
184
|
+
id: string;
|
|
185
|
+
action_request_id: string;
|
|
186
|
+
intent_id: string | null;
|
|
187
|
+
decision: "allowed" | "requires_approval" | "blocked";
|
|
188
|
+
risk_score: number;
|
|
189
|
+
authority_valid: boolean;
|
|
190
|
+
intent_valid: boolean;
|
|
191
|
+
root_intent_valid: boolean;
|
|
192
|
+
reasons: string[];
|
|
193
|
+
created_at: string;
|
|
194
|
+
};
|
|
195
|
+
export type RootIntentChain = {
|
|
196
|
+
valid: boolean;
|
|
197
|
+
root_human_id: string | null;
|
|
198
|
+
root_intent_id: string | null;
|
|
199
|
+
reason: string | null;
|
|
200
|
+
chain: Array<{
|
|
201
|
+
actionId?: string;
|
|
202
|
+
actorId: string;
|
|
203
|
+
actorType: ActorType;
|
|
204
|
+
intentId?: string;
|
|
205
|
+
parentActionId?: string;
|
|
206
|
+
label?: string;
|
|
207
|
+
}>;
|
|
208
|
+
};
|
|
110
209
|
export type Policy = {
|
|
111
210
|
id: string;
|
|
112
211
|
name: string;
|
|
@@ -178,6 +277,28 @@ export declare class Auctra {
|
|
|
178
277
|
constructor(options: AuctraClientOptions);
|
|
179
278
|
private request;
|
|
180
279
|
evaluateAction(input: EvaluateActionInput, options?: RequestOptions): Promise<EvaluateActionResponse>;
|
|
280
|
+
listIntents(): Promise<{
|
|
281
|
+
intents: Intent[];
|
|
282
|
+
}>;
|
|
283
|
+
createIntent(input: CreateIntentInput): Promise<{
|
|
284
|
+
intent: {
|
|
285
|
+
id: string;
|
|
286
|
+
title: string;
|
|
287
|
+
status: string;
|
|
288
|
+
};
|
|
289
|
+
}>;
|
|
290
|
+
getIntent(intentId: string): Promise<{
|
|
291
|
+
intent: IntentDetail;
|
|
292
|
+
}>;
|
|
293
|
+
getAuthorityGraph(): Promise<{
|
|
294
|
+
authority_graph: AuthorityGraph;
|
|
295
|
+
}>;
|
|
296
|
+
getActionEvaluation(actionRequestId: string): Promise<{
|
|
297
|
+
evaluation: ActionEvaluation;
|
|
298
|
+
}>;
|
|
299
|
+
getRootIntentChain(actionRequestId: string): Promise<{
|
|
300
|
+
root_intent_chain: RootIntentChain;
|
|
301
|
+
}>;
|
|
181
302
|
listAgents(): Promise<{
|
|
182
303
|
agents: Agent[];
|
|
183
304
|
}>;
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAE1C,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,SAAS,GAAG,YAAY,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AACpE,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,kBAAkB,CAAC;AAClE,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,aAAa,GAAG,eAAe,GAAG,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAE1C,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,SAAS,GAAG,YAAY,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AACpE,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,kBAAkB,CAAC;AAClE,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,aAAa,GAAG,eAAe,GAAG,UAAU,CAAC;AACnF,MA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,GAAG,QAAQ,GAAG,YAAY,CAAC,CAAA;KAAE,CAAC;IAiBvE,eAAe,IAAI,OAAO,CAAC;QAAE,YAAY,EAAE,UAAU,EAAE,CAAA;KAAE,CAAC;IAI1D,WAAW,IAAI,OAAO,CAAC;QAAE,QAAQ,EAAE,aAAa,EAAE,CAAA;KAAE,CAAC;CAG5D"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const AUCTRA_SDK_VERSION = "0.
|
|
1
|
+
export const AUCTRA_SDK_VERSION = "0.3.0";
|
|
2
2
|
export class AuctraApiError extends Error {
|
|
3
3
|
status;
|
|
4
4
|
code;
|
|
@@ -113,7 +113,53 @@ export class Auctra {
|
|
|
113
113
|
}
|
|
114
114
|
async evaluateAction(input, options = {}) {
|
|
115
115
|
const idempotencyKey = options.idempotencyKey ?? crypto.randomUUID();
|
|
116
|
-
return this.request("POST", "/v1/action-requests/evaluate", {
|
|
116
|
+
return this.request("POST", "/v1/action-requests/evaluate", {
|
|
117
|
+
agent_id: input.agentId,
|
|
118
|
+
action_type: input.actionType,
|
|
119
|
+
payload: input.payload ?? {},
|
|
120
|
+
claimed_intent_id: input.claimedIntentId,
|
|
121
|
+
parent_action_id: input.parentActionId,
|
|
122
|
+
actor: input.actor
|
|
123
|
+
? {
|
|
124
|
+
id: input.actor.id,
|
|
125
|
+
type: input.actor.type,
|
|
126
|
+
name: input.actor.name,
|
|
127
|
+
}
|
|
128
|
+
: undefined,
|
|
129
|
+
action: input.action
|
|
130
|
+
? {
|
|
131
|
+
target: input.action.target,
|
|
132
|
+
description: input.action.description,
|
|
133
|
+
risk_level: input.action.riskLevel,
|
|
134
|
+
metadata: input.action.metadata,
|
|
135
|
+
}
|
|
136
|
+
: undefined,
|
|
137
|
+
}, { ...options, idempotencyKey });
|
|
138
|
+
}
|
|
139
|
+
async listIntents() {
|
|
140
|
+
return this.request("GET", "/v1/intents");
|
|
141
|
+
}
|
|
142
|
+
async createIntent(input) {
|
|
143
|
+
return this.request("POST", "/v1/intents", {
|
|
144
|
+
title: input.title,
|
|
145
|
+
description: input.description,
|
|
146
|
+
intent_type: input.intentType,
|
|
147
|
+
risk_level: input.riskLevel,
|
|
148
|
+
max_risk_level: input.maxRiskLevel,
|
|
149
|
+
expires_at: input.expiresAt,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
async getIntent(intentId) {
|
|
153
|
+
return this.request("GET", `/v1/intents/${encodeURIComponent(intentId)}`);
|
|
154
|
+
}
|
|
155
|
+
async getAuthorityGraph() {
|
|
156
|
+
return this.request("GET", "/v1/authority/graph");
|
|
157
|
+
}
|
|
158
|
+
async getActionEvaluation(actionRequestId) {
|
|
159
|
+
return this.request("GET", `/v1/action-requests/${encodeURIComponent(actionRequestId)}/evaluation`);
|
|
160
|
+
}
|
|
161
|
+
async getRootIntentChain(actionRequestId) {
|
|
162
|
+
return this.request("GET", `/v1/action-requests/${encodeURIComponent(actionRequestId)}/root-intent`);
|
|
117
163
|
}
|
|
118
164
|
async listAgents() {
|
|
119
165
|
return this.request("GET", "/v1/agents");
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
|
-
export const AUCTRA_SDK_VERSION = "0.
|
|
1
|
+
export const AUCTRA_SDK_VERSION = "0.3.0";
|
|
2
2
|
|
|
3
3
|
export type AgentEnvironment = "dev" | "staging" | "production";
|
|
4
4
|
export type AuthorityLevel = "low" | "medium" | "high" | "critical";
|
|
5
5
|
export type Decision = "allowed" | "blocked" | "require_approval";
|
|
6
6
|
export type PolicyType = "spending" | "data_access" | "communication" | "approval";
|
|
7
|
+
export type ActorType = "human" | "agent" | "service" | "tool";
|
|
8
|
+
export type RiskLevel = "low" | "medium" | "high" | "critical";
|
|
7
9
|
|
|
8
10
|
export type EvaluateActionInput = {
|
|
9
11
|
agentId: string;
|
|
10
12
|
actionType: string;
|
|
11
13
|
payload?: Record<string, unknown>;
|
|
14
|
+
claimedIntentId?: string;
|
|
15
|
+
parentActionId?: string;
|
|
16
|
+
actor?: {
|
|
17
|
+
id?: string;
|
|
18
|
+
type?: ActorType;
|
|
19
|
+
name?: string;
|
|
20
|
+
};
|
|
21
|
+
action?: {
|
|
22
|
+
target?: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
riskLevel?: RiskLevel;
|
|
25
|
+
metadata?: Record<string, unknown>;
|
|
26
|
+
};
|
|
12
27
|
};
|
|
13
28
|
|
|
14
29
|
export type EvaluateActionResponse = {
|
|
@@ -20,6 +35,12 @@ export type EvaluateActionResponse = {
|
|
|
20
35
|
sponsor: string;
|
|
21
36
|
matched_policies: string[];
|
|
22
37
|
action_request_id: string;
|
|
38
|
+
intelligence?: {
|
|
39
|
+
authority_valid: boolean;
|
|
40
|
+
root_intent_valid: boolean;
|
|
41
|
+
intent_status: string;
|
|
42
|
+
trust_summary?: string;
|
|
43
|
+
};
|
|
23
44
|
};
|
|
24
45
|
|
|
25
46
|
export type RequestOptions = {
|
|
@@ -105,6 +126,82 @@ export type ActionRequest = {
|
|
|
105
126
|
decided_at: string | null;
|
|
106
127
|
};
|
|
107
128
|
|
|
129
|
+
export type Intent = {
|
|
130
|
+
id: string;
|
|
131
|
+
title: string;
|
|
132
|
+
description: string | null;
|
|
133
|
+
intent_type: string | null;
|
|
134
|
+
status: string;
|
|
135
|
+
risk_level: RiskLevel;
|
|
136
|
+
max_risk_level: RiskLevel;
|
|
137
|
+
expires_at: string | null;
|
|
138
|
+
created_at: string;
|
|
139
|
+
owner: { id: string; full_name: string; email: string } | null;
|
|
140
|
+
linked_actions: number;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export type IntentDetail = Omit<Intent, "linked_actions"> & {
|
|
144
|
+
linked_action_records: Array<{
|
|
145
|
+
action_request_id: string;
|
|
146
|
+
action_type: string;
|
|
147
|
+
summary: string;
|
|
148
|
+
decision: string;
|
|
149
|
+
alignment_status: string;
|
|
150
|
+
alignment_score: number | null;
|
|
151
|
+
}>;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export type CreateIntentInput = {
|
|
155
|
+
title: string;
|
|
156
|
+
description?: string;
|
|
157
|
+
intentType?: string;
|
|
158
|
+
riskLevel?: RiskLevel;
|
|
159
|
+
maxRiskLevel?: RiskLevel;
|
|
160
|
+
expiresAt?: string;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export type AuthorityGraph = {
|
|
164
|
+
nodes: Array<{ id: string; type: ActorType; label: string }>;
|
|
165
|
+
edges: Array<{
|
|
166
|
+
id: string;
|
|
167
|
+
from: string;
|
|
168
|
+
to: string;
|
|
169
|
+
fromType: ActorType;
|
|
170
|
+
toType: ActorType;
|
|
171
|
+
scope: string;
|
|
172
|
+
status: string;
|
|
173
|
+
edgeType: string;
|
|
174
|
+
}>;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export type ActionEvaluation = {
|
|
178
|
+
id: string;
|
|
179
|
+
action_request_id: string;
|
|
180
|
+
intent_id: string | null;
|
|
181
|
+
decision: "allowed" | "requires_approval" | "blocked";
|
|
182
|
+
risk_score: number;
|
|
183
|
+
authority_valid: boolean;
|
|
184
|
+
intent_valid: boolean;
|
|
185
|
+
root_intent_valid: boolean;
|
|
186
|
+
reasons: string[];
|
|
187
|
+
created_at: string;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export type RootIntentChain = {
|
|
191
|
+
valid: boolean;
|
|
192
|
+
root_human_id: string | null;
|
|
193
|
+
root_intent_id: string | null;
|
|
194
|
+
reason: string | null;
|
|
195
|
+
chain: Array<{
|
|
196
|
+
actionId?: string;
|
|
197
|
+
actorId: string;
|
|
198
|
+
actorType: ActorType;
|
|
199
|
+
intentId?: string;
|
|
200
|
+
parentActionId?: string;
|
|
201
|
+
label?: string;
|
|
202
|
+
}>;
|
|
203
|
+
};
|
|
204
|
+
|
|
108
205
|
export type Policy = {
|
|
109
206
|
id: string;
|
|
110
207
|
name: string;
|
|
@@ -302,11 +399,69 @@ export class Auctra {
|
|
|
302
399
|
return this.request(
|
|
303
400
|
"POST",
|
|
304
401
|
"/v1/action-requests/evaluate",
|
|
305
|
-
{
|
|
402
|
+
{
|
|
403
|
+
agent_id: input.agentId,
|
|
404
|
+
action_type: input.actionType,
|
|
405
|
+
payload: input.payload ?? {},
|
|
406
|
+
claimed_intent_id: input.claimedIntentId,
|
|
407
|
+
parent_action_id: input.parentActionId,
|
|
408
|
+
actor: input.actor
|
|
409
|
+
? {
|
|
410
|
+
id: input.actor.id,
|
|
411
|
+
type: input.actor.type,
|
|
412
|
+
name: input.actor.name,
|
|
413
|
+
}
|
|
414
|
+
: undefined,
|
|
415
|
+
action: input.action
|
|
416
|
+
? {
|
|
417
|
+
target: input.action.target,
|
|
418
|
+
description: input.action.description,
|
|
419
|
+
risk_level: input.action.riskLevel,
|
|
420
|
+
metadata: input.action.metadata,
|
|
421
|
+
}
|
|
422
|
+
: undefined,
|
|
423
|
+
},
|
|
306
424
|
{ ...options, idempotencyKey },
|
|
307
425
|
);
|
|
308
426
|
}
|
|
309
427
|
|
|
428
|
+
async listIntents(): Promise<{ intents: Intent[] }> {
|
|
429
|
+
return this.request("GET", "/v1/intents");
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
async createIntent(input: CreateIntentInput): Promise<{ intent: { id: string; title: string; status: string } }> {
|
|
433
|
+
return this.request("POST", "/v1/intents", {
|
|
434
|
+
title: input.title,
|
|
435
|
+
description: input.description,
|
|
436
|
+
intent_type: input.intentType,
|
|
437
|
+
risk_level: input.riskLevel,
|
|
438
|
+
max_risk_level: input.maxRiskLevel,
|
|
439
|
+
expires_at: input.expiresAt,
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
async getIntent(intentId: string): Promise<{ intent: IntentDetail }> {
|
|
444
|
+
return this.request("GET", `/v1/intents/${encodeURIComponent(intentId)}`);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
async getAuthorityGraph(): Promise<{ authority_graph: AuthorityGraph }> {
|
|
448
|
+
return this.request("GET", "/v1/authority/graph");
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
async getActionEvaluation(actionRequestId: string): Promise<{ evaluation: ActionEvaluation }> {
|
|
452
|
+
return this.request(
|
|
453
|
+
"GET",
|
|
454
|
+
`/v1/action-requests/${encodeURIComponent(actionRequestId)}/evaluation`,
|
|
455
|
+
);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
async getRootIntentChain(actionRequestId: string): Promise<{ root_intent_chain: RootIntentChain }> {
|
|
459
|
+
return this.request(
|
|
460
|
+
"GET",
|
|
461
|
+
`/v1/action-requests/${encodeURIComponent(actionRequestId)}/root-intent`,
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
|
|
310
465
|
async listAgents(): Promise<{ agents: Agent[] }> {
|
|
311
466
|
return this.request("GET", "/v1/agents");
|
|
312
467
|
}
|