@agentic-kit/permissions 0.0.0-stage → 0.2.1
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/LICENSE +23 -0
- package/README.md +279 -2
- package/bash/analyze.d.ts +133 -0
- package/bash/analyze.js +442 -0
- package/bash/args.d.ts +45 -0
- package/bash/args.js +145 -0
- package/bash/braces.d.ts +6 -0
- package/bash/braces.js +72 -0
- package/bash/commands.d.ts +14 -0
- package/bash/commands.js +361 -0
- package/bash/file-commands.d.ts +22 -0
- package/bash/file-commands.js +278 -0
- package/bash/flows.d.ts +67 -0
- package/bash/flows.js +208 -0
- package/bash/git.d.ts +7 -0
- package/bash/git.js +163 -0
- package/bash/network.d.ts +24 -0
- package/bash/network.js +295 -0
- package/bash/quoting.d.ts +16 -0
- package/bash/quoting.js +164 -0
- package/bash/system.d.ts +16 -0
- package/bash/system.js +122 -0
- package/bash/tokenize.d.ts +67 -0
- package/bash/tokenize.js +440 -0
- package/bash/words.d.ts +9 -0
- package/bash/words.js +30 -0
- package/bash/wrappers.d.ts +32 -0
- package/bash/wrappers.js +237 -0
- package/classify.d.ts +22 -0
- package/classify.js +259 -0
- package/engine.d.ts +109 -0
- package/engine.js +144 -0
- package/env.d.ts +13 -0
- package/env.js +37 -0
- package/esm/bash/analyze.d.ts +133 -0
- package/esm/bash/analyze.js +405 -0
- package/esm/bash/args.d.ts +45 -0
- package/esm/bash/args.js +135 -0
- package/esm/bash/braces.d.ts +6 -0
- package/esm/bash/braces.js +69 -0
- package/esm/bash/commands.d.ts +14 -0
- package/esm/bash/commands.js +324 -0
- package/esm/bash/file-commands.d.ts +22 -0
- package/esm/bash/file-commands.js +233 -0
- package/esm/bash/flows.d.ts +67 -0
- package/esm/bash/flows.js +203 -0
- package/esm/bash/git.d.ts +7 -0
- package/esm/bash/git.js +127 -0
- package/esm/bash/network.d.ts +24 -0
- package/esm/bash/network.js +282 -0
- package/esm/bash/quoting.d.ts +16 -0
- package/esm/bash/quoting.js +153 -0
- package/esm/bash/system.d.ts +16 -0
- package/esm/bash/system.js +82 -0
- package/esm/bash/tokenize.d.ts +67 -0
- package/esm/bash/tokenize.js +437 -0
- package/esm/bash/words.d.ts +9 -0
- package/esm/bash/words.js +24 -0
- package/esm/bash/wrappers.d.ts +32 -0
- package/esm/bash/wrappers.js +200 -0
- package/esm/classify.d.ts +22 -0
- package/esm/classify.js +223 -0
- package/esm/engine.d.ts +109 -0
- package/esm/engine.js +108 -0
- package/esm/env.d.ts +13 -0
- package/esm/env.js +34 -0
- package/esm/findings.d.ts +7 -0
- package/esm/findings.js +9 -0
- package/esm/glob.d.ts +15 -0
- package/esm/glob.js +69 -0
- package/esm/grants.d.ts +36 -0
- package/esm/grants.js +99 -0
- package/esm/index.d.ts +19 -0
- package/esm/index.js +18 -0
- package/esm/node-fs.d.ts +6 -0
- package/esm/node-fs.js +34 -0
- package/esm/paths.d.ts +43 -0
- package/esm/paths.js +121 -0
- package/esm/policy.d.ts +21 -0
- package/esm/policy.js +85 -0
- package/esm/prompt.d.ts +14 -0
- package/esm/prompt.js +79 -0
- package/esm/roots.d.ts +75 -0
- package/esm/roots.js +148 -0
- package/esm/secret-files.d.ts +16 -0
- package/esm/secret-files.js +84 -0
- package/esm/secrets/collect.d.ts +19 -0
- package/esm/secrets/collect.js +60 -0
- package/esm/secrets/index.d.ts +5 -0
- package/esm/secrets/index.js +5 -0
- package/esm/secrets/parse.d.ts +19 -0
- package/esm/secrets/parse.js +140 -0
- package/esm/secrets/redact-result.d.ts +8 -0
- package/esm/secrets/redact-result.js +67 -0
- package/esm/secrets/rules.d.ts +34 -0
- package/esm/secrets/rules.js +101 -0
- package/esm/secrets/vault.d.ts +48 -0
- package/esm/secrets/vault.js +158 -0
- package/esm/signals.d.ts +14 -0
- package/esm/signals.js +26 -0
- package/esm/tool-input.d.ts +13 -0
- package/esm/tool-input.js +40 -0
- package/esm/types.d.ts +146 -0
- package/esm/types.js +20 -0
- package/findings.d.ts +7 -0
- package/findings.js +13 -0
- package/glob.d.ts +15 -0
- package/glob.js +73 -0
- package/grants.d.ts +36 -0
- package/grants.js +110 -0
- package/index.d.ts +19 -0
- package/index.js +52 -0
- package/node-fs.d.ts +6 -0
- package/node-fs.js +37 -0
- package/package.json +35 -3
- package/paths.d.ts +43 -0
- package/paths.js +164 -0
- package/policy.d.ts +21 -0
- package/policy.js +88 -0
- package/prompt.d.ts +14 -0
- package/prompt.js +83 -0
- package/roots.d.ts +75 -0
- package/roots.js +192 -0
- package/secret-files.d.ts +16 -0
- package/secret-files.js +124 -0
- package/secrets/collect.d.ts +19 -0
- package/secrets/collect.js +96 -0
- package/secrets/index.d.ts +5 -0
- package/secrets/index.js +21 -0
- package/secrets/parse.d.ts +19 -0
- package/secrets/parse.js +145 -0
- package/secrets/redact-result.d.ts +8 -0
- package/secrets/redact-result.js +70 -0
- package/secrets/rules.d.ts +34 -0
- package/secrets/rules.js +107 -0
- package/secrets/vault.d.ts +48 -0
- package/secrets/vault.js +163 -0
- package/signals.d.ts +14 -0
- package/signals.js +29 -0
- package/tool-input.d.ts +13 -0
- package/tool-input.js +46 -0
- package/types.d.ts +146 -0
- package/types.js +24 -0
package/findings.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Signal } from './types';
|
|
2
|
+
/** The signals raised for one call, keeping the first and most specific sentence for each. */
|
|
3
|
+
export declare class Findings {
|
|
4
|
+
readonly signals: Set<Signal>;
|
|
5
|
+
readonly reasons: Partial<Record<Signal, string>>;
|
|
6
|
+
flag(signal: Signal, reason: string): void;
|
|
7
|
+
}
|
package/findings.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Findings = void 0;
|
|
4
|
+
/** The signals raised for one call, keeping the first and most specific sentence for each. */
|
|
5
|
+
class Findings {
|
|
6
|
+
signals = new Set();
|
|
7
|
+
reasons = {};
|
|
8
|
+
flag(signal, reason) {
|
|
9
|
+
this.signals.add(signal);
|
|
10
|
+
this.reasons[signal] ??= reason;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.Findings = Findings;
|
package/glob.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a path with an unexpanded glob can expand into a root. Bash expands
|
|
3
|
+
* `*`, `?` and `[…]` one path component at a time, so the pattern is matched
|
|
4
|
+
* component by component against the root's own path. A pattern that reaches
|
|
5
|
+
* the root can name the root or anything inside it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const GLOB_CHARS: RegExp;
|
|
8
|
+
export interface GlobOptions {
|
|
9
|
+
/** `*` and `?` match a leading `.` (bash `dotglob`). */
|
|
10
|
+
dot: boolean;
|
|
11
|
+
/** Compare case-insensitively (macOS and Windows file systems). */
|
|
12
|
+
caseInsensitive: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** `pattern` (absolute, `..` already resolved) can expand to `root` or a path inside it. */
|
|
15
|
+
export declare function globReaches(pattern: string, root: string, opts: GlobOptions): boolean;
|
package/glob.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Whether a path with an unexpanded glob can expand into a root. Bash expands
|
|
4
|
+
* `*`, `?` and `[…]` one path component at a time, so the pattern is matched
|
|
5
|
+
* component by component against the root's own path. A pattern that reaches
|
|
6
|
+
* the root can name the root or anything inside it.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.GLOB_CHARS = void 0;
|
|
10
|
+
exports.globReaches = globReaches;
|
|
11
|
+
exports.GLOB_CHARS = /[*?[]/;
|
|
12
|
+
function escape(ch) {
|
|
13
|
+
return ch.replace(/[.+^${}()|\\\]]/g, '\\$&');
|
|
14
|
+
}
|
|
15
|
+
/** One component as a regex; `null` when it cannot be compiled (match anything then). */
|
|
16
|
+
function componentRegex(c, ci) {
|
|
17
|
+
let re = '';
|
|
18
|
+
for (let i = 0; i < c.length; i++) {
|
|
19
|
+
const ch = c[i];
|
|
20
|
+
if (ch === '*')
|
|
21
|
+
re += '.*';
|
|
22
|
+
else if (ch === '?')
|
|
23
|
+
re += '.';
|
|
24
|
+
else if (ch === '[') {
|
|
25
|
+
const close = c.indexOf(']', i + 2);
|
|
26
|
+
if (close < 0) {
|
|
27
|
+
re += '\\[';
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const body = c
|
|
31
|
+
.slice(i + 1, close)
|
|
32
|
+
.replace(/\\/g, '\\\\')
|
|
33
|
+
.replace(/^(!?)\]/, '$1\\]');
|
|
34
|
+
re += `[${body.startsWith('!') ? `^${body.slice(1)}` : body}]`;
|
|
35
|
+
i = close;
|
|
36
|
+
}
|
|
37
|
+
else
|
|
38
|
+
re += escape(ch);
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
return new RegExp(`^${re}$`, ci ? 'i' : '');
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function componentMatches(pattern, name, opts) {
|
|
48
|
+
if (!exports.GLOB_CHARS.test(pattern)) {
|
|
49
|
+
return opts.caseInsensitive ? pattern.toLowerCase() === name.toLowerCase() : pattern === name;
|
|
50
|
+
}
|
|
51
|
+
if (name.startsWith('.') && !pattern.startsWith('.') && !opts.dot)
|
|
52
|
+
return false;
|
|
53
|
+
const re = componentRegex(pattern, opts.caseInsensitive);
|
|
54
|
+
return re === null || re.test(name);
|
|
55
|
+
}
|
|
56
|
+
function reach(pattern, i, root, j, opts) {
|
|
57
|
+
if (j === root.length)
|
|
58
|
+
return true;
|
|
59
|
+
if (i === pattern.length)
|
|
60
|
+
return false;
|
|
61
|
+
if (pattern[i] === '**') {
|
|
62
|
+
// globstar: zero or more whole components.
|
|
63
|
+
if (reach(pattern, i + 1, root, j, opts))
|
|
64
|
+
return true;
|
|
65
|
+
return (opts.dot || !root[j].startsWith('.')) && reach(pattern, i, root, j + 1, opts);
|
|
66
|
+
}
|
|
67
|
+
return componentMatches(pattern[i], root[j], opts) && reach(pattern, i + 1, root, j + 1, opts);
|
|
68
|
+
}
|
|
69
|
+
/** `pattern` (absolute, `..` already resolved) can expand to `root` or a path inside it. */
|
|
70
|
+
function globReaches(pattern, root, opts) {
|
|
71
|
+
const parts = (p) => p.split('/').filter(Boolean);
|
|
72
|
+
return reach(parts(pattern), 0, parts(root), 0, opts);
|
|
73
|
+
}
|
package/grants.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grants: "allow this again" answers, keyed by what the call touches.
|
|
3
|
+
*
|
|
4
|
+
* A path grant covers a file tool call whose every target sits inside its
|
|
5
|
+
* folder with the same access. A command grant covers a bash call with the
|
|
6
|
+
* exact same normalized command. Nothing ever matches on a tool name alone.
|
|
7
|
+
*/
|
|
8
|
+
import type { Access, Grant, GrantMatch, GrantOption, PermissionRequest, Signal } from './types';
|
|
9
|
+
/** Signals a grant must never cover: each such call needs its own yes. */
|
|
10
|
+
export declare const NEVER_GRANTED: readonly Signal[];
|
|
11
|
+
export declare function isGrantable(request: PermissionRequest): boolean;
|
|
12
|
+
/** `match` covers the request. */
|
|
13
|
+
export declare function matchCovers(match: GrantMatch, request: PermissionRequest): boolean;
|
|
14
|
+
/** The first grant that covers the request, or `undefined`. Never for an ungrantable request. */
|
|
15
|
+
export declare function findGrant(grants: readonly Grant[], request: PermissionRequest): Grant | undefined;
|
|
16
|
+
export declare const ACCESS_VERB: Readonly<Record<Access, string>>;
|
|
17
|
+
/** What a grant covers, in words: "reads in ~/work/lib/", "bash: pnpm dlx shadcn add button". */
|
|
18
|
+
export declare function describeGrant(match: GrantMatch, homeDir: string): string;
|
|
19
|
+
/** The scopes the user may pick on an ASK: this chat, or always for this project. */
|
|
20
|
+
export declare function grantOptionsFor(request: PermissionRequest, homeDir: string): GrantOption[];
|
|
21
|
+
/** The grant one of an ASK's options saves. */
|
|
22
|
+
export declare function grantFrom(option: GrantOption, now?: Date): Grant;
|
|
23
|
+
/** Two matches are the same grant (for de-duplicating a store). */
|
|
24
|
+
export declare function sameMatch(a: GrantMatch, b: GrantMatch): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Where a host keeps project grants. Desktop keeps one JSON file per project;
|
|
27
|
+
* a worktree project reads and writes its parent's.
|
|
28
|
+
*/
|
|
29
|
+
export interface GrantStore {
|
|
30
|
+
list(): readonly Grant[] | Promise<readonly Grant[]>;
|
|
31
|
+
add(grant: Grant): void | Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
/** An in-memory store (tests, and hosts with no persistence). */
|
|
34
|
+
export declare function memoryGrantStore(initial?: readonly Grant[]): GrantStore & {
|
|
35
|
+
grants: Grant[];
|
|
36
|
+
};
|
package/grants.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Grants: "allow this again" answers, keyed by what the call touches.
|
|
4
|
+
*
|
|
5
|
+
* A path grant covers a file tool call whose every target sits inside its
|
|
6
|
+
* folder with the same access. A command grant covers a bash call with the
|
|
7
|
+
* exact same normalized command. Nothing ever matches on a tool name alone.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ACCESS_VERB = exports.NEVER_GRANTED = void 0;
|
|
11
|
+
exports.isGrantable = isGrantable;
|
|
12
|
+
exports.matchCovers = matchCovers;
|
|
13
|
+
exports.findGrant = findGrant;
|
|
14
|
+
exports.describeGrant = describeGrant;
|
|
15
|
+
exports.grantOptionsFor = grantOptionsFor;
|
|
16
|
+
exports.grantFrom = grantFrom;
|
|
17
|
+
exports.sameMatch = sameMatch;
|
|
18
|
+
exports.memoryGrantStore = memoryGrantStore;
|
|
19
|
+
const paths_1 = require("./paths");
|
|
20
|
+
const signals_1 = require("./signals");
|
|
21
|
+
/** Signals a grant must never cover: each such call needs its own yes. */
|
|
22
|
+
exports.NEVER_GRANTED = Object.keys(signals_1.SIGNAL_RULES).filter((s) => !signals_1.SIGNAL_RULES[s].grantable);
|
|
23
|
+
function isGrantable(request) {
|
|
24
|
+
return !request.signals.some((s) => exports.NEVER_GRANTED.includes(s));
|
|
25
|
+
}
|
|
26
|
+
/** `match` covers the request. */
|
|
27
|
+
function matchCovers(match, request) {
|
|
28
|
+
if (match.type === 'command') {
|
|
29
|
+
return request.toolName === 'bash' && request.command !== undefined && request.command === match.command;
|
|
30
|
+
}
|
|
31
|
+
if (request.toolName === 'bash' || !pathGrantable(request))
|
|
32
|
+
return false;
|
|
33
|
+
return request.targets.every((t) => t.access === match.access && t.zone !== 'unresolvable' && (0, paths_1.contains)(match.pathPrefix, t.path));
|
|
34
|
+
}
|
|
35
|
+
/** A glob outside the project: a folder grant cannot say where it expands to. */
|
|
36
|
+
function isOutsideGlob(t) {
|
|
37
|
+
return Boolean(t.glob) && t.zone !== 'workspace' && t.zone !== 'temp';
|
|
38
|
+
}
|
|
39
|
+
/** A folder grant can hold the request: it has targets, and none is a glob outside the project. */
|
|
40
|
+
function pathGrantable(request) {
|
|
41
|
+
return request.targets.length > 0 && !request.targets.some(isOutsideGlob);
|
|
42
|
+
}
|
|
43
|
+
/** The first grant that covers the request, or `undefined`. Never for an ungrantable request. */
|
|
44
|
+
function findGrant(grants, request) {
|
|
45
|
+
if (!isGrantable(request))
|
|
46
|
+
return undefined;
|
|
47
|
+
const ordered = [...grants.filter((g) => g.scope === 'chat'), ...grants.filter((g) => g.scope !== 'chat')];
|
|
48
|
+
return ordered.find((g) => matchCovers(g.match, request));
|
|
49
|
+
}
|
|
50
|
+
exports.ACCESS_VERB = { read: 'reads', write: 'writes', exec: 'runs' };
|
|
51
|
+
/** What a grant covers, in words: "reads in ~/work/lib/", "bash: pnpm dlx shadcn add button". */
|
|
52
|
+
function describeGrant(match, homeDir) {
|
|
53
|
+
if (match.type === 'command')
|
|
54
|
+
return `bash: ${match.command}`;
|
|
55
|
+
return `${exports.ACCESS_VERB[match.access]} in ${(0, paths_1.displayDir)(match.pathPrefix, homeDir)}`;
|
|
56
|
+
}
|
|
57
|
+
/** The scopes the user may pick on an ASK: this chat, or always for this project. */
|
|
58
|
+
function grantOptionsFor(request, homeDir) {
|
|
59
|
+
if (!isGrantable(request))
|
|
60
|
+
return [];
|
|
61
|
+
let match;
|
|
62
|
+
let pattern;
|
|
63
|
+
let always;
|
|
64
|
+
if (request.toolName === 'bash') {
|
|
65
|
+
if (!request.command)
|
|
66
|
+
return [];
|
|
67
|
+
match = { type: 'command', command: request.command };
|
|
68
|
+
pattern = request.command;
|
|
69
|
+
always = `Always allow ${request.command}`;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
if (!pathGrantable(request))
|
|
73
|
+
return [];
|
|
74
|
+
const access = request.targets[0].access;
|
|
75
|
+
if (request.targets.some((t) => t.access !== access))
|
|
76
|
+
return [];
|
|
77
|
+
const prefix = (0, paths_1.commonParent)(request.targets.map((t) => t.path));
|
|
78
|
+
match = { type: 'path', access, pathPrefix: prefix };
|
|
79
|
+
pattern = (0, paths_1.displayDir)(prefix, homeDir);
|
|
80
|
+
always = `Always allow ${describeGrant(match, homeDir)}`;
|
|
81
|
+
}
|
|
82
|
+
return [
|
|
83
|
+
{ scope: 'chat', label: 'Allow in this chat', pattern, match },
|
|
84
|
+
{ scope: 'project', label: always, pattern, match }
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
/** The grant one of an ASK's options saves. */
|
|
88
|
+
function grantFrom(option, now = new Date()) {
|
|
89
|
+
return { scope: option.scope, match: option.match, createdAt: now.toISOString() };
|
|
90
|
+
}
|
|
91
|
+
/** Two matches are the same grant (for de-duplicating a store). */
|
|
92
|
+
function sameMatch(a, b) {
|
|
93
|
+
if (a.type === 'command' && b.type === 'command')
|
|
94
|
+
return a.command === b.command;
|
|
95
|
+
if (a.type === 'path' && b.type === 'path')
|
|
96
|
+
return a.access === b.access && a.pathPrefix === b.pathPrefix;
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
/** An in-memory store (tests, and hosts with no persistence). */
|
|
100
|
+
function memoryGrantStore(initial = []) {
|
|
101
|
+
const grants = [...initial];
|
|
102
|
+
return {
|
|
103
|
+
grants,
|
|
104
|
+
list: () => grants,
|
|
105
|
+
add(grant) {
|
|
106
|
+
if (!grants.some((g) => sameMatch(g.match, grant.match)))
|
|
107
|
+
grants.push(grant);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@agentic-kit/permissions` — harness-neutral permissions for a coding agent:
|
|
3
|
+
* tool-call classification, the workspace boundary, bash risk signals, modes,
|
|
4
|
+
* grants, and secret redaction.
|
|
5
|
+
*
|
|
6
|
+
* No harness SDK is imported here. An adapter (the pi lane in `@agentic-kit/pi`)
|
|
7
|
+
* calls `evaluate` on each tool call, shows `decision.prompt` through its
|
|
8
|
+
* approval channel on `ask`, calls `restoreInput` before the tool runs and
|
|
9
|
+
* `redactResult` after. Classification, the policy and the vault stay internal.
|
|
10
|
+
*/
|
|
11
|
+
export { createPermissionEngine, type EvaluateContext, type PermissionEngine, type PermissionEngineOptions, type RedactedResult, type RootsInput, type SecretSourceInput, type ToolCallInput, type ToolResultInput } from './engine';
|
|
12
|
+
export { scrubEnv } from './env';
|
|
13
|
+
export { describeGrant, grantFrom, type GrantStore, memoryGrantStore, NEVER_GRANTED, sameMatch } from './grants';
|
|
14
|
+
export { nodeFsProbe } from './node-fs';
|
|
15
|
+
export type { PolicyRules } from './policy';
|
|
16
|
+
export { defaultHardDeny, defaultTempDirs, HOME_HARD_DENY, type KnownPath, WORKSPACE_ASK_WRITE, WORKSPACE_PROTECTED_WRITE } from './roots';
|
|
17
|
+
export { isSecretFile, isSecretFileName } from './secret-files';
|
|
18
|
+
export { findPlaceholders, PLACEHOLDER_PATTERN } from './secrets';
|
|
19
|
+
export * from './types';
|
package/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* `@agentic-kit/permissions` — harness-neutral permissions for a coding agent:
|
|
4
|
+
* tool-call classification, the workspace boundary, bash risk signals, modes,
|
|
5
|
+
* grants, and secret redaction.
|
|
6
|
+
*
|
|
7
|
+
* No harness SDK is imported here. An adapter (the pi lane in `@agentic-kit/pi`)
|
|
8
|
+
* calls `evaluate` on each tool call, shows `decision.prompt` through its
|
|
9
|
+
* approval channel on `ask`, calls `restoreInput` before the tool runs and
|
|
10
|
+
* `redactResult` after. Classification, the policy and the vault stay internal.
|
|
11
|
+
*/
|
|
12
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
16
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
17
|
+
}
|
|
18
|
+
Object.defineProperty(o, k2, desc);
|
|
19
|
+
}) : (function(o, m, k, k2) {
|
|
20
|
+
if (k2 === undefined) k2 = k;
|
|
21
|
+
o[k2] = m[k];
|
|
22
|
+
}));
|
|
23
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
24
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.PLACEHOLDER_PATTERN = exports.findPlaceholders = exports.isSecretFileName = exports.isSecretFile = exports.WORKSPACE_PROTECTED_WRITE = exports.WORKSPACE_ASK_WRITE = exports.HOME_HARD_DENY = exports.defaultTempDirs = exports.defaultHardDeny = exports.nodeFsProbe = exports.sameMatch = exports.NEVER_GRANTED = exports.memoryGrantStore = exports.grantFrom = exports.describeGrant = exports.scrubEnv = exports.createPermissionEngine = void 0;
|
|
28
|
+
var engine_1 = require("./engine");
|
|
29
|
+
Object.defineProperty(exports, "createPermissionEngine", { enumerable: true, get: function () { return engine_1.createPermissionEngine; } });
|
|
30
|
+
var env_1 = require("./env");
|
|
31
|
+
Object.defineProperty(exports, "scrubEnv", { enumerable: true, get: function () { return env_1.scrubEnv; } });
|
|
32
|
+
var grants_1 = require("./grants");
|
|
33
|
+
Object.defineProperty(exports, "describeGrant", { enumerable: true, get: function () { return grants_1.describeGrant; } });
|
|
34
|
+
Object.defineProperty(exports, "grantFrom", { enumerable: true, get: function () { return grants_1.grantFrom; } });
|
|
35
|
+
Object.defineProperty(exports, "memoryGrantStore", { enumerable: true, get: function () { return grants_1.memoryGrantStore; } });
|
|
36
|
+
Object.defineProperty(exports, "NEVER_GRANTED", { enumerable: true, get: function () { return grants_1.NEVER_GRANTED; } });
|
|
37
|
+
Object.defineProperty(exports, "sameMatch", { enumerable: true, get: function () { return grants_1.sameMatch; } });
|
|
38
|
+
var node_fs_1 = require("./node-fs");
|
|
39
|
+
Object.defineProperty(exports, "nodeFsProbe", { enumerable: true, get: function () { return node_fs_1.nodeFsProbe; } });
|
|
40
|
+
var roots_1 = require("./roots");
|
|
41
|
+
Object.defineProperty(exports, "defaultHardDeny", { enumerable: true, get: function () { return roots_1.defaultHardDeny; } });
|
|
42
|
+
Object.defineProperty(exports, "defaultTempDirs", { enumerable: true, get: function () { return roots_1.defaultTempDirs; } });
|
|
43
|
+
Object.defineProperty(exports, "HOME_HARD_DENY", { enumerable: true, get: function () { return roots_1.HOME_HARD_DENY; } });
|
|
44
|
+
Object.defineProperty(exports, "WORKSPACE_ASK_WRITE", { enumerable: true, get: function () { return roots_1.WORKSPACE_ASK_WRITE; } });
|
|
45
|
+
Object.defineProperty(exports, "WORKSPACE_PROTECTED_WRITE", { enumerable: true, get: function () { return roots_1.WORKSPACE_PROTECTED_WRITE; } });
|
|
46
|
+
var secret_files_1 = require("./secret-files");
|
|
47
|
+
Object.defineProperty(exports, "isSecretFile", { enumerable: true, get: function () { return secret_files_1.isSecretFile; } });
|
|
48
|
+
Object.defineProperty(exports, "isSecretFileName", { enumerable: true, get: function () { return secret_files_1.isSecretFileName; } });
|
|
49
|
+
var secrets_1 = require("./secrets");
|
|
50
|
+
Object.defineProperty(exports, "findPlaceholders", { enumerable: true, get: function () { return secrets_1.findPlaceholders; } });
|
|
51
|
+
Object.defineProperty(exports, "PLACEHOLDER_PATTERN", { enumerable: true, get: function () { return secrets_1.PLACEHOLDER_PATTERN; } });
|
|
52
|
+
__exportStar(require("./types"), exports);
|
package/node-fs.d.ts
ADDED
package/node-fs.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The Node implementation of `FsProbe`. The only module that imports `node:fs`,
|
|
4
|
+
* so everything else stays pure and testable with a fake.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.nodeFsProbe = void 0;
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
function isMissing(error) {
|
|
10
|
+
const code = error?.code;
|
|
11
|
+
return code === 'ENOENT' || code === 'ENOTDIR';
|
|
12
|
+
}
|
|
13
|
+
exports.nodeFsProbe = {
|
|
14
|
+
realpath: (p) => node_fs_1.promises.realpath(p),
|
|
15
|
+
async lexists(p) {
|
|
16
|
+
try {
|
|
17
|
+
await node_fs_1.promises.lstat(p);
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
// Anything but "missing" (EACCES, ELOOP) counts as present, so the
|
|
22
|
+
// path is treated as unresolvable instead of silently skipped.
|
|
23
|
+
return !isMissing(error);
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
readFile: (p) => node_fs_1.promises.readFile(p, 'utf8'),
|
|
27
|
+
async readDir(p) {
|
|
28
|
+
const entries = await node_fs_1.promises.readdir(p, { withFileTypes: true });
|
|
29
|
+
return entries.map((e) => ({
|
|
30
|
+
name: e.name,
|
|
31
|
+
kind: e.isDirectory() ? 'dir' : e.isFile() ? 'file' : e.isSymbolicLink() ? 'symlink' : 'other'
|
|
32
|
+
}));
|
|
33
|
+
},
|
|
34
|
+
async size(p) {
|
|
35
|
+
return (await node_fs_1.promises.stat(p)).size;
|
|
36
|
+
}
|
|
37
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentic-kit/permissions",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"author": "Constructive <developers@constructive.io>",
|
|
5
|
+
"description": "harness-neutral permissions for a coding agent — tool-call classification, workspace boundary, bash risk signals, modes, grants, and secret redaction",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"module": "esm/index.js",
|
|
8
|
+
"types": "index.d.ts",
|
|
9
|
+
"homepage": "https://github.com/constructive-io/constructive",
|
|
10
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public",
|
|
13
|
+
"directory": "dist"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/constructive-io/constructive"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/constructive-io/constructive/issues"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"agentic-kit",
|
|
24
|
+
"permissions",
|
|
25
|
+
"approval",
|
|
26
|
+
"sandbox",
|
|
27
|
+
"secrets",
|
|
28
|
+
"constructive"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"clean": "makage clean",
|
|
32
|
+
"build": "makage build",
|
|
33
|
+
"build:dev": "makage build --dev",
|
|
34
|
+
"lint": "eslint . --fix",
|
|
35
|
+
"test": "jest",
|
|
36
|
+
"test:watch": "jest --watch"
|
|
37
|
+
}
|
|
6
38
|
}
|
package/paths.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path handling that matches what the tools will actually open.
|
|
3
|
+
*
|
|
4
|
+
* `resolveLikePi` copies pi's `resolveToCwd` (`utils/paths.ts`), so the engine
|
|
5
|
+
* classifies the same absolute path the tool reads or writes. `canonicalize`
|
|
6
|
+
* then follows symlinks the way the kernel will, so a link inside the project
|
|
7
|
+
* that points at `~/.ssh` is judged as `~/.ssh`.
|
|
8
|
+
*/
|
|
9
|
+
import type { FsProbe } from './types';
|
|
10
|
+
/** macOS and Windows file systems are case-insensitive by default. */
|
|
11
|
+
export declare const CASE_INSENSITIVE_FS: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* pi's resolution for a tool `path` argument: normalize unicode spaces, strip
|
|
14
|
+
* one leading `@`, expand `~` and `~/`, accept `file://` URLs, then resolve
|
|
15
|
+
* against the cwd. Returns `null` when the input cannot name a local path (a
|
|
16
|
+
* malformed `file://` URL), which the caller treats as unresolvable.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveLikePi(raw: string, cwd: string, homeDir: string): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* The real location of `absolute`: realpath the deepest ancestor that exists,
|
|
21
|
+
* then add the missing tail again. `absolute` may hold `..` segments; they are
|
|
22
|
+
* resolved physically (after the symlinks before them), the way a shell's
|
|
23
|
+
* `open()` resolves them.
|
|
24
|
+
*
|
|
25
|
+
* Returns `null` (unresolvable) when some entry on the way exists but cannot be
|
|
26
|
+
* resolved: a dangling symlink, a link loop, or an entry we may not inspect. A
|
|
27
|
+
* write there would follow the link somewhere we cannot see.
|
|
28
|
+
*/
|
|
29
|
+
export declare function canonicalize(absolute: string, fs: FsProbe): Promise<string | null>;
|
|
30
|
+
/** `p` is `root` or inside it. Both must be absolute and normalized. */
|
|
31
|
+
export declare function contains(root: string, p: string, caseInsensitive?: boolean): boolean;
|
|
32
|
+
/** The deepest directory that holds every path (the parent of a single path). */
|
|
33
|
+
export declare function commonParent(paths: readonly string[]): string;
|
|
34
|
+
/**
|
|
35
|
+
* `~/…` for paths under the home dir, the absolute path otherwise. On macOS
|
|
36
|
+
* `/private/etc`, `/private/tmp` and `/private/var` show as `/etc`, `/tmp`
|
|
37
|
+
* and `/var`, the names people use for them.
|
|
38
|
+
*/
|
|
39
|
+
export declare function displayPath(p: string, homeDir: string): string;
|
|
40
|
+
/** Display form for a directory, with a trailing separator. */
|
|
41
|
+
export declare function displayDir(p: string, homeDir: string): string;
|
|
42
|
+
/** How a path reads on a card and in a reason: project-relative inside the workspace, `~/…` otherwise. */
|
|
43
|
+
export declare function showPath(p: string, workspace: string | undefined, homeDir: string): string;
|
package/paths.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Path handling that matches what the tools will actually open.
|
|
4
|
+
*
|
|
5
|
+
* `resolveLikePi` copies pi's `resolveToCwd` (`utils/paths.ts`), so the engine
|
|
6
|
+
* classifies the same absolute path the tool reads or writes. `canonicalize`
|
|
7
|
+
* then follows symlinks the way the kernel will, so a link inside the project
|
|
8
|
+
* that points at `~/.ssh` is judged as `~/.ssh`.
|
|
9
|
+
*/
|
|
10
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(o, k2, desc);
|
|
17
|
+
}) : (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
o[k2] = m[k];
|
|
20
|
+
}));
|
|
21
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
22
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
23
|
+
}) : function(o, v) {
|
|
24
|
+
o["default"] = v;
|
|
25
|
+
});
|
|
26
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
27
|
+
var ownKeys = function(o) {
|
|
28
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
29
|
+
var ar = [];
|
|
30
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
31
|
+
return ar;
|
|
32
|
+
};
|
|
33
|
+
return ownKeys(o);
|
|
34
|
+
};
|
|
35
|
+
return function (mod) {
|
|
36
|
+
if (mod && mod.__esModule) return mod;
|
|
37
|
+
var result = {};
|
|
38
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
39
|
+
__setModuleDefault(result, mod);
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
})();
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.CASE_INSENSITIVE_FS = void 0;
|
|
45
|
+
exports.resolveLikePi = resolveLikePi;
|
|
46
|
+
exports.canonicalize = canonicalize;
|
|
47
|
+
exports.contains = contains;
|
|
48
|
+
exports.commonParent = commonParent;
|
|
49
|
+
exports.displayPath = displayPath;
|
|
50
|
+
exports.displayDir = displayDir;
|
|
51
|
+
exports.showPath = showPath;
|
|
52
|
+
const path = __importStar(require("node:path"));
|
|
53
|
+
const node_url_1 = require("node:url");
|
|
54
|
+
const UNICODE_SPACES = /[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;
|
|
55
|
+
/** macOS and Windows file systems are case-insensitive by default. */
|
|
56
|
+
exports.CASE_INSENSITIVE_FS = process.platform === 'darwin' || process.platform === 'win32';
|
|
57
|
+
/**
|
|
58
|
+
* pi's resolution for a tool `path` argument: normalize unicode spaces, strip
|
|
59
|
+
* one leading `@`, expand `~` and `~/`, accept `file://` URLs, then resolve
|
|
60
|
+
* against the cwd. Returns `null` when the input cannot name a local path (a
|
|
61
|
+
* malformed `file://` URL), which the caller treats as unresolvable.
|
|
62
|
+
*/
|
|
63
|
+
function resolveLikePi(raw, cwd, homeDir) {
|
|
64
|
+
let normalized = raw.replace(UNICODE_SPACES, ' ');
|
|
65
|
+
if (normalized.startsWith('@'))
|
|
66
|
+
normalized = normalized.slice(1);
|
|
67
|
+
if (normalized === '~')
|
|
68
|
+
return path.resolve(homeDir);
|
|
69
|
+
if (normalized.startsWith('~/'))
|
|
70
|
+
return path.resolve(homeDir, normalized.slice(2));
|
|
71
|
+
if (/^file:\/\//.test(normalized)) {
|
|
72
|
+
try {
|
|
73
|
+
normalized = (0, node_url_1.fileURLToPath)(normalized);
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return path.isAbsolute(normalized) ? path.resolve(normalized) : path.resolve(cwd, normalized);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The real location of `absolute`: realpath the deepest ancestor that exists,
|
|
83
|
+
* then add the missing tail again. `absolute` may hold `..` segments; they are
|
|
84
|
+
* resolved physically (after the symlinks before them), the way a shell's
|
|
85
|
+
* `open()` resolves them.
|
|
86
|
+
*
|
|
87
|
+
* Returns `null` (unresolvable) when some entry on the way exists but cannot be
|
|
88
|
+
* resolved: a dangling symlink, a link loop, or an entry we may not inspect. A
|
|
89
|
+
* write there would follow the link somewhere we cannot see.
|
|
90
|
+
*/
|
|
91
|
+
async function canonicalize(absolute, fs) {
|
|
92
|
+
if (!path.isAbsolute(absolute))
|
|
93
|
+
return null;
|
|
94
|
+
const tail = [];
|
|
95
|
+
let current = absolute;
|
|
96
|
+
for (let depth = 0; depth < 4096; depth++) {
|
|
97
|
+
try {
|
|
98
|
+
const real = await fs.realpath(current);
|
|
99
|
+
return path.resolve(real, ...tail);
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
// fall through: does the entry itself exist?
|
|
103
|
+
}
|
|
104
|
+
if (await fs.lexists(current))
|
|
105
|
+
return null;
|
|
106
|
+
const parent = path.dirname(current);
|
|
107
|
+
if (parent === current)
|
|
108
|
+
return null;
|
|
109
|
+
tail.unshift(path.basename(current));
|
|
110
|
+
current = parent;
|
|
111
|
+
}
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
function fold(p, caseInsensitive) {
|
|
115
|
+
return caseInsensitive ? p.toLowerCase() : p;
|
|
116
|
+
}
|
|
117
|
+
/** `p` is `root` or inside it. Both must be absolute and normalized. */
|
|
118
|
+
function contains(root, p, caseInsensitive = false) {
|
|
119
|
+
const rel = path.relative(fold(root, caseInsensitive), fold(p, caseInsensitive));
|
|
120
|
+
if (rel === '')
|
|
121
|
+
return true;
|
|
122
|
+
return rel !== '..' && !rel.startsWith(`..${path.sep}`) && !path.isAbsolute(rel);
|
|
123
|
+
}
|
|
124
|
+
/** The deepest directory that holds every path (the parent of a single path). */
|
|
125
|
+
function commonParent(paths) {
|
|
126
|
+
if (paths.length === 0)
|
|
127
|
+
return path.sep;
|
|
128
|
+
let prefix = path.dirname(paths[0]);
|
|
129
|
+
for (const p of paths.slice(1)) {
|
|
130
|
+
while (!contains(prefix, p) || prefix === p) {
|
|
131
|
+
const parent = path.dirname(prefix);
|
|
132
|
+
if (parent === prefix)
|
|
133
|
+
return prefix;
|
|
134
|
+
prefix = parent;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return prefix;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* `~/…` for paths under the home dir, the absolute path otherwise. On macOS
|
|
141
|
+
* `/private/etc`, `/private/tmp` and `/private/var` show as `/etc`, `/tmp`
|
|
142
|
+
* and `/var`, the names people use for them.
|
|
143
|
+
*/
|
|
144
|
+
function displayPath(p, homeDir) {
|
|
145
|
+
const home = path.resolve(homeDir);
|
|
146
|
+
if (p === home)
|
|
147
|
+
return '~';
|
|
148
|
+
if (contains(home, p))
|
|
149
|
+
return `~/${path.relative(home, p)}`;
|
|
150
|
+
if (process.platform === 'darwin' && /^\/private\/(etc|tmp|var)(\/|$)/.test(p))
|
|
151
|
+
return p.slice('/private'.length);
|
|
152
|
+
return p;
|
|
153
|
+
}
|
|
154
|
+
/** Display form for a directory, with a trailing separator. */
|
|
155
|
+
function displayDir(p, homeDir) {
|
|
156
|
+
const shown = displayPath(p, homeDir);
|
|
157
|
+
return shown.endsWith('/') ? shown : `${shown}/`;
|
|
158
|
+
}
|
|
159
|
+
/** How a path reads on a card and in a reason: project-relative inside the workspace, `~/…` otherwise. */
|
|
160
|
+
function showPath(p, workspace, homeDir) {
|
|
161
|
+
if (workspace && p !== workspace && contains(workspace, p))
|
|
162
|
+
return path.relative(workspace, p);
|
|
163
|
+
return displayPath(p, homeDir);
|
|
164
|
+
}
|
package/policy.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The decision for a classified request. First match wins:
|
|
3
|
+
*
|
|
4
|
+
* 1. a hard-deny or protected-write target: DENY (no grant changes this)
|
|
5
|
+
* 2. a user deny rule: DENY (reserved; no rule UI in v1)
|
|
6
|
+
* 3. a chat grant, then a project grant, that covers the request: ALLOW
|
|
7
|
+
* 4. a user allow rule: ALLOW (reserved)
|
|
8
|
+
* 5. the mode default (see `modeDefault`)
|
|
9
|
+
*/
|
|
10
|
+
import { type PromptDisplay } from './prompt';
|
|
11
|
+
import type { Grant, GrantMatch, PermissionDecision, PermissionMode, PermissionRequest } from './types';
|
|
12
|
+
export interface PolicyRules {
|
|
13
|
+
deny?: readonly GrantMatch[];
|
|
14
|
+
allow?: readonly GrantMatch[];
|
|
15
|
+
}
|
|
16
|
+
export interface PolicyContext extends PromptDisplay {
|
|
17
|
+
mode: PermissionMode;
|
|
18
|
+
grants: readonly Grant[];
|
|
19
|
+
rules?: PolicyRules;
|
|
20
|
+
}
|
|
21
|
+
export declare function decide(request: PermissionRequest, ctx: PolicyContext): PermissionDecision;
|