apcore-js 0.25.0 → 0.26.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/builtin-steps.d.ts +43 -3
- package/dist/builtin-steps.d.ts.map +1 -1
- package/dist/builtin-steps.js +172 -29
- package/dist/builtin-steps.js.map +1 -1
- package/dist/client.d.ts +8 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -1
- package/dist/executor.d.ts +13 -1
- package/dist/executor.d.ts.map +1 -1
- package/dist/executor.js +32 -3
- package/dist/executor.js.map +1 -1
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/policy.d.ts +144 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +242 -0
- package/dist/policy.js.map +1 -0
- package/package.json +1 -1
package/dist/policy.js
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution-time governance policy: external overrides for governance annotations.
|
|
3
|
+
*
|
|
4
|
+
* RFC pilot for apcore#76 ("first-class external governance / policy API").
|
|
5
|
+
* An {@link ExecutionPolicy} lets a platform operator override the governance
|
|
6
|
+
* annotations (`requiresApproval`, `destructive`) of already-registered modules
|
|
7
|
+
* at execution time, independent of how the modules were registered. It attaches
|
|
8
|
+
* to the {@link Executor} (`policy` option) and is consulted by the approval
|
|
9
|
+
* gate (Step 5).
|
|
10
|
+
*
|
|
11
|
+
* Precedence: a matched policy rule overrides the module's own declared or
|
|
12
|
+
* scanned annotations — external governance is the platform's word against the
|
|
13
|
+
* module author's. Matching uses the same wildcard semantics as the ACL system
|
|
14
|
+
* (Algorithm A08) and the same specificity scoring (Algorithm A10); on a
|
|
15
|
+
* specificity tie the more restrictive rule wins.
|
|
16
|
+
*
|
|
17
|
+
* Governance principle (apcore#76): a misconfigured or unreachable governance
|
|
18
|
+
* control must warn or error, never silently allow. {@link ExecutionPolicy.fromObject}
|
|
19
|
+
* therefore rejects unknown keys (a typo in a governance file must not silently
|
|
20
|
+
* no-op), and `strict=true` makes the approval gate fail closed when approval is
|
|
21
|
+
* required but no ApprovalHandler is configured.
|
|
22
|
+
*/
|
|
23
|
+
import { calculateSpecificity, matchPattern } from './utils/pattern.js';
|
|
24
|
+
const POLICY_KEYS = new Set(['rules', 'gate_destructive', 'strict']);
|
|
25
|
+
const RULE_KEYS = new Set(['pattern', 'requires_approval', 'destructive', 'reason']);
|
|
26
|
+
/**
|
|
27
|
+
* A single pattern-based governance override (apcore#76 RFC pilot).
|
|
28
|
+
*
|
|
29
|
+
* Immutable; validates its fields eagerly so a malformed governance rule fails
|
|
30
|
+
* loud at construction rather than silently no-op'ing at execution time.
|
|
31
|
+
*/
|
|
32
|
+
export class PolicyRule {
|
|
33
|
+
/**
|
|
34
|
+
* Module ID wildcard pattern (Algorithm A08 semantics, same as ACL rules).
|
|
35
|
+
* `*` matches any character sequence including dots.
|
|
36
|
+
*/
|
|
37
|
+
pattern;
|
|
38
|
+
requiresApproval;
|
|
39
|
+
destructive;
|
|
40
|
+
reason;
|
|
41
|
+
constructor(pattern, overrides = {}) {
|
|
42
|
+
if (typeof pattern !== 'string' || pattern.length === 0) {
|
|
43
|
+
throw new Error('PolicyRule.pattern must be a non-empty string');
|
|
44
|
+
}
|
|
45
|
+
const requiresApproval = overrides.requiresApproval ?? null;
|
|
46
|
+
const destructive = overrides.destructive ?? null;
|
|
47
|
+
const reason = overrides.reason ?? null;
|
|
48
|
+
for (const [name, value] of [
|
|
49
|
+
['requiresApproval', requiresApproval],
|
|
50
|
+
['destructive', destructive],
|
|
51
|
+
]) {
|
|
52
|
+
if (value !== null && typeof value !== 'boolean') {
|
|
53
|
+
throw new Error(`PolicyRule.${name} must be a boolean or null, got ${typeof value}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (reason !== null && typeof reason !== 'string') {
|
|
57
|
+
throw new Error(`PolicyRule.reason must be a string or null, got ${typeof reason}`);
|
|
58
|
+
}
|
|
59
|
+
this.pattern = pattern;
|
|
60
|
+
this.requiresApproval = requiresApproval;
|
|
61
|
+
this.destructive = destructive;
|
|
62
|
+
this.reason = reason;
|
|
63
|
+
Object.freeze(this);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** Read a boolean annotation from a ModuleAnnotations object or a dict. */
|
|
67
|
+
function readAnnotationBool(annotations, camelKey, snakeKey) {
|
|
68
|
+
if (annotations == null || typeof annotations !== 'object')
|
|
69
|
+
return false;
|
|
70
|
+
const obj = annotations;
|
|
71
|
+
if (camelKey in obj)
|
|
72
|
+
return Boolean(obj[camelKey]);
|
|
73
|
+
if (snakeKey in obj)
|
|
74
|
+
return Boolean(obj[snakeKey]);
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
/** Tie-break key: rules that force gating rank above rules that relax it. */
|
|
78
|
+
function restrictiveness(rule) {
|
|
79
|
+
// (requiresApproval === true) outranks (destructive === true); encode as a
|
|
80
|
+
// 2-bit score so a lexicographic tuple comparison collapses to `>`.
|
|
81
|
+
return (rule.requiresApproval === true ? 2 : 0) + (rule.destructive === true ? 1 : 0);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Declarative execution-time governance overrides (apcore#76 RFC pilot).
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* const policy = new ExecutionPolicy(
|
|
89
|
+
* [new PolicyRule('orders.delete_*', { requiresApproval: true, reason: 'human sign-off' })],
|
|
90
|
+
* { gateDestructive: true, strict: true },
|
|
91
|
+
* );
|
|
92
|
+
* const executor = new Executor({ registry, approvalHandler: handler, policy });
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export class ExecutionPolicy {
|
|
96
|
+
_rules;
|
|
97
|
+
/**
|
|
98
|
+
* When true, modules whose effective `destructive` annotation is true require
|
|
99
|
+
* approval even if `requiresApproval` is false — the opt-in resolution of the
|
|
100
|
+
* destructive↔approval gap described in apcore#76.
|
|
101
|
+
*/
|
|
102
|
+
gateDestructive;
|
|
103
|
+
/**
|
|
104
|
+
* When true, the approval gate fails closed (denies) when a module needs
|
|
105
|
+
* approval but no ApprovalHandler is configured. When false (default), the
|
|
106
|
+
* gate keeps the PROTOCOL_SPEC §7.4 skip behavior but logs a warning.
|
|
107
|
+
*/
|
|
108
|
+
strict;
|
|
109
|
+
constructor(rules = null, options = {}) {
|
|
110
|
+
const frozen = Object.freeze([...(rules ?? [])]);
|
|
111
|
+
for (const rule of frozen) {
|
|
112
|
+
if (!(rule instanceof PolicyRule)) {
|
|
113
|
+
throw new Error(`ExecutionPolicy rules must be PolicyRule instances, got ${typeof rule}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
this._rules = frozen;
|
|
117
|
+
this.gateDestructive = Boolean(options.gateDestructive);
|
|
118
|
+
this.strict = Boolean(options.strict);
|
|
119
|
+
}
|
|
120
|
+
/** The policy's rules as an immutable array. */
|
|
121
|
+
get rules() {
|
|
122
|
+
return this._rules;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Compute the effective governance decision for a module.
|
|
126
|
+
*
|
|
127
|
+
* @param moduleId - Canonical module ID being invoked.
|
|
128
|
+
* @param annotations - The module's annotations (ModuleAnnotations, dict, or
|
|
129
|
+
* null). Only `requiresApproval`/`requires_approval` and `destructive` are
|
|
130
|
+
* consulted.
|
|
131
|
+
*/
|
|
132
|
+
resolve(moduleId, annotations = null) {
|
|
133
|
+
const baseRequiresApproval = readAnnotationBool(annotations, 'requiresApproval', 'requires_approval');
|
|
134
|
+
const baseDestructive = readAnnotationBool(annotations, 'destructive', 'destructive');
|
|
135
|
+
const rule = this._match(moduleId);
|
|
136
|
+
const effectiveRequiresApproval = rule === null || rule.requiresApproval === null
|
|
137
|
+
? baseRequiresApproval
|
|
138
|
+
: rule.requiresApproval;
|
|
139
|
+
const effectiveDestructive = rule === null || rule.destructive === null ? baseDestructive : rule.destructive;
|
|
140
|
+
return {
|
|
141
|
+
moduleId,
|
|
142
|
+
requiresApproval: effectiveRequiresApproval,
|
|
143
|
+
destructive: effectiveDestructive,
|
|
144
|
+
needsApproval: effectiveRequiresApproval || (this.gateDestructive && effectiveDestructive),
|
|
145
|
+
rule,
|
|
146
|
+
overridden: effectiveRequiresApproval !== baseRequiresApproval ||
|
|
147
|
+
effectiveDestructive !== baseDestructive,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/** Return the winning rule for a module ID, or null. */
|
|
151
|
+
_match(moduleId) {
|
|
152
|
+
let best = null;
|
|
153
|
+
let bestScore = -1;
|
|
154
|
+
for (const rule of this._rules) {
|
|
155
|
+
if (!matchPattern(rule.pattern, moduleId))
|
|
156
|
+
continue;
|
|
157
|
+
const score = calculateSpecificity(rule.pattern);
|
|
158
|
+
if (score > bestScore) {
|
|
159
|
+
best = rule;
|
|
160
|
+
bestScore = score;
|
|
161
|
+
}
|
|
162
|
+
else if (score === bestScore &&
|
|
163
|
+
best !== null &&
|
|
164
|
+
restrictiveness(rule) > restrictiveness(best)) {
|
|
165
|
+
best = rule;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return best;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Build a policy from a plain object (parsed YAML/JSON governance file).
|
|
172
|
+
*
|
|
173
|
+
* Parsing is strict: unknown keys throw so a typo in a governance file fails
|
|
174
|
+
* loud instead of silently disabling a control.
|
|
175
|
+
*
|
|
176
|
+
* Expected shape:
|
|
177
|
+
* ```yaml
|
|
178
|
+
* gate_destructive: true
|
|
179
|
+
* strict: true
|
|
180
|
+
* rules:
|
|
181
|
+
* - pattern: "orders.delete_*"
|
|
182
|
+
* requires_approval: true
|
|
183
|
+
* reason: "destructive order operations need human sign-off"
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* @throws {Error} On unknown keys, missing `pattern`, or wrong types.
|
|
187
|
+
*/
|
|
188
|
+
static fromObject(data) {
|
|
189
|
+
if (data == null || typeof data !== 'object' || Array.isArray(data)) {
|
|
190
|
+
const kind = Array.isArray(data) ? 'array' : typeof data;
|
|
191
|
+
throw new Error(`Policy document must be a mapping, got ${kind}`);
|
|
192
|
+
}
|
|
193
|
+
const obj = data;
|
|
194
|
+
const unknown = Object.keys(obj).filter((k) => !POLICY_KEYS.has(k));
|
|
195
|
+
if (unknown.length > 0) {
|
|
196
|
+
throw new Error(`Unknown policy keys ${JSON.stringify(unknown.sort())}; a governance file must not silently no-op`);
|
|
197
|
+
}
|
|
198
|
+
const rulesRaw = obj['rules'] ?? [];
|
|
199
|
+
if (!Array.isArray(rulesRaw)) {
|
|
200
|
+
throw new Error(`Policy 'rules' must be a list, got ${typeof rulesRaw}`);
|
|
201
|
+
}
|
|
202
|
+
const rules = [];
|
|
203
|
+
rulesRaw.forEach((item, index) => {
|
|
204
|
+
if (item == null || typeof item !== 'object' || Array.isArray(item)) {
|
|
205
|
+
const kind = Array.isArray(item) ? 'array' : typeof item;
|
|
206
|
+
throw new Error(`Policy rule #${index} must be a mapping, got ${kind}`);
|
|
207
|
+
}
|
|
208
|
+
const ruleObj = item;
|
|
209
|
+
const unknownRule = Object.keys(ruleObj).filter((k) => !RULE_KEYS.has(k));
|
|
210
|
+
if (unknownRule.length > 0) {
|
|
211
|
+
throw new Error(`Policy rule #${index} has unknown keys ${JSON.stringify(unknownRule.sort())}; ` +
|
|
212
|
+
'a governance rule must not silently no-op');
|
|
213
|
+
}
|
|
214
|
+
if (!('pattern' in ruleObj)) {
|
|
215
|
+
throw new Error(`Policy rule #${index} is missing required key 'pattern'`);
|
|
216
|
+
}
|
|
217
|
+
rules.push(new PolicyRule(ruleObj['pattern'], {
|
|
218
|
+
requiresApproval: (ruleObj['requires_approval'] ?? null),
|
|
219
|
+
destructive: (ruleObj['destructive'] ?? null),
|
|
220
|
+
reason: (ruleObj['reason'] ?? null),
|
|
221
|
+
}));
|
|
222
|
+
});
|
|
223
|
+
return new ExecutionPolicy(rules, {
|
|
224
|
+
gateDestructive: Boolean(obj['gate_destructive'] ?? false),
|
|
225
|
+
strict: Boolean(obj['strict'] ?? false),
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Build effective ModuleAnnotations for an ApprovalRequest under a policy
|
|
231
|
+
* decision, preserving the PROTOCOL_SPEC §7 "requiresApproval is guaranteed
|
|
232
|
+
* true" contract: the handler sees the effective governance values, not the
|
|
233
|
+
* module's raw declaration.
|
|
234
|
+
*/
|
|
235
|
+
export function applyDecisionToAnnotations(annotations, decision) {
|
|
236
|
+
return Object.freeze({
|
|
237
|
+
...annotations,
|
|
238
|
+
requiresApproval: true,
|
|
239
|
+
destructive: decision.destructive,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAExE,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,CAAC,CAAC,CAAC;AACrE,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,mBAAmB,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;AAkBrF;;;;;GAKG;AACH,MAAM,OAAO,UAAU;IACrB;;;OAGG;IACM,OAAO,CAAS;IAChB,gBAAgB,CAAiB;IACjC,WAAW,CAAiB;IAC5B,MAAM,CAAgB;IAE/B,YAAY,OAAe,EAAE,YAAiC,EAAE;QAC9D,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,MA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