@det-acp/core 0.2.1 → 0.3.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.
Files changed (57) hide show
  1. package/README.md +94 -32
  2. package/dist/engine/action-registry.d.ts.map +1 -1
  3. package/dist/engine/action-registry.js +20 -0
  4. package/dist/engine/action-registry.js.map +1 -1
  5. package/dist/index.d.ts +11 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +11 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/tools/archive-extract.d.ts +45 -0
  10. package/dist/tools/archive-extract.d.ts.map +1 -0
  11. package/dist/tools/archive-extract.js +246 -0
  12. package/dist/tools/archive-extract.js.map +1 -0
  13. package/dist/tools/directory-create.d.ts +33 -0
  14. package/dist/tools/directory-create.d.ts.map +1 -0
  15. package/dist/tools/directory-create.js +145 -0
  16. package/dist/tools/directory-create.js.map +1 -0
  17. package/dist/tools/directory-list.d.ts +32 -0
  18. package/dist/tools/directory-list.d.ts.map +1 -0
  19. package/dist/tools/directory-list.js +114 -0
  20. package/dist/tools/directory-list.js.map +1 -0
  21. package/dist/tools/env-read.d.ts +31 -0
  22. package/dist/tools/env-read.d.ts.map +1 -0
  23. package/dist/tools/env-read.js +108 -0
  24. package/dist/tools/env-read.js.map +1 -0
  25. package/dist/tools/file-copy.d.ts +30 -0
  26. package/dist/tools/file-copy.d.ts.map +1 -0
  27. package/dist/tools/file-copy.js +170 -0
  28. package/dist/tools/file-copy.js.map +1 -0
  29. package/dist/tools/file-delete.d.ts +27 -0
  30. package/dist/tools/file-delete.d.ts.map +1 -0
  31. package/dist/tools/file-delete.js +143 -0
  32. package/dist/tools/file-delete.js.map +1 -0
  33. package/dist/tools/file-move.d.ts +30 -0
  34. package/dist/tools/file-move.d.ts.map +1 -0
  35. package/dist/tools/file-move.js +167 -0
  36. package/dist/tools/file-move.js.map +1 -0
  37. package/dist/tools/git-commit.d.ts +33 -0
  38. package/dist/tools/git-commit.d.ts.map +1 -0
  39. package/dist/tools/git-commit.js +176 -0
  40. package/dist/tools/git-commit.js.map +1 -0
  41. package/dist/tools/git-status.d.ts +29 -0
  42. package/dist/tools/git-status.d.ts.map +1 -0
  43. package/dist/tools/git-status.js +159 -0
  44. package/dist/tools/git-status.js.map +1 -0
  45. package/dist/tools/network-dns.d.ts +50 -0
  46. package/dist/tools/network-dns.d.ts.map +1 -0
  47. package/dist/tools/network-dns.js +122 -0
  48. package/dist/tools/network-dns.js.map +1 -0
  49. package/dist/types.d.ts +1 -1
  50. package/dist/types.d.ts.map +1 -1
  51. package/examples/coding-agent.policy.yaml +44 -0
  52. package/examples/data-analyst.policy.yaml +160 -0
  53. package/examples/devops-deploy.policy.yaml +68 -0
  54. package/examples/infrastructure-manager.policy.yaml +209 -0
  55. package/examples/security-audit.policy.yaml +152 -0
  56. package/examples/video-upscaler.policy.yaml +45 -0
  57. package/package.json +1 -1
@@ -16,6 +16,30 @@ capabilities:
16
16
  paths:
17
17
  - "./src/**"
18
18
  - "./tests/**"
19
+ - tool: "file:delete"
20
+ scope:
21
+ paths:
22
+ - "./src/**"
23
+ - "./tests/**"
24
+ - tool: "file:move"
25
+ scope:
26
+ paths:
27
+ - "./src/**"
28
+ - "./tests/**"
29
+ - tool: "file:copy"
30
+ scope:
31
+ paths:
32
+ - "./src/**"
33
+ - "./tests/**"
34
+ - tool: "directory:list"
35
+ scope:
36
+ paths:
37
+ - "./**"
38
+ - tool: "directory:create"
39
+ scope:
40
+ paths:
41
+ - "./src/**"
42
+ - "./tests/**"
19
43
  - tool: "command:run"
