@aegisora/policy-engine 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/engine/policy-engine.d.ts +8 -0
- package/dist/engine/policy-engine.d.ts.map +1 -0
- package/dist/engine/policy-engine.js +24 -0
- package/dist/engine/policy-engine.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/rules/base-rule.d.ts +6 -0
- package/dist/rules/base-rule.d.ts.map +1 -0
- package/dist/rules/base-rule.js +3 -0
- package/dist/rules/base-rule.js.map +1 -0
- package/dist/types/policy.d.ts +12 -0
- package/dist/types/policy.d.ts.map +1 -0
- package/dist/types/policy.js +3 -0
- package/dist/types/policy.js.map +1 -0
- package/package.json +29 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PolicyContext, PolicyEvaluation } from "../types/policy";
|
|
2
|
+
import type { PolicyRule } from "../rules/base-rule";
|
|
3
|
+
export declare class PolicyEngine {
|
|
4
|
+
private rules;
|
|
5
|
+
constructor(rules?: PolicyRule[]);
|
|
6
|
+
evaluate(context: PolicyContext): Promise<PolicyEvaluation>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=policy-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy-engine.d.ts","sourceRoot":"","sources":["../../src/engine/policy-engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAe;gBAEhB,KAAK,GAAE,UAAU,EAAO;IAI9B,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAiBlE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PolicyEngine = void 0;
|
|
4
|
+
class PolicyEngine {
|
|
5
|
+
rules;
|
|
6
|
+
constructor(rules = []) {
|
|
7
|
+
this.rules = rules;
|
|
8
|
+
}
|
|
9
|
+
async evaluate(context) {
|
|
10
|
+
for (const rule of this.rules) {
|
|
11
|
+
const result = rule.evaluate(context);
|
|
12
|
+
if (result) {
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
decision: "ALLOW",
|
|
18
|
+
reason: "No policy violation detected",
|
|
19
|
+
riskScore: 0,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.PolicyEngine = PolicyEngine;
|
|
24
|
+
//# sourceMappingURL=policy-engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy-engine.js","sourceRoot":"","sources":["../../src/engine/policy-engine.ts"],"names":[],"mappings":";;;AAIA,MAAa,YAAY;IACf,KAAK,CAAe;IAE5B,YAAY,QAAsB,EAAE;QAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAsB;QACnC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAEtC,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,MAAM,CAAC;YAChB,CAAC;QACH,CAAC;QAED,OAAO;YACL,QAAQ,EAAE,OAAO;YAEjB,MAAM,EAAE,8BAA8B;YAEtC,SAAS,EAAE,CAAC;SACb,CAAC;IACJ,CAAC;CACF;AAxBD,oCAwBC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PolicyEngine = void 0;
|
|
4
|
+
var policy_engine_1 = require("./engine/policy-engine");
|
|
5
|
+
Object.defineProperty(exports, "PolicyEngine", { enumerable: true, get: function () { return policy_engine_1.PolicyEngine; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,wDAAsD;AAA7C,6GAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-rule.d.ts","sourceRoot":"","sources":["../../src/rules/base-rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IAEb,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,gBAAgB,GAAG,IAAI,CAAC;CAC3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-rule.js","sourceRoot":"","sources":["../../src/rules/base-rule.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SecurityDecision } from "@aegisora/core";
|
|
2
|
+
export interface PolicyContext {
|
|
3
|
+
agentId: string;
|
|
4
|
+
action: string;
|
|
5
|
+
input?: unknown;
|
|
6
|
+
}
|
|
7
|
+
export interface PolicyEvaluation {
|
|
8
|
+
decision: SecurityDecision;
|
|
9
|
+
reason: string;
|
|
10
|
+
riskScore: number;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/types/policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAEhB,MAAM,EAAE,MAAM,CAAC;IAEf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,gBAAgB,CAAC;IAE3B,MAAM,EAAE,MAAM,CAAC;IAEf,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/types/policy.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aegisora/policy-engine",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Policy evaluation engine for Aegisora AI governance runtime.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"typecheck": "tsc --noEmit"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@aegisora/core": "workspace:*"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"typescript": "^5"
|
|
17
|
+
},
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"require": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
]
|
|
29
|
+
}
|