@corenel/harness 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/compression.d.ts +11 -0
- package/dist/compression.d.ts.map +1 -0
- package/dist/compression.js +27 -0
- package/dist/compression.js.map +1 -0
- package/dist/conversation.d.ts +29 -0
- package/dist/conversation.d.ts.map +1 -0
- package/dist/conversation.js +25 -0
- package/dist/conversation.js.map +1 -0
- package/dist/core/loop.d.ts +31 -0
- package/dist/core/loop.d.ts.map +1 -0
- package/dist/core/loop.js +237 -0
- package/dist/core/loop.js.map +1 -0
- package/dist/dag/executeNode.d.ts +41 -0
- package/dist/dag/executeNode.d.ts.map +1 -0
- package/dist/dag/executeNode.js +81 -0
- package/dist/dag/executeNode.js.map +1 -0
- package/dist/fileSchema.d.ts +7 -0
- package/dist/fileSchema.d.ts.map +1 -0
- package/dist/fileSchema.js +40 -0
- package/dist/fileSchema.js.map +1 -0
- package/dist/guardrail/builtins.d.ts +9 -0
- package/dist/guardrail/builtins.d.ts.map +1 -0
- package/dist/guardrail/builtins.js +61 -0
- package/dist/guardrail/builtins.js.map +1 -0
- package/dist/guardrail/glob.d.ts +3 -0
- package/dist/guardrail/glob.d.ts.map +1 -0
- package/dist/guardrail/glob.js +33 -0
- package/dist/guardrail/glob.js.map +1 -0
- package/dist/guardrail/guardrail.d.ts +25 -0
- package/dist/guardrail/guardrail.d.ts.map +1 -0
- package/dist/guardrail/guardrail.js +67 -0
- package/dist/guardrail/guardrail.js.map +1 -0
- package/dist/guardrail/index.d.ts +9 -0
- package/dist/guardrail/index.d.ts.map +1 -0
- package/dist/guardrail/index.js +11 -0
- package/dist/guardrail/index.js.map +1 -0
- package/dist/guardrail/permission-service.d.ts +53 -0
- package/dist/guardrail/permission-service.d.ts.map +1 -0
- package/dist/guardrail/permission-service.js +147 -0
- package/dist/guardrail/permission-service.js.map +1 -0
- package/dist/guardrail/serialize.d.ts +9 -0
- package/dist/guardrail/serialize.d.ts.map +1 -0
- package/dist/guardrail/serialize.js +53 -0
- package/dist/guardrail/serialize.js.map +1 -0
- package/dist/guardrail/store.d.ts +26 -0
- package/dist/guardrail/store.d.ts.map +1 -0
- package/dist/guardrail/store.js +109 -0
- package/dist/guardrail/store.js.map +1 -0
- package/dist/guardrail/validate.d.ts +8 -0
- package/dist/guardrail/validate.d.ts.map +1 -0
- package/dist/guardrail/validate.js +105 -0
- package/dist/guardrail/validate.js.map +1 -0
- package/dist/guards.d.ts +37 -0
- package/dist/guards.d.ts.map +1 -0
- package/dist/guards.js +45 -0
- package/dist/guards.js.map +1 -0
- package/dist/log.d.ts +4 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +22 -0
- package/dist/log.js.map +1 -0
- package/dist/promptCompiler.d.ts +18 -0
- package/dist/promptCompiler.d.ts.map +1 -0
- package/dist/promptCompiler.js +11 -0
- package/dist/promptCompiler.js.map +1 -0
- package/dist/prompts/config.d.ts +63 -0
- package/dist/prompts/config.d.ts.map +1 -0
- package/dist/prompts/config.js +268 -0
- package/dist/prompts/config.js.map +1 -0
- package/dist/prompts/host.d.ts +30 -0
- package/dist/prompts/host.d.ts.map +1 -0
- package/dist/prompts/host.js +11 -0
- package/dist/prompts/host.js.map +1 -0
- package/dist/prompts/index.d.ts +50 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +105 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/library/defaults.generated.d.ts +2 -0
- package/dist/prompts/library/defaults.generated.d.ts.map +1 -0
- package/dist/prompts/library/defaults.generated.js +31 -0
- package/dist/prompts/library/defaults.generated.js.map +1 -0
- package/dist/prompts/library/index.d.ts +8 -0
- package/dist/prompts/library/index.d.ts.map +1 -0
- package/dist/prompts/library/index.js +28 -0
- package/dist/prompts/library/index.js.map +1 -0
- package/dist/providers/gateway.d.ts +58 -0
- package/dist/providers/gateway.d.ts.map +1 -0
- package/dist/providers/gateway.js +145 -0
- package/dist/providers/gateway.js.map +1 -0
- package/dist/services.d.ts +29 -0
- package/dist/services.d.ts.map +1 -0
- package/dist/services.js +22 -0
- package/dist/services.js.map +1 -0
- package/dist/sidecar/host.d.ts +69 -0
- package/dist/sidecar/host.d.ts.map +1 -0
- package/dist/sidecar/host.js +228 -0
- package/dist/sidecar/host.js.map +1 -0
- package/dist/sidecar/server.d.ts +42 -0
- package/dist/sidecar/server.d.ts.map +1 -0
- package/dist/sidecar/server.js +267 -0
- package/dist/sidecar/server.js.map +1 -0
- package/dist/skills.d.ts +39 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +216 -0
- package/dist/skills.js.map +1 -0
- package/dist/systemParts.d.ts +10 -0
- package/dist/systemParts.d.ts.map +1 -0
- package/dist/systemParts.js +21 -0
- package/dist/systemParts.js.map +1 -0
- package/dist/todos.d.ts +34 -0
- package/dist/todos.d.ts.map +1 -0
- package/dist/todos.js +112 -0
- package/dist/todos.js.map +1 -0
- package/dist/tools/builtins.d.ts +20 -0
- package/dist/tools/builtins.d.ts.map +1 -0
- package/dist/tools/builtins.js +335 -0
- package/dist/tools/builtins.js.map +1 -0
- package/dist/tools/files.d.ts +11 -0
- package/dist/tools/files.d.ts.map +1 -0
- package/dist/tools/files.js +161 -0
- package/dist/tools/files.js.map +1 -0
- package/dist/tools/http.d.ts +3 -0
- package/dist/tools/http.d.ts.map +1 -0
- package/dist/tools/http.js +71 -0
- package/dist/tools/http.js.map +1 -0
- package/dist/tools/namespaces.d.ts +27 -0
- package/dist/tools/namespaces.d.ts.map +1 -0
- package/dist/tools/namespaces.js +83 -0
- package/dist/tools/namespaces.js.map +1 -0
- package/dist/tools/registry.d.ts +8 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +14 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/sessions.d.ts +3 -0
- package/dist/tools/sessions.d.ts.map +1 -0
- package/dist/tools/sessions.js +149 -0
- package/dist/tools/sessions.js.map +1 -0
- package/dist/tools/todo.d.ts +3 -0
- package/dist/tools/todo.d.ts.map +1 -0
- package/dist/tools/todo.js +38 -0
- package/dist/tools/todo.js.map +1 -0
- package/dist/tools/urlGuard.d.ts +9 -0
- package/dist/tools/urlGuard.d.ts.map +1 -0
- package/dist/tools/urlGuard.js +80 -0
- package/dist/tools/urlGuard.js.map +1 -0
- package/dist/tools/web.d.ts +3 -0
- package/dist/tools/web.d.ts.map +1 -0
- package/dist/tools/web.js +35 -0
- package/dist/tools/web.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** Default: read freely, ask before any side effect (file/memory writes). */
|
|
2
|
+
export const STANDARD_POLICY = {
|
|
3
|
+
version: 1,
|
|
4
|
+
name: 'standard',
|
|
5
|
+
description: 'Read-only tools run automatically; writes ask for approval.',
|
|
6
|
+
onViolation: 'stop',
|
|
7
|
+
maxTurns: 8,
|
|
8
|
+
permissions: {
|
|
9
|
+
'prompd:propose_edit': 'allow', // proposals are reviewed in the diff UI, not applied directly
|
|
10
|
+
'system:*': 'deny', // harness self-configuration is never automatic
|
|
11
|
+
},
|
|
12
|
+
// defaultPermission omitted -> the mutates heuristic (reads allow, writes ask)
|
|
13
|
+
};
|
|
14
|
+
/** Strict: no side effects at all. Mutating tools are denied outright. */
|
|
15
|
+
export const READ_ONLY_POLICY = {
|
|
16
|
+
version: 1,
|
|
17
|
+
name: 'read-only',
|
|
18
|
+
description: 'Inspection only — all writes and side effects are refused.',
|
|
19
|
+
onViolation: 'stop',
|
|
20
|
+
maxTurns: 8,
|
|
21
|
+
tools: {
|
|
22
|
+
deny: [
|
|
23
|
+
'fs:write_file', 'fs:create_file', 'fs:delete_file', 'fs:rename_file',
|
|
24
|
+
// Sidecar fs write tools address as fs:fs_write_file etc.; cover them and any
|
|
25
|
+
// future fs mutator with the namespace glob (reads address fs:read_file, but
|
|
26
|
+
// mutating fs tools are caught here AND by mutatingDefault below).
|
|
27
|
+
'fs:fs_write_file',
|
|
28
|
+
// Shell execution (sidecar shell_exec, address shell:shell_exec) is a side
|
|
29
|
+
// effect — denied outright under read-only, regardless of its own permission.
|
|
30
|
+
'shell:*',
|
|
31
|
+
'memory:save_memory', 'memory:kv_set',
|
|
32
|
+
'system:*',
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
permissions: {
|
|
36
|
+
'fs:write_file': 'deny', 'fs:create_file': 'deny', 'fs:delete_file': 'deny', 'fs:rename_file': 'deny',
|
|
37
|
+
'memory:save_memory': 'deny', 'memory:kv_set': 'deny',
|
|
38
|
+
'system:*': 'deny',
|
|
39
|
+
},
|
|
40
|
+
// Backstop: any other mutating tool (a dynamic MCP/skill write the deny list
|
|
41
|
+
// can't name) is refused too, while unknown read-only tools still run.
|
|
42
|
+
mutatingDefault: 'deny',
|
|
43
|
+
};
|
|
44
|
+
/** Unattended: everything runs without prompting, except harness self-config. */
|
|
45
|
+
export const AUTONOMOUS_POLICY = {
|
|
46
|
+
version: 1,
|
|
47
|
+
name: 'autonomous',
|
|
48
|
+
description: 'Everything runs automatically — no approval prompts (system config still asks).',
|
|
49
|
+
onViolation: 'warn',
|
|
50
|
+
maxTurns: 16,
|
|
51
|
+
permissions: {
|
|
52
|
+
'system:*': 'ask', // even unattended, never silently reconfigure the harness
|
|
53
|
+
},
|
|
54
|
+
defaultPermission: 'allow',
|
|
55
|
+
};
|
|
56
|
+
export const BUILTIN_POLICIES = {
|
|
57
|
+
standard: STANDARD_POLICY,
|
|
58
|
+
'read-only': READ_ONLY_POLICY,
|
|
59
|
+
autonomous: AUTONOMOUS_POLICY,
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=builtins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtins.js","sourceRoot":"","sources":["../../guardrail/builtins.ts"],"names":[],"mappings":"AAQA,6EAA6E;AAC7E,MAAM,CAAC,MAAM,eAAe,GAAW;IACrC,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,UAAU;IAChB,WAAW,EAA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BAAgB;IAC7B,UAAU,EAAE,iBAAiB;CAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../guardrail/glob.ts"],"names":[],"mappings":"AAKA,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAoBhD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAE9E"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* Tool-name glob matching — browser-safe port of the Marshal harness matcher.
|
|
2
|
+
* `*` matches within a dot-segment, `**` matches across dots. Our tool names have
|
|
3
|
+
* no dots (compile_prompd, kv_set), so `*` matches a whole name and `kv_*` etc.
|
|
4
|
+
* work as expected. */
|
|
5
|
+
export function globToRegex(glob) {
|
|
6
|
+
let src = '';
|
|
7
|
+
for (let i = 0; i < glob.length; i++) {
|
|
8
|
+
const c = glob[i];
|
|
9
|
+
if (c === '*') {
|
|
10
|
+
if (glob[i + 1] === '*') {
|
|
11
|
+
src += '.*';
|
|
12
|
+
i++;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
src += '[^.]*';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
else if (c === '?') {
|
|
19
|
+
src += '[^.]';
|
|
20
|
+
}
|
|
21
|
+
else if ('.+^$()[]{}|\\'.includes(c)) {
|
|
22
|
+
src += '\\' + c;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
src += c;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return new RegExp(`^${src}$`);
|
|
29
|
+
}
|
|
30
|
+
export function matchesAnyGlob(name, globs) {
|
|
31
|
+
return globs.some((g) => globToRegex(g).test(name));
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=glob.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../guardrail/glob.ts"],"names":[],"mappings":"AAAA;;;uBAGuB;AAEvB,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YACd,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;gBACxB,GAAG,IAAI,IAAI,CAAC;gBACZ,CAAC,EAAE,CAAC;YACN,CAAC;iBAAM,CAAC;gBACN,GAAG,IAAI,OAAO,CAAC;YACjB,CAAC;QACH,CAAC;aAAM,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YACrB,GAAG,IAAI,MAAM,CAAC;QAChB,CAAC;aAAM,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;YACvC,GAAG,IAAI,IAAI,GAAG,CAAC,CAAC;QAClB,CAAC;aAAM,CAAC;YACN,GAAG,IAAI,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IACD,OAAO,IAAI,MAAM,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,KAAwB;IACnE,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Policy, Violation, GuardrailDecision } from '@corenel/protocol';
|
|
2
|
+
export interface GuardrailState {
|
|
3
|
+
turn: number;
|
|
4
|
+
toolCalls: number;
|
|
5
|
+
calledTools: Set<string>;
|
|
6
|
+
}
|
|
7
|
+
export interface ToolCallSubject {
|
|
8
|
+
name: string;
|
|
9
|
+
exists: boolean;
|
|
10
|
+
/** Policy address (`namespace:name`) so allow/deny globs may target a whole
|
|
11
|
+
* namespace (`fs:*`). Falls back to bare-name matching when absent. */
|
|
12
|
+
address?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function initialState(): GuardrailState;
|
|
15
|
+
/** Turn-budget check, evaluated at the start of each turn. */
|
|
16
|
+
export declare function evaluateTurnStart(policy: Policy, state: GuardrailState): GuardrailDecision;
|
|
17
|
+
/**
|
|
18
|
+
* Tool-call gate. Order: exists -> deny -> allow-list -> tool-call budget.
|
|
19
|
+
* `deny` always blocks and beats `allow`. With an `allow` list present, any tool
|
|
20
|
+
* not matching it is blocked.
|
|
21
|
+
*/
|
|
22
|
+
export declare function evaluateToolCall(policy: Policy, state: GuardrailState, call: ToolCallSubject): GuardrailDecision;
|
|
23
|
+
/** Completion check: every `mustCall` tool must have been invoked. Always stop. */
|
|
24
|
+
export declare function evaluateCompletion(policy: Policy, state: GuardrailState): Violation[];
|
|
25
|
+
//# sourceMappingURL=guardrail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guardrail.d.ts","sourceRoot":"","sources":["../../guardrail/guardrail.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAkC,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE9G,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB;2EACuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AASD,wBAAgB,YAAY,IAAI,cAAc,CAE7C;AAgBD,8DAA8D;AAC9D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,iBAAiB,CAK1F;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,cAAc,EACrB,IAAI,EAAE,eAAe,GACpB,iBAAiB,CAkBnB;AAED,mFAAmF;AACnF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,SAAS,EAAE,CAKrF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* Guardrail evaluator — the hard gates. Pure functions over a small mutable
|
|
2
|
+
* state object the loop threads through a run. Adapted from the Marshal harness
|
|
3
|
+
* (filesystem/cwd/phase rules dropped; this harness has no disk or shell). */
|
|
4
|
+
import { matchesAnyGlob } from './glob';
|
|
5
|
+
/** Match a glob list against a tool's address (if any) and its bare name. */
|
|
6
|
+
function callMatches(call, globs) {
|
|
7
|
+
if (!globs.length)
|
|
8
|
+
return false;
|
|
9
|
+
if (call.address && matchesAnyGlob(call.address, globs))
|
|
10
|
+
return true;
|
|
11
|
+
return matchesAnyGlob(call.name, globs);
|
|
12
|
+
}
|
|
13
|
+
export function initialState() {
|
|
14
|
+
return { turn: 0, toolCalls: 0, calledTools: new Set() };
|
|
15
|
+
}
|
|
16
|
+
function onViolation(policy) {
|
|
17
|
+
return policy.onViolation ?? 'stop';
|
|
18
|
+
}
|
|
19
|
+
function violate(kind, message, action, tool) {
|
|
20
|
+
const violation = tool ? { kind, message, tool } : { kind, message };
|
|
21
|
+
return { ok: false, violation, action };
|
|
22
|
+
}
|
|
23
|
+
/** Turn-budget check, evaluated at the start of each turn. */
|
|
24
|
+
export function evaluateTurnStart(policy, state) {
|
|
25
|
+
if (policy.maxTurns !== undefined && state.turn >= policy.maxTurns) {
|
|
26
|
+
return violate('MAX_TURNS', `Exceeded maxTurns=${policy.maxTurns}`, onViolation(policy));
|
|
27
|
+
}
|
|
28
|
+
return { ok: true };
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Tool-call gate. Order: exists -> deny -> allow-list -> tool-call budget.
|
|
32
|
+
* `deny` always blocks and beats `allow`. With an `allow` list present, any tool
|
|
33
|
+
* not matching it is blocked.
|
|
34
|
+
*/
|
|
35
|
+
export function evaluateToolCall(policy, state, call) {
|
|
36
|
+
if (!call.exists) {
|
|
37
|
+
return violate('UNKNOWN_TOOL', `Model invoked unknown tool: ${call.name}`, 'stop', call.name);
|
|
38
|
+
}
|
|
39
|
+
const allow = policy.tools?.allow ?? [];
|
|
40
|
+
const deny = policy.tools?.deny ?? [];
|
|
41
|
+
if (deny.length && callMatches(call, deny)) {
|
|
42
|
+
return violate('TOOL_DENIED', `Tool denied by policy: ${call.name}`, onViolation(policy), call.name);
|
|
43
|
+
}
|
|
44
|
+
if (allow.length && !callMatches(call, allow)) {
|
|
45
|
+
return violate('TOOL_NOT_ALLOWED', `Tool not in allow list: ${call.name}`, onViolation(policy), call.name);
|
|
46
|
+
}
|
|
47
|
+
if (policy.maxToolCalls !== undefined && state.toolCalls + 1 > policy.maxToolCalls) {
|
|
48
|
+
return violate('MAX_TOOL_CALLS', `Exceeded maxToolCalls=${policy.maxToolCalls}`, onViolation(policy), call.name);
|
|
49
|
+
}
|
|
50
|
+
return { ok: true };
|
|
51
|
+
}
|
|
52
|
+
/** Completion check: every `mustCall` tool must have been invoked. Always stop. */
|
|
53
|
+
export function evaluateCompletion(policy, state) {
|
|
54
|
+
const mustCall = policy.mustCall ?? [];
|
|
55
|
+
const missing = mustCall.filter((name) => !matchesAnyGlob2(name, state.calledTools));
|
|
56
|
+
if (!missing.length)
|
|
57
|
+
return [];
|
|
58
|
+
return [{ kind: 'MUST_CALL_MISSING', message: `Required tools were not invoked: ${missing.join(', ')}` }];
|
|
59
|
+
}
|
|
60
|
+
/** mustCall entries may be globs; a called tool satisfies it if it matches. */
|
|
61
|
+
function matchesAnyGlob2(globOrName, called) {
|
|
62
|
+
for (const name of called)
|
|
63
|
+
if (matchesAnyGlob(name, [globOrName]))
|
|
64
|
+
return true;
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=guardrail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guardrail.js","sourceRoot":"","sources":["../../guardrail/guardrail.ts"],"names":[],"mappings":"AAAA;;8EAE8E;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAiBxC,6EAA6E;AAC7E,SAAS,WAAW,CAAC,IAAqB,EAAE,KAAwB;IAClE,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAChC,IAAI,IAAI,CAAC,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACrE,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;AAC3D,CAAC;AAED,SAAS,WAAW,CAAC,MAAc;IACjC,OAAO,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC;AACtC,CAAC;AAED,SAAS,OAAO,CACd,IAAmB,EACnB,OAAe,EACf,MAAuB,EACvB,IAAa;IAEb,MAAM,SAAS,GAAc,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAChF,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AAC1C,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,iBAAiB,CAAC,MAAc,EAAE,KAAqB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,CAAC,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;QACnF,OAAO,OAAO,CAAC,gBAAgB,EAAE,yBAAyB,MAAM,CAAC,YAAY,EAAE,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACnH,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,kBAAkB,CAAC,MAAc,EAAE,KAAqB;IACtE,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC;IACvC,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IACrF,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,oCAAoC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;AAC5G,CAAC;AAED,+EAA+E;AAC/E,SAAS,eAAe,CAAC,UAAkB,EAAE,MAAmB;IAC9D,KAAK,MAAM,IAAI,IAAI,MAAM;QAAE,IAAI,cAAc,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;IAC/E,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from '@corenel/protocol';
|
|
2
|
+
export { matchesAnyGlob, globToRegex } from './glob';
|
|
3
|
+
export { initialState, evaluateTurnStart, evaluateToolCall, evaluateCompletion, type GuardrailState, type ToolCallSubject, } from './guardrail';
|
|
4
|
+
export { PermissionService, mostRestrictive, type PermissionSubject, type PermissionPrompt, type PermissionServiceOptions, } from './permission-service';
|
|
5
|
+
export { STANDARD_POLICY, READ_ONLY_POLICY, AUTONOMOUS_POLICY, BUILTIN_POLICIES } from './builtins';
|
|
6
|
+
export { validatePolicy, type PolicyValidationResult } from './validate';
|
|
7
|
+
export { policyToYaml, policyFromYaml } from './serialize';
|
|
8
|
+
export { listPolicies, getPolicy, isBuiltinPolicy, saveCustomPolicy, deleteCustomPolicy, getSelectedPolicyName, setSelectedPolicyName, resolveSelectedPolicy, type PolicyEntry, type PolicySaveResult, } from './store';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../guardrail/index.ts"],"names":[],"mappings":"AAEA,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,GAC9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACpG,OAAO,EAAE,cAAc,EAAE,KAAK,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,YAAY,EACZ,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,KAAK,WAAW,EAChB,KAAK,gBAAgB,GACtB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* Policy module barrel. The harness's baked-in governance layer:
|
|
2
|
+
* guardrail (hard gates) + permission service (per-tool oversight) + built-ins. */
|
|
3
|
+
export * from '@corenel/protocol';
|
|
4
|
+
export { matchesAnyGlob, globToRegex } from './glob';
|
|
5
|
+
export { initialState, evaluateTurnStart, evaluateToolCall, evaluateCompletion, } from './guardrail';
|
|
6
|
+
export { PermissionService, mostRestrictive, } from './permission-service';
|
|
7
|
+
export { STANDARD_POLICY, READ_ONLY_POLICY, AUTONOMOUS_POLICY, BUILTIN_POLICIES } from './builtins';
|
|
8
|
+
export { validatePolicy } from './validate';
|
|
9
|
+
export { policyToYaml, policyFromYaml } from './serialize';
|
|
10
|
+
export { listPolicies, getPolicy, isBuiltinPolicy, saveCustomPolicy, deleteCustomPolicy, getSelectedPolicyName, setSelectedPolicyName, resolveSelectedPolicy, } from './store';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../guardrail/index.ts"],"names":[],"mappings":"AAAA;mFACmF;AACnF,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,GAGnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,iBAAiB,EACjB,eAAe,GAIhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACpG,OAAO,EAAE,cAAc,EAA+B,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,YAAY,EACZ,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GAGtB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Policy, PermissionLevel, PermissionCeiling, PermissionDecision } from '@corenel/protocol';
|
|
2
|
+
/** Minimal tool shape the resolver needs (a subset of AgentTool). */
|
|
3
|
+
export interface PermissionSubject {
|
|
4
|
+
name: string;
|
|
5
|
+
/** Policy address (`namespace:name`), so `permissions` globs may target a whole
|
|
6
|
+
* namespace (`fs:*`) or one tool. Falls back to bare-name matching when absent. */
|
|
7
|
+
address?: string;
|
|
8
|
+
/** Tool can have side effects (writes/network). Drives the default heuristic. */
|
|
9
|
+
mutates?: boolean;
|
|
10
|
+
/** Tool-declared default level (beats the heuristic, loses to policy). */
|
|
11
|
+
permission?: PermissionLevel;
|
|
12
|
+
}
|
|
13
|
+
export interface PermissionPrompt {
|
|
14
|
+
ask(req: {
|
|
15
|
+
tool: string;
|
|
16
|
+
input: unknown;
|
|
17
|
+
}): Promise<PermissionDecision>;
|
|
18
|
+
}
|
|
19
|
+
export interface PermissionServiceOptions {
|
|
20
|
+
policy: Policy;
|
|
21
|
+
prompt?: PermissionPrompt;
|
|
22
|
+
/** Level for read-only (non-mutating) tools with no explicit rule. Default "auto". */
|
|
23
|
+
defaultForReadOnly?: PermissionLevel;
|
|
24
|
+
/** Level for mutating tools with no explicit rule. Default "ask". */
|
|
25
|
+
defaultForMutating?: PermissionLevel;
|
|
26
|
+
/** Hard upper bound clamped onto every resolution. */
|
|
27
|
+
ceiling?: PermissionCeiling;
|
|
28
|
+
}
|
|
29
|
+
/** The more restrictive of two levels (the ceiling clamp). */
|
|
30
|
+
export declare function mostRestrictive(a: PermissionLevel, b: PermissionLevel): PermissionLevel;
|
|
31
|
+
export declare class PermissionService {
|
|
32
|
+
private readonly policy;
|
|
33
|
+
private readonly prompt?;
|
|
34
|
+
private readonly defaultForReadOnly;
|
|
35
|
+
private readonly defaultForMutating;
|
|
36
|
+
private readonly ceiling?;
|
|
37
|
+
private readonly sessionAllow;
|
|
38
|
+
constructor(opts: PermissionServiceOptions);
|
|
39
|
+
/** Pre-approve a tool-name glob for the rest of the session (an "ask" becomes "allow"). */
|
|
40
|
+
preApprove(toolGlob: string): void;
|
|
41
|
+
reset(): void;
|
|
42
|
+
check(tool: PermissionSubject, input: unknown): Promise<PermissionDecision>;
|
|
43
|
+
/**
|
|
44
|
+
* Resolve the effective level. Base precedence (highest first):
|
|
45
|
+
* policy.permissions glob > tool.permission > mutates heuristic > policy.defaultPermission.
|
|
46
|
+
* Then the ceiling clamps to the more restrictive of base and ceiling.
|
|
47
|
+
*/
|
|
48
|
+
resolveLevel(tool: PermissionSubject): PermissionLevel;
|
|
49
|
+
private resolveBaseLevel;
|
|
50
|
+
private resolveCeilingLevel;
|
|
51
|
+
private decide;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=permission-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission-service.d.ts","sourceRoot":"","sources":["../../guardrail/permission-service.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAExG,qEAAqE;AACrE,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb;uFACmF;IACnF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0EAA0E;IAC1E,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACzE;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,sFAAsF;IACtF,kBAAkB,CAAC,EAAE,eAAe,CAAC;IACrC,qEAAqE;IACrE,kBAAkB,CAAC,EAAE,eAAe,CAAC;IACrC,sDAAsD;IACtD,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B;AAgCD,8DAA8D;AAC9D,wBAAgB,eAAe,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,GAAG,eAAe,CAEvF;AAED,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAkB;IACrD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAkB;IACrD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAoB;IAC7C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqB;gBAEtC,IAAI,EAAE,wBAAwB;IAQ1C,2FAA2F;IAC3F,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAIlC,KAAK,IAAI,IAAI;IAIP,KAAK,CAAC,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAKjF;;;;OAIG;IACH,YAAY,CAAC,IAAI,EAAE,iBAAiB,GAAG,eAAe;IAItD,OAAO,CAAC,gBAAgB;IAaxB,OAAO,CAAC,mBAAmB;YAQb,MAAM;CAQrB"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/* Permission resolution — the per-tool oversight layer.
|
|
2
|
+
*
|
|
3
|
+
* Resolves an effective PermissionLevel for a tool call, then turns it into an
|
|
4
|
+
* allow/deny decision (asking the user when the level is "ask"). Adapted from the
|
|
5
|
+
* Marshal harness; the tool descriptor here is the browser harness's AgentTool
|
|
6
|
+
* shape ({ name, mutates?, permission? }) rather than the Node Tool. */
|
|
7
|
+
import { matchesAnyGlob } from './glob';
|
|
8
|
+
const LEVEL_RANK = { allow: 0, ask: 1, deny: 2 };
|
|
9
|
+
/** Match a glob against a tool's address (if any) and its bare name. */
|
|
10
|
+
function subjectMatches(tool, glob) {
|
|
11
|
+
if (tool.address && matchesAnyGlob(tool.address, [glob]))
|
|
12
|
+
return true;
|
|
13
|
+
return matchesAnyGlob(tool.name, [glob]);
|
|
14
|
+
}
|
|
15
|
+
/** How specific a glob is, for "most specific wins" resolution. An exact target
|
|
16
|
+
* (no `*`) always beats any wildcard; among wildcards, more literal characters
|
|
17
|
+
* wins (`fs:delete_file` > `fs:*` > `*`). */
|
|
18
|
+
function specificity(glob) {
|
|
19
|
+
const literal = glob.replace(/\*/g, '').length;
|
|
20
|
+
return (glob.includes('*') ? 0 : 10000) + literal;
|
|
21
|
+
}
|
|
22
|
+
/** The level of the MOST SPECIFIC glob in `rules` that matches `tool`, or
|
|
23
|
+
* undefined if none match. Order-independent, so a broad wildcard written above
|
|
24
|
+
* a narrow rule can't shadow it. */
|
|
25
|
+
function matchLevel(tool, rules) {
|
|
26
|
+
let best;
|
|
27
|
+
let bestScore = -1;
|
|
28
|
+
for (const [glob, level] of Object.entries(rules)) {
|
|
29
|
+
if (!subjectMatches(tool, glob))
|
|
30
|
+
continue;
|
|
31
|
+
const score = specificity(glob);
|
|
32
|
+
if (score > bestScore) {
|
|
33
|
+
bestScore = score;
|
|
34
|
+
best = level;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return best;
|
|
38
|
+
}
|
|
39
|
+
/** The more restrictive of two levels (the ceiling clamp). */
|
|
40
|
+
export function mostRestrictive(a, b) {
|
|
41
|
+
return LEVEL_RANK[a] >= LEVEL_RANK[b] ? a : b;
|
|
42
|
+
}
|
|
43
|
+
export class PermissionService {
|
|
44
|
+
constructor(opts) {
|
|
45
|
+
Object.defineProperty(this, "policy", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
configurable: true,
|
|
48
|
+
writable: true,
|
|
49
|
+
value: void 0
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(this, "prompt", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
configurable: true,
|
|
54
|
+
writable: true,
|
|
55
|
+
value: void 0
|
|
56
|
+
});
|
|
57
|
+
Object.defineProperty(this, "defaultForReadOnly", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
configurable: true,
|
|
60
|
+
writable: true,
|
|
61
|
+
value: void 0
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(this, "defaultForMutating", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
configurable: true,
|
|
66
|
+
writable: true,
|
|
67
|
+
value: void 0
|
|
68
|
+
});
|
|
69
|
+
Object.defineProperty(this, "ceiling", {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
configurable: true,
|
|
72
|
+
writable: true,
|
|
73
|
+
value: void 0
|
|
74
|
+
});
|
|
75
|
+
Object.defineProperty(this, "sessionAllow", {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
configurable: true,
|
|
78
|
+
writable: true,
|
|
79
|
+
value: new Set()
|
|
80
|
+
});
|
|
81
|
+
this.policy = opts.policy;
|
|
82
|
+
if (opts.prompt)
|
|
83
|
+
this.prompt = opts.prompt;
|
|
84
|
+
this.defaultForReadOnly = opts.defaultForReadOnly ?? 'allow';
|
|
85
|
+
this.defaultForMutating = opts.defaultForMutating ?? 'ask';
|
|
86
|
+
if (opts.ceiling)
|
|
87
|
+
this.ceiling = opts.ceiling;
|
|
88
|
+
}
|
|
89
|
+
/** Pre-approve a tool-name glob for the rest of the session (an "ask" becomes "allow"). */
|
|
90
|
+
preApprove(toolGlob) {
|
|
91
|
+
this.sessionAllow.add(toolGlob);
|
|
92
|
+
}
|
|
93
|
+
reset() {
|
|
94
|
+
this.sessionAllow.clear();
|
|
95
|
+
}
|
|
96
|
+
async check(tool, input) {
|
|
97
|
+
const level = this.resolveLevel(tool);
|
|
98
|
+
return this.decide(level, tool.name, input);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Resolve the effective level. Base precedence (highest first):
|
|
102
|
+
* policy.permissions glob > tool.permission > mutates heuristic > policy.defaultPermission.
|
|
103
|
+
* Then the ceiling clamps to the more restrictive of base and ceiling.
|
|
104
|
+
*/
|
|
105
|
+
resolveLevel(tool) {
|
|
106
|
+
return mostRestrictive(this.resolveBaseLevel(tool), this.resolveCeilingLevel(tool));
|
|
107
|
+
}
|
|
108
|
+
resolveBaseLevel(tool) {
|
|
109
|
+
const matched = this.policy.permissions && matchLevel(tool, this.policy.permissions);
|
|
110
|
+
if (matched)
|
|
111
|
+
return matched;
|
|
112
|
+
// A policy's mutating backstop outranks a tool's own declared default, so a
|
|
113
|
+
// mutating tool can't downgrade a strict policy's "deny side effects" floor to
|
|
114
|
+
// ask/allow via its self-declared `permission` (e.g. shell_exec's permission:'ask').
|
|
115
|
+
if (tool.mutates && this.policy.mutatingDefault)
|
|
116
|
+
return this.policy.mutatingDefault;
|
|
117
|
+
if (tool.permission)
|
|
118
|
+
return tool.permission;
|
|
119
|
+
if (this.policy.defaultPermission)
|
|
120
|
+
return this.policy.defaultPermission;
|
|
121
|
+
if (tool.mutates)
|
|
122
|
+
return this.defaultForMutating;
|
|
123
|
+
return this.defaultForReadOnly;
|
|
124
|
+
}
|
|
125
|
+
resolveCeilingLevel(tool) {
|
|
126
|
+
const c = this.ceiling;
|
|
127
|
+
if (!c)
|
|
128
|
+
return 'allow';
|
|
129
|
+
const matched = c.overrides && matchLevel(tool, c.overrides);
|
|
130
|
+
if (matched)
|
|
131
|
+
return matched;
|
|
132
|
+
return c.defaultLevel ?? 'allow';
|
|
133
|
+
}
|
|
134
|
+
async decide(level, name, input) {
|
|
135
|
+
if (level === 'allow')
|
|
136
|
+
return 'allow';
|
|
137
|
+
if (level === 'deny')
|
|
138
|
+
return 'deny';
|
|
139
|
+
// level === 'ask'
|
|
140
|
+
if (this.sessionAllow.size && matchesAnyGlob(name, [...this.sessionAllow]))
|
|
141
|
+
return 'allow';
|
|
142
|
+
if (!this.prompt)
|
|
143
|
+
return 'deny';
|
|
144
|
+
return this.prompt.ask({ tool: name, input });
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=permission-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permission-service.js","sourceRoot":"","sources":["../../guardrail/permission-service.ts"],"names":[],"mappings":"AAAA;;;;;wEAKwE;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AA8BxC,MAAM,UAAU,GAAoC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AAElF,wEAAwE;AACxE,SAAS,cAAc,CAAC,IAAuB,EAAE,IAAY;IAC3D,IAAI,IAAI,CAAC,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACtE,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED;;6CAE6C;AAC7C,SAAS,WAAW,CAAC,IAAY;IAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC;IAC/C,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;AACpD,CAAC;AAED;;oCAEoC;AACpC,SAAS,UAAU,CAAC,IAAuB,EAAE,KAAsC;IACjF,IAAI,IAAiC,CAAC;IACtC,IAAI,SAAS,GAAG,CAAC,CAAC,CAAC;IACnB,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAClD,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC;YAAE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QAC5B,OAAO,CAAC,CAAC,YAAY,IAAI,OAAO,CAAC;IACnC,CAAC;IAEO,KAAK,CAAC,MAAM,CAAC,KAAsB,EAAE,IAAY,EAAE,KAAc;QACvE,IAAI,KAAK,KAAK,OAAO;YAAE,OAAO,OAAO,CAAC;QACtC,IAAI,KAAK,KAAK,MAAM;YAAE,OAAO,MAAM,CAAC;QACpC,kBAAkB;QAClB,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,IAAI,cAAc,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;YAAE,OAAO,OAAO,CAAC;QAC3F,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO,MAAM,CAAC;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAChD,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Policy } from '@corenel/protocol';
|
|
2
|
+
import { type PolicyValidationResult } from './validate';
|
|
3
|
+
/** Serialize a Policy to YAML with a stable, human-friendly key order. Undefined
|
|
4
|
+
* fields are dropped so the document only shows what the policy actually sets. */
|
|
5
|
+
export declare function policyToYaml(p: Policy): string;
|
|
6
|
+
/** Parse YAML text into a validated Policy. YAML syntax errors and schema errors
|
|
7
|
+
* are both reported through PolicyValidationResult.errors. */
|
|
8
|
+
export declare function policyFromYaml(text: string): PolicyValidationResult;
|
|
9
|
+
//# sourceMappingURL=serialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../guardrail/serialize.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAkB,KAAK,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzE;kFACkF;AAClF,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAgB9C;AAED;8DAC8D;AAC9D,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,sBAAsB,CAYnE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* YAML <-> Policy bridge. The policy is conceptually another Prompd artifact, so
|
|
2
|
+
* it is authored as YAML (matching .prmd/.pdflow house style). Parsing always
|
|
3
|
+
* routes through validatePolicy so the loop never trusts an unvalidated object.
|
|
4
|
+
*
|
|
5
|
+
* Uses the `yaml` package (pure JS, browser-safe) that @prompd/core already
|
|
6
|
+
* depends on — no Node/filesystem surface, consistent with this in-browser harness. */
|
|
7
|
+
import { parse, stringify } from 'yaml';
|
|
8
|
+
import { validatePolicy } from './validate';
|
|
9
|
+
/** Serialize a Policy to YAML with a stable, human-friendly key order. Undefined
|
|
10
|
+
* fields are dropped so the document only shows what the policy actually sets. */
|
|
11
|
+
export function policyToYaml(p) {
|
|
12
|
+
// Build an ordered plain object — `yaml` preserves insertion order on output.
|
|
13
|
+
const ordered = { version: p.version, name: p.name };
|
|
14
|
+
if (p.description !== undefined)
|
|
15
|
+
ordered.description = p.description;
|
|
16
|
+
if (p.onViolation !== undefined)
|
|
17
|
+
ordered.onViolation = p.onViolation;
|
|
18
|
+
if (p.maxTurns !== undefined)
|
|
19
|
+
ordered.maxTurns = p.maxTurns;
|
|
20
|
+
if (p.maxToolCalls !== undefined)
|
|
21
|
+
ordered.maxToolCalls = p.maxToolCalls;
|
|
22
|
+
if (p.tools !== undefined)
|
|
23
|
+
ordered.tools = p.tools;
|
|
24
|
+
if (p.mustCall !== undefined)
|
|
25
|
+
ordered.mustCall = p.mustCall;
|
|
26
|
+
if (p.permissions !== undefined)
|
|
27
|
+
ordered.permissions = p.permissions;
|
|
28
|
+
if (p.defaultPermission !== undefined)
|
|
29
|
+
ordered.defaultPermission = p.defaultPermission;
|
|
30
|
+
// The mutating-tool backstop must survive a YAML round-trip — it is the only rule
|
|
31
|
+
// denying unknown/dynamic mutating tools, so dropping it silently weakened a
|
|
32
|
+
// re-imported strict policy.
|
|
33
|
+
if (p.mutatingDefault !== undefined)
|
|
34
|
+
ordered.mutatingDefault = p.mutatingDefault;
|
|
35
|
+
return stringify(ordered, { lineWidth: 0 });
|
|
36
|
+
}
|
|
37
|
+
/** Parse YAML text into a validated Policy. YAML syntax errors and schema errors
|
|
38
|
+
* are both reported through PolicyValidationResult.errors. */
|
|
39
|
+
export function policyFromYaml(text) {
|
|
40
|
+
let doc;
|
|
41
|
+
try {
|
|
42
|
+
doc = parse(text);
|
|
43
|
+
}
|
|
44
|
+
catch (e) {
|
|
45
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
46
|
+
return { ok: false, errors: [`YAML parse error: ${msg}`] };
|
|
47
|
+
}
|
|
48
|
+
if (doc === null || doc === undefined) {
|
|
49
|
+
return { ok: false, errors: ['Policy is empty.'] };
|
|
50
|
+
}
|
|
51
|
+
return validatePolicy(doc);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=serialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../guardrail/serialize.ts"],"names":[],"mappings":"AAAA;;;;;uFAKuF;AACvF,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAExC,OAAO,EAAE,cAAc,EAA+B,MAAM,YAAY,CAAC;AAEzE;kFACkF;AAClF,MAAM,UAAU,YAAY,CAAC,CAAS;IACpC,8EAA8E;IAC9E,MAAM,OAAO,GAA4B,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9E,IAAI,CAAC,CAAC,WAAW,KAAK,SAAS;QAAE,OAAO,CAAC,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC;IACrE,IAAI,CAAC,CAAC,WAAW,KAAK,SAAS;QAAE,OAAO,CAAC,WAAW,GAAG,CAAC,CAAC,WAAW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E,CAAC;IAC7D,CAAC;IACD,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC;IACrD,CAAC;IACD,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Policy } from '@corenel/protocol';
|
|
2
|
+
export interface PolicyEntry {
|
|
3
|
+
name: string;
|
|
4
|
+
policy: Policy;
|
|
5
|
+
builtin: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function isBuiltinPolicy(name: string): boolean;
|
|
8
|
+
/** Built-ins (in declared order) followed by custom policies (alphabetical). */
|
|
9
|
+
export declare function listPolicies(): PolicyEntry[];
|
|
10
|
+
/** Resolve a policy by name. Built-ins win; falls back to a stored custom. */
|
|
11
|
+
export declare function getPolicy(name: string): Policy | undefined;
|
|
12
|
+
export interface PolicySaveResult {
|
|
13
|
+
ok: boolean;
|
|
14
|
+
errors: string[];
|
|
15
|
+
}
|
|
16
|
+
/** Persist a custom policy. Rejects built-in names (rename to save a copy) and
|
|
17
|
+
* any policy that fails validation. */
|
|
18
|
+
export declare function saveCustomPolicy(p: Policy): PolicySaveResult;
|
|
19
|
+
/** Remove a custom policy. No-op on built-ins. Returns true if something was removed. */
|
|
20
|
+
export declare function deleteCustomPolicy(name: string): boolean;
|
|
21
|
+
/** The persisted selection, falling back to 'standard' if unset/stale. */
|
|
22
|
+
export declare function getSelectedPolicyName(): string;
|
|
23
|
+
export declare function setSelectedPolicyName(name: string): void;
|
|
24
|
+
/** The selected policy object, always defined (defaults to STANDARD_POLICY). */
|
|
25
|
+
export declare function resolveSelectedPolicy(): Policy;
|
|
26
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../guardrail/store.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAOhD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAkCD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAErD;AAED,gFAAgF;AAChF,wBAAgB,YAAY,IAAI,WAAW,EAAE,CAU5C;AAED,8EAA8E;AAC9E,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG1D;AAED,MAAM,WAAW,gBAAgB;IAAG,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE;AAEnE;uCACuC;AACvC,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAa5D;AAED,yFAAyF;AACzF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOxD;AAED,0EAA0E;AAC1E,wBAAgB,qBAAqB,IAAI,MAAM,CAM9C;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAExD;AAED,gFAAgF;AAChF,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C"}
|