20
44
  scope:
21
45
  binaries:
@@ -33,6 +57,14 @@ capabilities:
33
57
  - tool: "git:apply"
34
58
  scope:
35
59
  repos: ["."]
60
+ - tool: "git:status"
61
+ scope:
62
+ repos: ["."]
63
+ - tool: "git:commit"
64
+ scope:
65
+ repos: ["."]
66
+ - tool: "env:read"
67
+ scope: {}
36
68
 
37
69
  limits:
38
70
  max_runtime_ms: 1800000 # 30 minutes
@@ -41,6 +73,18 @@ limits:
41
73
  max_cost_usd: 5.0
42
74
 
43
75
  gates:
76
+ - action: "file:delete"
77
+ approval: "human"
78
+ risk_level: "high"
79
+
80
+ - action: "file:move"
81
+ approval: "auto"
82
+ risk_level: "medium"
83
+
84
+ - action: "git:commit"
85
+ approval: "auto"
86
+ risk_level: "medium"
87
+
44
88
  - action: "command:run"
45
89
  approval: "human"
46
90
  risk_level: "high"
@@ -0,0 +1,160 @@
1
+ # Data Analyst Agent Policy
2
+ # Constrains a data analysis agent operating on datasets, generating reports,
3
+ # and querying external APIs — while preventing data exfiltration and
4
+ # unauthorized modifications to source data.
5
+
6
+ version: "1.0"
7
+ name: "data-analyst"
8
+ description: "Policy for a data analysis agent that reads datasets, runs analysis scripts, generates reports, and queries external data APIs."
9
+
10
+ capabilities:
11
+ - tool: "file:read"
12
+ scope:
13
+ paths:
14
+ - "./data/**"
15
+ - "./config/**"
16
+ - "./scripts/**"
17
+ - "./templates/**"
18
+
19
+ - tool: "file:write"
20
+ scope:
21
+ paths:
22
+ - "./output/**"
23
+ - "./reports/**"
24
+ - "./tmp/**"
25
+
26
+ - tool: "file:copy"
27
+ scope:
28
+ paths:
29
+ - "./data/**"
30
+ - "./output/**"
31
+
32
+ - tool: "file:delete"
33
+ scope:
34
+ paths:
35
+ - "./tmp/**"
36
+ - "./output/**"
37
+
38
+ - tool: "directory:list"
39
+ scope:
40
+ paths:
41
+ - "./data/**"
42
+ - "./output/**"
43
+ - "./reports/**"
44
+ - "./scripts/**"
45
+
46
+ - tool: "directory:create"
47
+ scope:
48
+ paths:
49
+ - "./output/**"
50
+ - "./reports/**"
51
+ - "./tmp/**"
52
+
53
+ - tool: "command:run"
54
+ scope:
55
+ binaries:
56
+ - "python"
57
+ - "python3"
58
+ - "pip"
59
+ - "Rscript"
60
+ - "node"
61
+ - "npx"
62
+ - "cat"
63
+ - "wc"
64
+ - "head"
65
+ - "tail"
66
+ - "sort"
67
+
68
+ - tool: "http:request"
69
+ scope:
70
+ domains:
71
+ - "api.census.gov"
72
+ - "api.worldbank.org"
73
+ - "data.gov"
74
+ - "api.data.yourcompany.com"
75
+ methods:
76
+ - "GET"
77
+
78
+ - tool: "env:read"
79
+ scope: {}
80
+
81
+ - tool: "archive:extract"
82
+ scope:
83
+ paths:
84
+ - "./data/**"
85
+ - "./tmp/**"
86
+
87
+ - tool: "network:dns"
88
+ scope:
89
+ domains:
90
+ - "api.census.gov"
91
+ - "api.worldbank.org"
92
+ - "data.gov"
93
+
94
+ limits:
95
+ max_runtime_ms: 3600000 # 60 minutes (analysis can be long)
96
+ max_output_bytes: 536870912 # 512 MB
97
+ max_files_changed: 100
98
+ max_retries: 3
99
+ max_cost_usd: 10.0
100
+
101
+ gates:
102
+ - action: "file:delete"
103
+ approval: "human"
104
+ risk_level: "medium"
105
+
106
+ - action: "http:request"
107
+ approval: "auto"
108
+ risk_level: "low"
109
+
110
+ - action: "command:run"
111
+ approval: "auto"
112
+ risk_level: "medium"
113
+ condition: "outside_scope"
114
+
115
+ evidence:
116
+ require:
117
+ - "checksums"
118
+ - "diffs"
119
+ - "exit_codes"
120
+ - "logs"
121
+ format: "jsonl"
122
+
123
+ forbidden:
124
+ - pattern: "**/.env"
125
+ - pattern: "**/.env.*"
126
+ - pattern: "**/credentials*"
127
+ - pattern: "**/secrets*"
128
+ - pattern: "**/passwords*"
129
+ - pattern: "curl | sh"
130
+ - pattern: "wget | sh"
131
+ - pattern: "rm -rf /"
132
+ - pattern: "pip install --user"
133
+ - pattern: "POST"
134
+ - pattern: "PUT"
135
+ - pattern: "DELETE"
136
+
137
+ session:
138
+ max_actions: 500
139
+ max_denials: 30
140
+ rate_limit:
141
+ max_per_minute: 60
142
+ escalation:
143
+ - after_actions: 200
144
+ require: human_checkin
145
+ - after_minutes: 30
146
+ require: human_checkin
147
+
148
+ remediation:
149
+ rules:
150
+ - match: "FileNotFoundError"
151
+ action: "retry"
152
+ - match: "MemoryError"
153
+ action: "abort"
154
+ - match: "ECONNREFUSED"
155
+ action: "retry"
156
+ - match: "disk full"
157
+ action: "abort"
158
+ - match: "permission denied"
159
+ action: "abort"
160
+ fallback_chain: ["retry", "skip", "abort"]
@@ -18,6 +18,37 @@ capabilities:
18
18
  - "/app/dist/**"
