@aumos/cowork-governance 0.1.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 +122 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +149 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +278 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/package.json +34 -0
- package/src/client.ts +369 -0
- package/src/index.ts +37 -0
- package/src/types.ts +349 -0
- package/tsconfig.json +25 -0
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for the AumOS cowork-governance policy enforcement API.
|
|
3
|
+
*
|
|
4
|
+
* Uses the Fetch API (available natively in Node 18+, browsers, and Deno).
|
|
5
|
+
* No external dependencies required.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { createCoworkGovernanceClient } from "@aumos/cowork-governance";
|
|
10
|
+
*
|
|
11
|
+
* const client = createCoworkGovernanceClient({ baseUrl: "http://localhost:8094" });
|
|
12
|
+
*
|
|
13
|
+
* const result = await client.checkPolicy({
|
|
14
|
+
* action_context: { action: "file_read", path: "/etc/passwd" },
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* if (result.ok && !result.data.allowed) {
|
|
18
|
+
* console.log("Blocked by:", result.data.blocking_policy);
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
import type { ApiResult, CompliancePolicy, GovernanceConstitution, GovernanceDashboard, PendingApprovals, PolicyEvaluationResult, ValidateWorkflowRequest } from "./types.js";
|
|
23
|
+
/** Configuration options for the CoworkGovernanceClient. */
|
|
24
|
+
export interface CoworkGovernanceClientConfig {
|
|
25
|
+
/** Base URL of the cowork-governance server (e.g. "http://localhost:8094"). */
|
|
26
|
+
readonly baseUrl: string;
|
|
27
|
+
/** Optional request timeout in milliseconds (default: 30000). */
|
|
28
|
+
readonly timeoutMs?: number;
|
|
29
|
+
/** Optional extra HTTP headers sent with every request. */
|
|
30
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
31
|
+
}
|
|
32
|
+
/** Typed HTTP client for the cowork-governance server. */
|
|
33
|
+
export interface CoworkGovernanceClient {
|
|
34
|
+
/**
|
|
35
|
+
* Evaluate an action context against all loaded governance policies.
|
|
36
|
+
*
|
|
37
|
+
* The first BLOCK policy that matches terminates evaluation and sets
|
|
38
|
+
* allowed=false. APPROVE policies set requires_approval=true without blocking.
|
|
39
|
+
*
|
|
40
|
+
* @param request - The action context to evaluate and optional agent scope.
|
|
41
|
+
* @returns A PolicyEvaluationResult with allowed/blocked decision and per-policy results.
|
|
42
|
+
*/
|
|
43
|
+
checkPolicy(request: ValidateWorkflowRequest): Promise<ApiResult<PolicyEvaluationResult>>;
|
|
44
|
+
/**
|
|
45
|
+
* Retrieve all policy violations recorded within the given time window.
|
|
46
|
+
*
|
|
47
|
+
* @param options - Optional filter parameters for agent, time range, and severity.
|
|
48
|
+
* @returns Array of PolicyViolation records for matched policies.
|
|
49
|
+
*/
|
|
50
|
+
getViolations(options?: {
|
|
51
|
+
readonly agentId?: string;
|
|
52
|
+
readonly since?: string;
|
|
53
|
+
readonly limit?: number;
|
|
54
|
+
}): Promise<ApiResult<readonly PolicyEvaluationResult[]>>;
|
|
55
|
+
/**
|
|
56
|
+
* Retrieve the governance dashboard health summary and aggregate statistics.
|
|
57
|
+
*
|
|
58
|
+
* @returns A GovernanceDashboard with health status, counts, and cost summary.
|
|
59
|
+
*/
|
|
60
|
+
getDashboard(): Promise<ApiResult<GovernanceDashboard>>;
|
|
61
|
+
/**
|
|
62
|
+
* Validate an agent workflow action against all governance policies.
|
|
63
|
+
*
|
|
64
|
+
* Equivalent to checkPolicy but returns a richer validation object
|
|
65
|
+
* suitable for pre-execution workflow gates.
|
|
66
|
+
*
|
|
67
|
+
* @param request - The workflow action to validate.
|
|
68
|
+
* @returns A PolicyEvaluationResult indicating whether the workflow may proceed.
|
|
69
|
+
*/
|
|
70
|
+
validateWorkflow(request: ValidateWorkflowRequest): Promise<ApiResult<PolicyEvaluationResult>>;
|
|
71
|
+
/**
|
|
72
|
+
* Retrieve the active governance constitution for the specified team.
|
|
73
|
+
*
|
|
74
|
+
* @param teamName - The team whose constitution to retrieve (default: "default").
|
|
75
|
+
* @returns The GovernanceConstitution defining roles, constraints, and escalation rules.
|
|
76
|
+
*/
|
|
77
|
+
getConstitution(teamName?: string): Promise<ApiResult<GovernanceConstitution>>;
|
|
78
|
+
/**
|
|
79
|
+
* Upload or replace the governance constitution for a team.
|
|
80
|
+
*
|
|
81
|
+
* @param constitution - The full constitution document to activate.
|
|
82
|
+
* @returns The stored GovernanceConstitution as confirmed by the server.
|
|
83
|
+
*/
|
|
84
|
+
setConstitution(constitution: GovernanceConstitution): Promise<ApiResult<GovernanceConstitution>>;
|
|
85
|
+
/**
|
|
86
|
+
* Retrieve all currently loaded governance policies.
|
|
87
|
+
*
|
|
88
|
+
* @returns Array of CompliancePolicy records in declaration order.
|
|
89
|
+
*/
|
|
90
|
+
getPolicies(): Promise<ApiResult<readonly CompliancePolicy[]>>;
|
|
91
|
+
/**
|
|
92
|
+
* Retrieve all pending approval requests awaiting human review.
|
|
93
|
+
*
|
|
94
|
+
* @returns A PendingApprovals object with pending requests and total count.
|
|
95
|
+
*/
|
|
96
|
+
getPendingApprovals(): Promise<ApiResult<PendingApprovals>>;
|
|
97
|
+
/**
|
|
98
|
+
* Approve a pending governance request.
|
|
99
|
+
*
|
|
100
|
+
* @param requestId - The approval request identifier to approve.
|
|
101
|
+
* @param approvedBy - Identifier of the human or system approving the request.
|
|
102
|
+
* @returns An empty object on successful approval.
|
|
103
|
+
*/
|
|
104
|
+
approveRequest(requestId: string, approvedBy: string): Promise<ApiResult<Readonly<Record<string, never>>>>;
|
|
105
|
+
/**
|
|
106
|
+
* Reject a pending governance request.
|
|
107
|
+
*
|
|
108
|
+
* @param requestId - The approval request identifier to reject.
|
|
109
|
+
* @param rejectedBy - Identifier of the human or system rejecting the request.
|
|
110
|
+
* @param reason - Optional human-readable reason for the rejection.
|
|
111
|
+
* @returns An empty object on successful rejection.
|
|
112
|
+
*/
|
|
113
|
+
rejectRequest(requestId: string, rejectedBy: string, reason?: string): Promise<ApiResult<Readonly<Record<string, never>>>>;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Create a typed HTTP client for the cowork-governance server.
|
|
117
|
+
*
|
|
118
|
+
* @param config - Client configuration including base URL.
|
|
119
|
+
* @returns A CoworkGovernanceClient instance.
|
|
120
|
+
*/
|
|
121
|
+
export declare function createCoworkGovernanceClient(config: CoworkGovernanceClientConfig): CoworkGovernanceClient;
|
|
122
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAEV,SAAS,EACT,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAMpB,4DAA4D;AAC5D,MAAM,WAAW,4BAA4B;IAC3C,+EAA+E;IAC/E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,iEAAiE;IACjE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,2DAA2D;IAC3D,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACrD;AA0DD,0DAA0D;AAC1D,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;OAQG;I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E,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;CACxD;AAMD;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,4BAA4B,GACnC,sBAAsB,CAkJxB"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for the AumOS cowork-governance policy enforcement API.
|
|
3
|
+
*
|
|
4
|
+
* Uses the Fetch API (available natively in Node 18+, browsers, and Deno).
|
|
5
|
+
* No external dependencies required.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { createCoworkGovernanceClient } from "@aumos/cowork-governance";
|
|
10
|
+
*
|
|
11
|
+
* const client = createCoworkGovernanceClient({ baseUrl: "http://localhost:8094" });
|
|
12
|
+
*
|
|
13
|
+
* const result = await client.checkPolicy({
|
|
14
|
+
* action_context: { action: "file_read", path: "/etc/passwd" },
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* if (result.ok && !result.data.allowed) {
|
|
18
|
+
* console.log("Blocked by:", result.data.blocking_policy);
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
// Internal helpers
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
async function fetchJson(url, init, timeoutMs) {
|
|
26
|
+
const controller = new AbortController();
|
|
27
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
28
|
+
try {
|
|
29
|
+
const response = await fetch(url, { ...init, signal: controller.signal });
|
|
30
|
+
clearTimeout(timeoutId);
|
|
31
|
+
const body = await response.json();
|
|
32
|
+
if (!response.ok) {
|
|
33
|
+
const errorBody = body;
|
|
34
|
+
return {
|
|
35
|
+
ok: false,
|
|
36
|
+
error: {
|
|
37
|
+
error: errorBody.error ?? "Unknown error",
|
|
38
|
+
detail: errorBody.detail ?? "",
|
|
39
|
+
},
|
|
40
|
+
status: response.status,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return { ok: true, data: body };
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
clearTimeout(timeoutId);
|
|
47
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
48
|
+
return {
|
|
49
|
+
ok: false,
|
|
50
|
+
error: { error: "Network error", detail: message },
|
|
51
|
+
status: 0,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function buildHeaders(extraHeaders) {
|
|
56
|
+
return {
|
|
57
|
+
"Content-Type": "application/json",
|
|
58
|
+
Accept: "application/json",
|
|
59
|
+
...extraHeaders,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
// Client factory
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
/**
|
|
66
|
+
* Create a typed HTTP client for the cowork-governance server.
|
|
67
|
+
*
|
|
68
|
+
* @param config - Client configuration including base URL.
|
|
69
|
+
* @returns A CoworkGovernanceClient instance.
|
|
70
|
+
*/
|
|
71
|
+
export function createCoworkGovernanceClient(config) {
|
|
72
|
+
const { baseUrl, timeoutMs = 30000, headers: extraHeaders } = config;
|
|
73
|
+
const baseHeaders = buildHeaders(extraHeaders);
|
|
74
|
+
return {
|
|
75
|
+
async checkPolicy(request) {
|
|
76
|
+
return fetchJson(`${baseUrl}/policies/check`, {
|
|
77
|
+
method: "POST",
|
|
78
|
+
headers: baseHeaders,
|
|
79
|
+
body: JSON.stringify(request),
|
|
80
|
+
}, timeoutMs);
|
|
81
|
+
},
|
|
82
|
+
async getViolations(options) {
|
|
83
|
+
const params = new URLSearchParams();
|
|
84
|
+
if (options?.agentId !== undefined) {
|
|
85
|
+
params.set("agent_id", options.agentId);
|
|
86
|
+
}
|
|
87
|
+
if (options?.since !== undefined) {
|
|
88
|
+
params.set("since", options.since);
|
|
89
|
+
}
|
|
90
|
+
if (options?.limit !== undefined) {
|
|
91
|
+
params.set("limit", String(options.limit));
|
|
92
|
+
}
|
|
93
|
+
const queryString = params.toString();
|
|
94
|
+
const url = queryString
|
|
95
|
+
? `${baseUrl}/violations?${queryString}`
|
|
96
|
+
: `${baseUrl}/violations`;
|
|
97
|
+
return fetchJson(url, { method: "GET", headers: baseHeaders }, timeoutMs);
|
|
98
|
+
},
|
|
99
|
+
async getDashboard() {
|
|
100
|
+
return fetchJson(`${baseUrl}/dashboard`, { method: "GET", headers: baseHeaders }, timeoutMs);
|
|
101
|
+
},
|
|
102
|
+
async validateWorkflow(request) {
|
|
103
|
+
return fetchJson(`${baseUrl}/workflow/validate`, {
|
|
104
|
+
method: "POST",
|
|
105
|
+
headers: baseHeaders,
|
|
106
|
+
body: JSON.stringify(request),
|
|
107
|
+
}, timeoutMs);
|
|
108
|
+
},
|
|
109
|
+
async getConstitution(teamName) {
|
|
110
|
+
const params = new URLSearchParams();
|
|
111
|
+
if (teamName !== undefined) {
|
|
112
|
+
params.set("team", teamName);
|
|
113
|
+
}
|
|
114
|
+
const queryString = params.toString();
|
|
115
|
+
const url = queryString
|
|
116
|
+
? `${baseUrl}/constitution?${queryString}`
|
|
117
|
+
: `${baseUrl}/constitution`;
|
|
118
|
+
return fetchJson(url, { method: "GET", headers: baseHeaders }, timeoutMs);
|
|
119
|
+
},
|
|
120
|
+
async setConstitution(constitution) {
|
|
121
|
+
return fetchJson(`${baseUrl}/constitution`, {
|
|
122
|
+
method: "PUT",
|
|
123
|
+
headers: baseHeaders,
|
|
124
|
+
body: JSON.stringify(constitution),
|
|
125
|
+
}, timeoutMs);
|
|
126
|
+
},
|
|
127
|
+
async getPolicies() {
|
|
128
|
+
return fetchJson(`${baseUrl}/policies`, { method: "GET", headers: baseHeaders }, timeoutMs);
|
|
129
|
+
},
|
|
130
|
+
async getPendingApprovals() {
|
|
131
|
+
return fetchJson(`${baseUrl}/approvals/pending`, { method: "GET", headers: baseHeaders }, timeoutMs);
|
|
132
|
+
},
|
|
133
|
+
async approveRequest(requestId, approvedBy) {
|
|
134
|
+
return fetchJson(`${baseUrl}/approvals/${encodeURIComponent(requestId)}/approve`, {
|
|
135
|
+
method: "POST",
|
|
136
|
+
headers: baseHeaders,
|
|
137
|
+
body: JSON.stringify({ approved_by: approvedBy }),
|
|
138
|
+
}, timeoutMs);
|
|
139
|
+
},
|
|
140
|
+
async rejectRequest(requestId, rejectedBy, reason) {
|
|
141
|
+
return fetchJson(`${baseUrl}/approvals/${encodeURIComponent(requestId)}/reject`, {
|
|
142
|
+
method: "POST",
|
|
143
|
+
headers: baseHeaders,
|
|
144
|
+
body: JSON.stringify({ rejected_by: rejectedBy, reason: reason ?? "" }),
|
|
145
|
+
}, timeoutMs);
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA2BH,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E,KAAK,UAAU,SAAS,CACtB,GAAW,EACX,IAAiB,EACjB,SAAiB;IAEjB,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,SAAS,CAAC,CAAC;IAElE,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;QAC1E,YAAY,CAAC,SAAS,CAAC,CAAC;QAExB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,I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Ac,CAClB,SAAiB,EACjB,UAAkB;YAElB,OAAO,SAAS,CACd,GAAG,OAAO,cAAc,kBAAkB,CAAC,SAAS,CAAC,UAAU,EAC/D;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;aAClD,EACD,SAAS,CACV,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,aAAa,CACjB,SAAiB,EACjB,UAAkB,EAClB,MAAe;YAEf,OAAO,SAAS,CACd,GAAG,OAAO,cAAc,kBAAkB,CAAC,SAAS,CAAC,SAAS,EAC9D;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,WAAW;gBACpB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,EAAE,CAAC;aACxE,EACD,SAAS,CACV,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @aumos/cowork-governance
|
|
3
|
+
*
|
|
4
|
+
* TypeScript client for the AumOS cowork-governance library.
|
|
5
|
+
* Provides HTTP client and governance type definitions for multi-agent
|
|
6
|
+
* policy enforcement, workflow validation, and constitutional governance.
|
|
7
|
+
*/
|
|
8
|
+
export type { CoworkGovernanceClient, CoworkGovernanceClientConfig } from "./client.js";
|
|
9
|
+
export { createCoworkGovernanceClient } from "./client.js";
|
|
10
|
+
export type { PolicyAction, Permission, ConflictStrategy, ConstraintType, PolicyCondition, CompliancePolicy, PolicyViolation, PolicyEvaluationResult, RoleDefinition, GovernanceConstraint, EscalationRule, ConstitutionRule, GovernanceConstitution, WorkflowGuardianConfig, AuditSummary, CostSummary, GovernanceDashboard, ApprovalRequest, PendingApprovals, ValidateWorkflowRequest, ApiError, ApiResult, } from "./types.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAG3D,YAAY,EACV,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACvB,QAAQ,EACR,SAAS,GACV,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @aumos/cowork-governance
|
|
3
|
+
*
|
|
4
|
+
* TypeScript client for the AumOS cowork-governance library.
|
|
5
|
+
* Provides HTTP client and governance type definitions for multi-agent
|
|
6
|
+
* policy enforcement, workflow validation, and constitutional governance.
|
|
7
|
+
*/
|
|
8
|
+
export { createCoworkGovernanceClient } from "./client.js";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript interfaces for the AumOS cowork-governance library.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the Python types defined in:
|
|
5
|
+
* aumos_cowork_governance.policies.engine
|
|
6
|
+
* aumos_cowork_governance.constitution.schema
|
|
7
|
+
* aumos_cowork_governance.dashboard.api
|
|
8
|
+
*
|
|
9
|
+
* All interfaces use readonly fields to match Python's Pydantic models.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Actions that a governance policy can mandate when its conditions are met.
|
|
13
|
+
* Maps to PolicyAction enum in Python.
|
|
14
|
+
*/
|
|
15
|
+
export type PolicyAction = "allow" | "block" | "warn" | "log" | "approve";
|
|
16
|
+
/**
|
|
17
|
+
* Granular permissions that can be assigned to a role.
|
|
18
|
+
* Maps to Permission enum in Python.
|
|
19
|
+
*/
|
|
20
|
+
export type Permission = "read" | "write" | "execute" | "delegate" | "approve" | "escalate";
|
|
21
|
+
/**
|
|
22
|
+
* Strategy applied when two agents produce conflicting actions.
|
|
23
|
+
* Maps to ConflictStrategy enum in Python.
|
|
24
|
+
*/
|
|
25
|
+
export type ConflictStrategy = "priority_based" | "consensus" | "leader_decides" | "most_restrictive";
|
|
26
|
+
/**
|
|
27
|
+
* Constraint type categories.
|
|
28
|
+
* Maps to valid constraint_type values in Python.
|
|
29
|
+
*/
|
|
30
|
+
export type ConstraintType = "budget_limit" | "rate_limit" | "scope_limit" | "safety_rule";
|
|
31
|
+
/**
|
|
32
|
+
* A single governance policy condition.
|
|
33
|
+
*/
|
|
34
|
+
export interface PolicyCondition {
|
|
35
|
+
/** Dot-separated field path to evaluate from the action context. */
|
|
36
|
+
readonly field: string;
|
|
37
|
+
/** Comparison operator (e.g. "equals", "contains", "greater_than"). */
|
|
38
|
+
readonly operator: string;
|
|
39
|
+
/** The expected value to compare against. */
|
|
40
|
+
readonly value: unknown;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A governance policy rule that evaluates conditions and mandates an action.
|
|
44
|
+
*/
|
|
45
|
+
export interface CompliancePolicy {
|
|
46
|
+
/** Human-readable policy name. */
|
|
47
|
+
readonly name: string;
|
|
48
|
+
/** The action to take when conditions are met. */
|
|
49
|
+
readonly action: PolicyAction;
|
|
50
|
+
/** Conditions that must be met (AND/OR logic per condition_logic). */
|
|
51
|
+
readonly conditions: readonly PolicyCondition[];
|
|
52
|
+
/** Logic for combining conditions: "AND" (default) or "OR". */
|
|
53
|
+
readonly condition_logic: "AND" | "OR";
|
|
54
|
+
/** Human-readable message explaining this policy's purpose. */
|
|
55
|
+
readonly message: string;
|
|
56
|
+
/** List of identifiers to notify when this policy triggers. */
|
|
57
|
+
readonly notify: readonly string[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Result of evaluating a single policy rule against an action context.
|
|
61
|
+
* Maps to PolicyResult dataclass in Python.
|
|
62
|
+
*/
|
|
63
|
+
export interface PolicyViolation {
|
|
64
|
+
/** Name of the policy that produced this result. */
|
|
65
|
+
readonly policy_name: string;
|
|
66
|
+
/** Whether the policy conditions were matched. */
|
|
67
|
+
readonly matched: boolean;
|
|
68
|
+
/** The action mandated by this policy. */
|
|
69
|
+
readonly action: PolicyAction;
|
|
70
|
+
/** Human-readable message from the policy. */
|
|
71
|
+
readonly message: string;
|
|
72
|
+
/** Identifiers to notify when this policy triggers. */
|
|
73
|
+
readonly notify: readonly string[];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Aggregate result of running all policies against an action context.
|
|
77
|
+
* Maps to EvaluationResult dataclass in Python.
|
|
78
|
+
*/
|
|
79
|
+
export interface PolicyEvaluationResult {
|
|
80
|
+
/** Whether the action is allowed (false only when a BLOCK policy matched). */
|
|
81
|
+
readonly allowed: boolean;
|
|
82
|
+
/** Per-policy evaluation results. */
|
|
83
|
+
readonly results: readonly PolicyViolation[];
|
|
84
|
+
/** Whether an APPROVE policy matched (human approval required). */
|
|
85
|
+
readonly requires_approval: boolean;
|
|
86
|
+
/** Name of the first BLOCK policy that triggered, or null. */
|
|
87
|
+
readonly blocking_policy: string | null;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Capabilities, budget limits, and tool access rules for a single agent role.
|
|
91
|
+
* Maps to RoleDefinition in Python.
|
|
92
|
+
*/
|
|
93
|
+
export interface RoleDefinition {
|
|
94
|
+
/** Unique identifier for this role within the constitution. */
|
|
95
|
+
readonly name: string;
|
|
96
|
+
/** Set of Permission values granted to this role. */
|
|
97
|
+
readonly permissions: readonly Permission[];
|
|
98
|
+
/** Maximum cumulative spend in USD this role may authorise, or null for no cap. */
|
|
99
|
+
readonly max_budget_usd: number | null;
|
|
100
|
+
/** fnmatch-style patterns of tool names this role may invoke. */
|
|
101
|
+
readonly allowed_tools: readonly string[];
|
|
102
|
+
/** fnmatch-style patterns of tool names this role may never invoke. */
|
|
103
|
+
readonly denied_tools: readonly string[];
|
|
104
|
+
/** Names of other roles this role is permitted to delegate tasks to. */
|
|
105
|
+
readonly can_delegate_to: readonly string[];
|
|
106
|
+
/** Names of roles whose approval is needed before sensitive actions proceed. */
|
|
107
|
+
readonly requires_approval_from: readonly string[];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* A parameterised governance rule applying to one or more roles.
|
|
111
|
+
* Maps to Constraint in Python.
|
|
112
|
+
*/
|
|
113
|
+
export interface GovernanceConstraint {
|
|
114
|
+
/** Human-readable identifier for this constraint. */
|
|
115
|
+
readonly name: string;
|
|
116
|
+
/** Explanation of what the constraint enforces. */
|
|
117
|
+
readonly description: string;
|
|
118
|
+
/** The type of governance constraint. */
|
|
119
|
+
readonly constraint_type: ConstraintType;
|
|
120
|
+
/** Arbitrary key/value pairs that configure the constraint. */
|
|
121
|
+
readonly parameters: Readonly<Record<string, unknown>>;
|
|
122
|
+
/** List of role names this constraint targets. Use ["*"] for all roles. */
|
|
123
|
+
readonly applies_to: readonly string[];
|
|
124
|
+
/** Consequence of a violation: "warning", "error", or "critical". */
|
|
125
|
+
readonly severity: "warning" | "error" | "critical";
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Defines when and how one role escalates to another.
|
|
129
|
+
* Maps to EscalationRule in Python.
|
|
130
|
+
*/
|
|
131
|
+
export interface EscalationRule {
|
|
132
|
+
/** Natural-language description of the condition that causes escalation. */
|
|
133
|
+
readonly trigger: string;
|
|
134
|
+
/** The role that originates the escalation. */
|
|
135
|
+
readonly from_role: string;
|
|
136
|
+
/** The role that receives the escalated matter. */
|
|
137
|
+
readonly to_role: string;
|
|
138
|
+
/** When true the escalation happens automatically; otherwise it is suggested. */
|
|
139
|
+
readonly auto_escalate: boolean;
|
|
140
|
+
/** Maximum wait time in seconds before escalation is auto-resolved, or null. */
|
|
141
|
+
readonly timeout_seconds: number | null;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A constitution rule — a single named governance principle within a Constitution.
|
|
145
|
+
* Provides a named-rule abstraction layer over constraints and escalation rules.
|
|
146
|
+
*/
|
|
147
|
+
export interface ConstitutionRule {
|
|
148
|
+
/** Unique rule identifier within the constitution. */
|
|
149
|
+
readonly rule_id: string;
|
|
150
|
+
/** Human-readable name of the rule. */
|
|
151
|
+
readonly name: string;
|
|
152
|
+
/** Description of what this rule enforces. */
|
|
153
|
+
readonly description: string;
|
|
154
|
+
/** Type of rule: "constraint", "escalation", or "permission". */
|
|
155
|
+
readonly rule_type: "constraint" | "escalation" | "permission";
|
|
156
|
+
/** Roles this rule applies to. */
|
|
157
|
+
readonly applies_to: readonly string[];
|
|
158
|
+
/** Whether violations of this rule are fatal (blocking). */
|
|
159
|
+
readonly is_fatal: boolean;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Top-level governance document for a multi-agent team.
|
|
163
|
+
* Maps to Constitution in Python.
|
|
164
|
+
*/
|
|
165
|
+
export interface GovernanceConstitution {
|
|
166
|
+
/** Semantic version string for this constitution document. */
|
|
167
|
+
readonly version: string;
|
|
168
|
+
/** Name of the team or project this constitution governs. */
|
|
169
|
+
readonly team_name: string;
|
|
170
|
+
/** Human-readable summary of the team's governance philosophy. */
|
|
171
|
+
readonly description: string;
|
|
172
|
+
/** Ordered list of role definitions. Order matters for PRIORITY_BASED conflict resolution. */
|
|
173
|
+
readonly roles: readonly RoleDefinition[];
|
|
174
|
+
/** List of governance constraints enforced at runtime. */
|
|
175
|
+
readonly constraints: readonly GovernanceConstraint[];
|
|
176
|
+
/** List of escalation rules defining escalation paths. */
|
|
177
|
+
readonly escalation_rules: readonly EscalationRule[];
|
|
178
|
+
/** The default strategy applied when agent actions conflict. */
|
|
179
|
+
readonly conflict_strategy: ConflictStrategy;
|
|
180
|
+
/** ISO-8601 UTC timestamp when this constitution was first created. */
|
|
181
|
+
readonly created_at: string;
|
|
182
|
+
/** ISO-8601 UTC timestamp of the most recent modification. */
|
|
183
|
+
readonly updated_at: string;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Configuration for the WorkflowGuardian that intercepts agent actions.
|
|
187
|
+
*/
|
|
188
|
+
export interface WorkflowGuardianConfig {
|
|
189
|
+
/** Whether the guardian is active. */
|
|
190
|
+
readonly enabled: boolean;
|
|
191
|
+
/** Agent ID this guardian is protecting. */
|
|
192
|
+
readonly agent_id: string;
|
|
193
|
+
/** The governance constitution to enforce. */
|
|
194
|
+
readonly constitution?: GovernanceConstitution;
|
|
195
|
+
/** Whether to log all evaluated actions to the audit trail. */
|
|
196
|
+
readonly audit_all_actions: boolean;
|
|
197
|
+
/** Maximum action cost in USD to allow without approval. */
|
|
198
|
+
readonly auto_approve_below_cost_usd?: number;
|
|
199
|
+
}
|
|
200
|
+
/** Summary of recent audit log activity. */
|
|
201
|
+
export interface AuditSummary {
|
|
202
|
+
/** List of recent audit log entries. */
|
|
203
|
+
readonly entries: readonly Readonly<Record<string, unknown>>[];
|
|
204
|
+
/** Total count of audit log entries. */
|
|
205
|
+
readonly total: number;
|
|
206
|
+
}
|
|
207
|
+
/** Cost tracking summary across all governed agents. */
|
|
208
|
+
export interface CostSummary {
|
|
209
|
+
/** Total cost in USD across all tracked calls. */
|
|
210
|
+
readonly total_cost_usd: number;
|
|
211
|
+
/** Total token count across all tracked calls. */
|
|
212
|
+
readonly total_tokens: number;
|
|
213
|
+
/** Total number of LLM API calls tracked. */
|
|
214
|
+
readonly call_count: number;
|
|
215
|
+
/** Cost breakdown by model name. */
|
|
216
|
+
readonly by_model: Readonly<Record<string, number>>;
|
|
217
|
+
/** Cost breakdown by task identifier. */
|
|
218
|
+
readonly by_task: Readonly<Record<string, number>>;
|
|
219
|
+
}
|
|
220
|
+
/** Aggregate governance health summary for the dashboard. */
|
|
221
|
+
export interface GovernanceDashboard {
|
|
222
|
+
/** Whether the governance system is operating normally. */
|
|
223
|
+
readonly healthy: boolean;
|
|
224
|
+
/** ISO-8601 UTC timestamp of this status snapshot. */
|
|
225
|
+
readonly timestamp: string;
|
|
226
|
+
/** Total number of audit log entries. */
|
|
227
|
+
readonly audit_count: number;
|
|
228
|
+
/** Total number of loaded governance policies. */
|
|
229
|
+
readonly policy_count: number;
|
|
230
|
+
/** Number of pending approval requests. */
|
|
231
|
+
readonly pending_approvals: number;
|
|
232
|
+
/** Accumulated cost across all governed agents in USD. */
|
|
233
|
+
readonly total_cost_usd: number;
|
|
234
|
+
}
|
|
235
|
+
/** A pending approval request awaiting human review. */
|
|
236
|
+
export interface ApprovalRequest {
|
|
237
|
+
/** Unique identifier for this approval request. */
|
|
238
|
+
readonly request_id: string;
|
|
239
|
+
/** Name of the policy that triggered the approval requirement. */
|
|
240
|
+
readonly policy_name: string;
|
|
241
|
+
/** Human-readable message describing what needs approval. */
|
|
242
|
+
readonly message: string;
|
|
243
|
+
/** ISO-8601 UTC timestamp when this request was created. */
|
|
244
|
+
readonly created_at: string;
|
|
245
|
+
/** Identifiers to notify about this pending approval. */
|
|
246
|
+
readonly notify: readonly string[];
|
|
247
|
+
/** The action context that triggered the approval requirement. */
|
|
248
|
+
readonly action_context: Readonly<Record<string, unknown>>;
|
|
249
|
+
}
|
|
250
|
+
/** Container for pending approval requests. */
|
|
251
|
+
export interface PendingApprovals {
|
|
252
|
+
/** List of pending approval request records. */
|
|
253
|
+
readonly pending: readonly ApprovalRequest[];
|
|
254
|
+
/** Total count of pending approval requests. */
|
|
255
|
+
readonly count: number;
|
|
256
|
+
}
|
|
257
|
+
/** Request to validate an agent action against governance policies. */
|
|
258
|
+
export interface ValidateWorkflowRequest {
|
|
259
|
+
/** The action context to evaluate against all loaded policies. */
|
|
260
|
+
readonly action_context: Readonly<Record<string, unknown>>;
|
|
261
|
+
/** Optional agent ID for scoped evaluation. */
|
|
262
|
+
readonly agent_id?: string;
|
|
263
|
+
}
|
|
264
|
+
/** Standard error payload returned by the cowork-governance API. */
|
|
265
|
+
export interface ApiError {
|
|
266
|
+
readonly error: string;
|
|
267
|
+
readonly detail: string;
|
|
268
|
+
}
|
|
269
|
+
/** Result type for all client operations. */
|
|
270
|
+
export type ApiResult<T> = {
|
|
271
|
+
readonly ok: true;
|
|
272
|
+
readonly data: T;
|
|
273
|
+
} | {
|
|
274
|
+
readonly ok: false;
|
|
275
|
+
readonly error: ApiError;
|
|
276
|
+
readonly status: number;
|
|
277
|
+
};
|
|
278
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB,OAAO,GACP,OAAO,GACP,MAAM,GACN,KAAK,GACL,SAAS,CAAC;AAEd;;;GAGG;AACH,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,OAAO,GACP,SAAS,GACT,UAAU,GACV,SAAS,GACT,UAAU,CAAC;AAEf;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACxB,gBAAgB,GAChB,WAAW,GACX,gBAAgB,GAChB,kBAAkB,CAAC;AAEvB;;;GAGG;AACH,MAAM,MAAM,cAAc,GACtB,cAAc,GACd,YAAY,GACZ,aAAa,GACb,aAAa,CAAC;AAMlB;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,oEAAoE;IACpE,QAAQ,CAA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E,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GACvC;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript interfaces for the AumOS cowork-governance library.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the Python types defined in:
|
|
5
|
+
* aumos_cowork_governance.policies.engine
|
|
6
|
+
* aumos_cowork_governance.constitution.schema
|
|
7
|
+
* aumos_cowork_governance.dashboard.api
|
|
8
|
+
*
|
|
9
|
+
* All interfaces use readonly fields to match Python's Pydantic models.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aumos/cowork-governance",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript client for the AumOS cowork-governance — multi-agent policy enforcement, workflow validation, and constitutional governance",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"typecheck": "tsc --noEmit"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"typescript": "^5.3.0"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"aumos",
|
|
24
|
+
"cowork-governance",
|
|
25
|
+
"policy",
|
|
26
|
+
"constitution",
|
|
27
|
+
"multi-agent",
|
|
28
|
+
"typescript"
|
|
29
|
+
],
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "https://github.com/aumos-ai/aumos-cowork-governance"
|
|
33
|
+
}
|
|
34
|
+
}
|