@agent-corpus/policy-manager 0.8.0 → 0.9.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/tools.js ADDED
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Tools the engine judges itself: shell, file, patch and command-running tools. They are never
3
+ * approved by default and always get the engine's checks. MCP tools (`mcp__*`) follow
4
+ * `mcpReadOnly` instead.
5
+ */
6
+ export const ENGINE_TOOLS = new Set([
7
+ "Bash",
8
+ "bash",
9
+ "powershell",
10
+ "exec_command",
11
+ "shell",
12
+ "apply_patch",
13
+ "Read",
14
+ "view",
15
+ "read_file",
16
+ "Edit",
17
+ "Write",
18
+ "MultiEdit",
19
+ "NotebookEdit",
20
+ "edit",
21
+ "create",
22
+ "write_file",
23
+ "str_replace_editor",
24
+ // Read file contents or names, so they can reach credential paths.
25
+ "Grep",
26
+ "Glob",
27
+ "LS",
28
+ "NotebookRead",
29
+ "view_image",
30
+ // Runs a shell command in the background.
31
+ "Monitor",
32
+ // Run a command or feed a running one.
33
+ "shell_command",
34
+ "local_shell",
35
+ "unified_exec",
36
+ "write_stdin",
37
+ "write_bash",
38
+ "write_powershell",
39
+ ].map((name) => name.toLowerCase()));
40
+ /**
41
+ * Harness tools that are never approved by default and keep the classification path. Empty for
42
+ * now; a profile adds names through `toolsDeny`.
43
+ */
44
+ export const BUILTIN_TOOLS_DENY = {
45
+ claude: new Set(),
46
+ codex: new Set(),
47
+ copilot: new Set(),
48
+ };
49
+ /**
50
+ * A name that suggests running code, feeding a running command, or touching files. Such a tool is
51
+ * never approved by default, even when ENGINE_TOOLS misses it, so a new or renamed one fails
52
+ * closed. A false positive (`BashOutput`, `SendUserFile`) only costs a classification.
53
+ */
54
+ export const COMMAND_TOOL = /bash|shell|powershell|pwsh|exec|stdin|terminal|command|cmd|spawn|repl|eval|python|node|interpreter|script|computer|run|file|delete|remove|move|rename|patch|edit/i;
55
+ /** A harness tool name a profile may list. */
56
+ export const TOOL_NAME = /^[A-Za-z][A-Za-z0-9_.-]{0,63}$/;
57
+ /** Whether a tool is approved by default: not an engine or MCP tool, and not denied. */
58
+ export function defaultAllowed(harness, tool, deny) {
59
+ return (TOOL_NAME.test(tool) &&
60
+ !ENGINE_TOOLS.has(tool.toLowerCase()) &&
61
+ !COMMAND_TOOL.test(tool) &&
62
+ !tool.toLowerCase().startsWith("mcp__") &&
63
+ !BUILTIN_TOOLS_DENY[harness]?.has(tool) &&
64
+ !deny.includes(tool));
65
+ }
66
+ //# sourceMappingURL=tools.js.map
package/dist/types.d.ts CHANGED
@@ -40,6 +40,10 @@ export interface Decision {
40
40
  ai?: Classification;
41
41
  /** A human decision the user may approve for the rest of the session (`approve --session`). */
42
42
  sessionGrantable?: boolean;
43
+ /** What `approve --session` would cover, in words the user can check. */
44
+ sessionScopeLabel?: string;
45
+ /** A harness tool approved by default (not a shell, file, patch or MCP tool), by name. */
46
+ defaultTool?: string;
43
47
  /** The agent tried to approve a request itself: no approval instruction is offered for it. */
44
48
  userOnly?: boolean;
45
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-corpus/policy-manager",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Deterministic, session-scoped permission decisions with audit logs and bounded AI classification.",
5
5
  "keywords": [
6
6
  "coding-agent",