19
19
  - "/tmp/deploy-work/**"
20
20
 
21
+ - tool: "file:delete"
22
+ scope:
23
+ paths:
24
+ - "/app/dist/**"
25
+ - "/tmp/deploy-work/**"
26
+
27
+ - tool: "file:copy"
28
+ scope:
29
+ paths:
30
+ - "/app/**"
31
+ - "/config/**"
32
+ - "/tmp/deploy-work/**"
33
+
34
+ - tool: "file:move"
35
+ scope:
36
+ paths:
37
+ - "/app/dist/**"
38
+ - "/tmp/deploy-work/**"
39
+
40
+ - tool: "directory:list"
41
+ scope:
42
+ paths:
43
+ - "/app/**"
44
+ - "/config/**"
45
+
46
+ - tool: "directory:create"
47
+ scope:
48
+ paths:
49
+ - "/app/dist/**"
50
+ - "/tmp/deploy-work/**"
51
+
21
52
  - tool: "command:run"
22
53
  scope:
23
54
  binaries:
@@ -38,6 +69,16 @@ capabilities:
38
69
  repos:
39
70
  - "/app"
40
71
 
72
+ - tool: "git:status"
73
+ scope:
74
+ repos:
75
+ - "/app"
76
+
77
+ - tool: "git:commit"
78
+ scope:
79
+ repos:
80
+ - "/app"
81
+
41
82
  - tool: "http:request"
42
83
  scope:
43
84
  domains:
@@ -48,6 +89,21 @@ capabilities:
48
89
  - "GET"
49
90
  - "POST"
50
91
 
