@miller-tech/uap 1.136.0 → 1.136.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/package.json +1 -1
- package/src/policies/enforcers/__pycache__/_common.cpython-312.pyc +0 -0
- package/src/policies/enforcers/delivery_enforcement.py +7 -1
- package/tools/agents/scripts/__pycache__/toolcall_path_normalizer.cpython-312.pyc +0 -0
- package/tools/agents/tests/test_delivery_enforcement_filepath.py +37 -0
package/package.json
CHANGED
|
Binary file
|
|
@@ -88,7 +88,13 @@ def main() -> None:
|
|
|
88
88
|
emit(True, "not a file-edit operation")
|
|
89
89
|
return
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
# Accept the file-path key under any common agent spelling: file_path
|
|
92
|
+
# (Claude), filePath (opencode), path/target/filename/file (misc tools).
|
|
93
|
+
# Without filePath, opencode Write/Edit calls slipped through unrecognized.
|
|
94
|
+
target = (
|
|
95
|
+
args.get("file_path") or args.get("filePath") or args.get("path")
|
|
96
|
+
or args.get("target") or args.get("filename") or args.get("file") or ""
|
|
97
|
+
)
|
|
92
98
|
if not target:
|
|
93
99
|
emit(True, "no file path in args")
|
|
94
100
|
return
|
|
Binary file
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""delivery-enforcement must recognize opencode's `filePath` arg key (not just
|
|
3
|
+
Claude's `file_path`), else opencode Write/Edit calls slip through ungated."""
|
|
4
|
+
import json, os, subprocess, sys, unittest
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
ENF = Path(__file__).resolve().parents[3] / "src" / "policies" / "enforcers" / "delivery_enforcement.py"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def run(args, env=None):
|
|
11
|
+
e = {**os.environ, "UAP_ENFORCE_DELIVERY": "block", "UAP_INFERENCE_ENDPOINT": "http://172.17.0.1:8080/v1"}
|
|
12
|
+
for k in ("UAP_DELIVER_ACTIVE", "UAP_DELIVER_BYPASS", "UAP_DELIVER_LOCAL_MODE", "UAP_DELIVER_LOCAL_ADVISORY"):
|
|
13
|
+
e.pop(k, None)
|
|
14
|
+
if env:
|
|
15
|
+
e.update(env)
|
|
16
|
+
p = subprocess.run([sys.executable, str(ENF), "--operation", "Write", "--args", json.dumps(args)],
|
|
17
|
+
capture_output=True, text=True, env=e, cwd=str(ENF.parents[3]))
|
|
18
|
+
return p.returncode, p.stdout
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class FilePathKeyTest(unittest.TestCase):
|
|
22
|
+
def test_opencode_filePath_is_gated(self):
|
|
23
|
+
code, out = run({"filePath": "src/newfeature.ts", "content": "export const x=1;"})
|
|
24
|
+
self.assertEqual(code, 2, out)
|
|
25
|
+
self.assertIn("route", out)
|
|
26
|
+
|
|
27
|
+
def test_claude_file_path_still_gated(self):
|
|
28
|
+
code, _ = run({"file_path": "src/newfeature.ts", "content": "x"})
|
|
29
|
+
self.assertEqual(code, 2)
|
|
30
|
+
|
|
31
|
+
def test_test_file_allowed(self):
|
|
32
|
+
code, _ = run({"filePath": "src/x.test.ts", "content": "x"})
|
|
33
|
+
self.assertEqual(code, 0)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
if __name__ == "__main__":
|
|
37
|
+
unittest.main()
|