92
+ - tool: "env:read"
93
+ scope: {}
94
+
95
+ - tool: "network:dns"
96
+ scope:
97
+ domains:
98
+ - "registry.npmjs.org"
99
+ - "api.github.com"
100
+ - "k8s.internal.yourcompany.com"
101
+
102
+ - tool: "archive:extract"
103
+ scope:
104
+ paths:
105
+ - "/tmp/deploy-work/**"
106
+
51
107
  limits:
52
108
  max_runtime_ms: 600000 # 10 minutes
53
109
  max_output_bytes: 1073741824 # 1 GB
@@ -69,6 +125,18 @@ gates:
69
125
  approval: "human"
70
126
  risk_level: "critical"
71
127
 
128
+ - action: "file:move"
129
+ approval: "human"
130
+ risk_level: "high"
131
+
132
+ - action: "git:commit"
133
+ approval: "human"
134
+ risk_level: "high"
135
+
136
+ - action: "archive:extract"
137
+ approval: "auto"
138
+ risk_level: "medium"
139
+
72
140
  evidence:
73
141
  require:
74
142
  - "diffs"
@@ -0,0 +1,209 @@
1
+ # Infrastructure Manager Agent Policy
2
+ # Constrains an infrastructure management agent that handles server
3
+ # configurations, manages deployments, monitors services, and maintains
4
+ # infrastructure-as-code files. Strict human gates on all destructive operations.
5
+
6
+ version: "1.0"
7
+ name: "infrastructure-manager"
8
+ description: "Policy for an infrastructure management agent that handles configs, deployments, monitoring, and IaC with strict human approval on destructive operations."
9
+
10
+ capabilities:
11
+ - tool: "file:read"
12
+ scope:
13
+ paths:
14
+ - "./infrastructure/**"
15
+ - "./config/**"
16
+ - "./terraform/**"
17
+ - "./ansible/**"
18
+ - "./k8s/**"
19
+ - "./docker/**"
20
+ - "./monitoring/**"
21
+
22
+ - tool: "file:write"
23
+ scope:
24
+ paths:
25
+ - "./infrastructure/**"
26
+ - "./config/**"
27
+ - "./terraform/**"
28
+ - "./ansible/**"
29
+ - "./k8s/**"
30
+ - "./docker/**"
31
+ - "./monitoring/**"
32
+ - "./tmp/infra/**"
33
+
34
+ - tool: "file:copy"
35
+ scope:
36
+ paths:
37
+ - "./infrastructure/**"
38
+ - "./config/**"
39
+ - "./tmp/infra/**"
40
+
41
+ - tool: "file:move"
42
+ scope:
43
+ paths:
44
+ - "./infrastructure/**"
45
+ - "./config/**"
46
+ - "./tmp/infra/**"
47
+
48
+ - tool: "file:delete"
49
+ scope:
50
+ paths:
51
+ - "./tmp/infra/**"
52
+
53
+ - tool: "directory:list"
54
+ scope:
55
+ paths:
56
+ - "./**"
57
+
58
+ - tool: "directory:create"
59
+ scope:
60
+ paths:
61
+ - "./infrastructure/**"
62
+ - "./config/**"
63
+ - "./tmp/infra/**"
64
+
65
+ - tool: "command:run"
66
+ scope:
67
+ binaries:
68
+ - "terraform"
69
+ - "ansible"
70
+ - "ansible-playbook"
71
+ - "kubectl"
72
+ - "docker"
73
+ - "docker-compose"
74
+ - "helm"
75
+ - "git"
76
+ - "ssh"
77
+ - "scp"
78
+ - "curl"
79
+ - "jq"
80
+ - "yq"
81
+ - "cat"
82
+ - "ls"
83
+
84
+ - tool: "git:diff"
85
+ scope:
86
+ repos: ["."]
87
+
88
+ - tool: "git:status"
89
+ scope:
90
+ repos: ["."]
91
+
92
+ - tool: "git:commit"
93
+ scope:
94
+ repos: ["."]
95
+
96
+ - tool: "git:apply"
97
+ scope:
98
+ repos: ["."]
99
+
100
+ - tool: "http:request"
101
+ scope:
102
+ domains:
103
+ - "api.github.com"
104
+ - "registry.terraform.io"
105
+ - "k8s.internal.yourcompany.com"
106
+ - "monitoring.internal.yourcompany.com"
107
+ - "vault.internal.yourcompany.com"
108
+ methods:
109
+ - "GET"
110
+ - "POST"
111
+ - "PUT"
112
+
113
+ - tool: "env:read"
114
+ scope: {}
115
+
116
+ - tool: "network:dns"
117
+ scope:
118
+ domains:
119
+ - "api.github.com"
120
+ - "registry.terraform.io"
121
+ - "k8s.internal.yourcompany.com"
122
+
123
+ - tool: "archive:extract"
124
+ scope:
125
+ paths:
126
+ - "./tmp/infra/**"
127
+
128
+ limits:
129
+ max_runtime_ms: 1800000 # 30 minutes
130
+ max_output_bytes: 536870912 # 512 MB
131
+ max_files_changed: 100
132
+ max_retries: 2
133
+ max_cost_usd: 10.0
134
+
135
+ gates:
136
+ - action: "file:delete"
137
+ approval: "human"
138
+ risk_level: "critical"
139
+
140
+ - action: "file:move"
141
+ approval: "human"
142
+ risk_level: "high"
143
+
144
+ - action: "git:commit"
145
+ approval: "human"
146
+ risk_level: "high"
147
+
148
+ - action: "command:run"
149
+ approval: "human"
150
+ risk_level: "high"
151
+ condition: "outside_scope"
152
+
153
+ - action: "http:request"
154
+ approval: "human"
155
+ risk_level: "high"
156
+ condition: "POST|PUT"
157
+
158
+ evidence:
159
+ require:
160
+ - "checksums"
161
+ - "diffs"
162
+ - "exit_codes"
163
+ - "logs"
164
+ format: "jsonl"
165
+
166
+ forbidden:
167
+ - pattern: "**/.env"
168
+ - pattern: "**/.env.*"
169
+ - pattern: "**/credentials*"
170
+ - pattern: "**/secrets*"
171
+ - pattern: "**/private_key*"
172
+ - pattern: "**/*.pem"
173
+ - pattern: "**/*.key"
174
+ - pattern: "rm -rf /"
175
+ - pattern: "terraform destroy"
176
+ - pattern: "kubectl delete namespace"
177
+ - pattern: "kubectl delete --all"
178
+ - pattern: "docker system prune"
179
+ - pattern: "ansible-playbook --extra-vars"
180
+ - pattern: "curl | sh"
181
+ - pattern: "wget | sh"
182
+ - pattern: "git push --force"
183
+
184
+ session:
185
+ max_actions: 200
186
+ max_denials: 15
187
+ rate_limit:
188
+ max_per_minute: 30
189
+ escalation:
190
+ - after_actions: 50
191
+ require: human_checkin
192
+ - after_minutes: 10
193
+ require: human_checkin
194
+
195
+ remediation:
196
+ rules:
197
+ - match: "terraform error"
198
+ action: "abort"
199
+ - match: "ansible fatal"
200
+ action: "abort"
201
+ - match: "kubectl error"
202
+ action: "retry"
203
+ - match: "ECONNREFUSED"
204
+ action: "retry"
205
+ - match: "permission denied"
206
+ action: "abort"
207
+ - match: "timeout"
208
+ action: "retry"
209
+ fallback_chain: ["retry", "abort"]
@@ -0,0 +1,152 @@
1
+ # Security Audit Agent Policy
2
+ # Constrains a security auditing agent to read-only operations with
3
+ # tightly controlled write access for reports. The agent can scan
4
+ # code, check for vulnerabilities, inspect configurations, and generate
5
+ # audit reports — but NEVER modify source code or deploy anything.
6
+
7
+ version: "1.0"
8
+ name: "security-audit"
9
+ description: "Policy for a security audit agent that scans code, checks dependencies, inspects configurations, validates secrets management, and generates audit reports."
10
+
11
+ capabilities:
12
+ - tool: "file:read"
13
+ scope:
14
+ paths:
15
+ - "./**"
16
+
17
+ - tool: "file:write"
18
+ scope:
19
+ paths:
20
+ - "./audit-reports/**"
21
+ - "./tmp/audit/**"
22
+
23
+ - tool: "file:copy"
24
+ scope:
25
+ paths:
26
+ - "./**"
27
+
28
+ - tool: "directory:list"
29
+ scope:
30
+ paths:
31
+ - "./**"
32
+
33
+ - tool: "directory:create"
34
+ scope:
35
+ paths:
36
+ - "./audit-reports/**"
37
+ - "./tmp/audit/**"
38
+
39
+ - tool: "command:run"
40
+ scope:
41
+ binaries:
42
+ - "npm"
43
+ - "npx"
44
+ - "node"
45
+ - "git"
46
+ - "grep"
47
+ - "find"
48
+ - "wc"
49
+ - "cat"
50
+ - "ls"
51
+ - "sha256sum"
52
+ - "openssl"
53
+ - "semgrep"
54
+ - "trivy"
55
+ - "snyk"
56
+
57
+ - tool: "git:diff"
58
+ scope:
59
+ repos: ["."]
60
+
61
+ - tool: "git:status"
62
+ scope:
63
+ repos: ["."]
64
+
65
+ - tool: "http:request"
66
+ scope:
67
+ domains:
68
+ - "api.github.com"
69
+ - "registry.npmjs.org"
70
+ - "osv.dev"
71
+ - "cve.circl.lu"
72
+ - "nvd.nist.gov"
73
+ methods:
74
+ - "GET"
75
+
76
+ - tool: "env:read"
77
+ scope: {}
78
+
79
+ - tool: "network:dns"
80
+ scope:
81
+ domains:
82
+ - "api.github.com"
83
+ - "registry.npmjs.org"
84
+ - "osv.dev"
85
+
86
+ limits:
87
+ max_runtime_ms: 1800000 # 30 minutes
88
+ max_output_bytes: 104857600 # 100 MB
89
+ max_files_changed: 20 # Only report files
90
+ max_retries: 2
91
+ max_cost_usd: 5.0
92
+
93
+ gates:
94
+ - action: "command:run"
95
+ approval: "human"
96
+ risk_level: "high"
97
+ condition: "outside_scope"
98
+
99
+ - action: "http:request"
100
+ approval: "auto"
101
+ risk_level: "low"
102
+
103
+ evidence:
104
+ require:
105
+ - "checksums"
106
+ - "diffs"
107
+ - "exit_codes"
108
+ - "logs"
109
+ format: "jsonl"
110
+
111
+ forbidden:
112
+ - pattern: "**/.env"
113
+ - pattern: "**/.env.*"
114
+ - pattern: "**/credentials*"
115
+ - pattern: "**/secrets*"
116
+ - pattern: "**/private_key*"
117
+ - pattern: "**/*.pem"
118
+ - pattern: "**/*.key"
119
+ - pattern: "rm -rf"
120
+ - pattern: "curl | sh"
121
+ - pattern: "wget | sh"
122
+ - pattern: "npm publish"
123
+ - pattern: "npm install"
124
+ - pattern: "git push"
125
+ - pattern: "git commit"
126
+ - pattern: "docker run"
127
+ - pattern: "kubectl"
128
+ - pattern: "eval("
129
+ - pattern: "exec("
130
+
131
+ session:
132
+ max_actions: 300
133
+ max_denials: 30
134
+ rate_limit:
135
+ max_per_minute: 60
136
+ escalation:
137
+ - after_actions: 100
138
+ require: human_checkin
139
+ - after_minutes: 15
140
+ require: human_checkin
141
+
142
+ remediation:
143
+ rules:
144
+ - match: "ENOENT"
145
+ action: "skip"
146
+ - match: "EACCES"
147
+ action: "skip"
148
+ - match: "ECONNREFUSED"
149
+ action: "retry"
150
+ - match: "timeout"
151
+ action: "retry"
152
+ fallback_chain: ["retry", "skip", "abort"]