@miller-tech/uap 1.148.10 → 1.148.11

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miller-tech/uap",
3
- "version": "1.148.10",
3
+ "version": "1.148.11",
4
4
  "description": "Autonomous AI agent memory system with CLAUDE.md protocol enforcement",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -89,10 +89,26 @@ BROWSER_BINS = (
89
89
  # source straight into it (observed: 24 source files written to
90
90
  # .worktrees/001-space-shooter/ with no deliver run). Gating it behind the active
91
91
  # flag closes that hole.
92
+ # What stays exempt, and WHY — each is a deliberate carve-out, not an oversight:
93
+ # * agent/enforcement infrastructure (.claude/ .cursor/ .opencode/ .codex/
94
+ # .forge/ .omp/ .uap/ .policy-tools/): the hooks, plugins and enforcers that
95
+ # RUN the gate. Routing them through deliver is a bootstrap deadlock — an
96
+ # agent repairing a broken hook would need that hook to work. These are
97
+ # guarded by enforcement-self-protect (which blocks WEAKENING them) instead.
98
+ # * src/policies/, policies/: the policy definitions themselves — same
99
+ # self-reference; likewise guarded by self-protect rather than by routing.
100
+ # * test/, tests/: the deliberate fast feedback loop (deliver still verifies
101
+ # them via the gate ladder). _is_test_file() covers test files living outside
102
+ # these dirs.
103
+ #
104
+ # REMOVED 2026-07-13: "scripts/" and "docs/". Shell/Python/etc. under scripts/
105
+ # EXECUTES — it is code, so it must route through deliver and be tested like any
106
+ # other source. Exempting it left an entire language (shell) silently ungated:
107
+ # a model could put its whole implementation in scripts/ and never be validated.
92
108
  EXEMPT_PREFIXES = (
93
109
  ".claude/", ".cursor/", ".opencode/", ".codex/", ".forge/", ".omp/",
94
110
  ".uap/", ".policy-tools/",
95
- "src/policies/", "scripts/", "docs/", "policies/", "test/", "tests/",
111
+ "src/policies/", "policies/", "test/", "tests/",
96
112
  )
97
113
 
98
114
  # Test files are protected by deliver itself; never gate them here. Covers the
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env python3
2
+ """EXEMPT_PREFIXES must exempt ONLY what is genuinely un-routable.
3
+
4
+ `scripts/` and `docs/` used to be exempt — but shell/Python under scripts/ EXECUTES.
5
+ It is code, so it must route through deliver and be tested like any other source.
6
+ Exempting it left an entire language silently ungated: a model could put its whole
7
+ implementation in scripts/ and never be validated.
8
+
9
+ What remains exempt is deliberate:
10
+ * agent/enforcement infra (.uap/ .opencode/ .claude/ .policy-tools/ …) — the
11
+ hooks that RUN the gate; routing them is a bootstrap deadlock. Guarded by
12
+ enforcement-self-protect instead.
13
+ * src/policies/, policies/ — the policy definitions themselves (same self-reference).
14
+ * test/, tests/ — the deliberate fast feedback loop.
15
+ """
16
+ import json, os, subprocess, sys, unittest
17
+ from pathlib import Path
18
+
19
+ ENF = Path(__file__).resolve().parents[3] / "src" / "policies" / "enforcers" / "delivery_enforcement.py"
20
+
21
+
22
+ def run(path):
23
+ e = {**os.environ, "UAP_ENFORCE_DELIVERY": "block", "UAP_INFERENCE_ENDPOINT": "http://172.17.0.1:8080/v1"}
24
+ for k in ("UAP_DELIVER_ACTIVE", "UAP_DELIVER_BYPASS", "UAP_DELIVER_LOCAL_MODE", "UAP_DELIVER_LOCAL_ADVISORY"):
25
+ e.pop(k, None)
26
+ p = subprocess.run(
27
+ [sys.executable, str(ENF), "--operation", "Write",
28
+ "--args", json.dumps({"file_path": path, "content": "x" * 2000})],
29
+ capture_output=True, text=True, env=e, cwd=str(ENF.parents[3]),
30
+ )
31
+ return p.returncode, p.stdout
32
+
33
+
34
+ class TightenedExemptionsTest(unittest.TestCase):
35
+ def test_scripts_and_docs_are_now_GATED(self):
36
+ # These execute — they are code and must route through deliver.
37
+ for path in ("scripts/deploy.sh", "scripts/build.py", "scripts/tool.ts", "docs/example.py"):
38
+ code, out = run(path)
39
+ self.assertEqual(code, 2, f"{path} must be GATED (it is code) — got {out}")
40
+ self.assertIn("route", out, path)
41
+
42
+ def test_agent_enforcement_infra_stays_exempt(self):
43
+ # Routing the hooks that RUN the gate is a bootstrap deadlock; these are
44
+ # guarded by enforcement-self-protect, not by delivery routing.
45
+ for path in (".uap/hook.py", ".opencode/plugin.ts", ".claude/hooks/x.sh", ".policy-tools/e.py"):
46
+ code, out = run(path)
47
+ self.assertEqual(code, 0, f"{path} must stay exempt — got {out}")
48
+
49
+ def test_policy_definitions_stay_exempt(self):
50
+ for path in ("src/policies/enforcers/x.py", "policies/custom.py"):
51
+ code, out = run(path)
52
+ self.assertEqual(code, 0, f"{path} must stay exempt — got {out}")
53
+
54
+ def test_test_dirs_stay_exempt(self):
55
+ # Deliberate fast feedback loop; deliver still verifies them via the ladder.
56
+ for path in ("test/helper.ts", "tests/fixtures/data.py"):
57
+ code, out = run(path)
58
+ self.assertEqual(code, 0, f"{path} must stay exempt — got {out}")
59
+
60
+ def test_ordinary_source_still_gated(self):
61
+ code, out = run("src/app.ts")
62
+ self.assertEqual(code, 2, out)
63
+
64
+
65
+ if __name__ == "__main__":
66
+ unittest.main()
@@ -66,8 +66,15 @@ class TestDeliveryEnforcementWorktree(unittest.TestCase):
66
66
  self.assertFalse(run("src/game.js", self.root))
67
67
 
68
68
  def test_other_exemptions_intact(self):
69
+ # Agent/enforcement infra stays exempt (routing the hooks that RUN the
70
+ # gate is a bootstrap deadlock).
69
71
  self.assertTrue(run(".uap/state.js", self.root))
70
- self.assertTrue(run("scripts/build.js", self.root))
72
+ self.assertTrue(run("test/helper.js", self.root))
73
+
74
+ def test_scripts_no_longer_exempt(self):
75
+ # TIGHTENED: scripts/ executes — it is code, so it must route through
76
+ # deliver and be tested like any other source.
77
+ self.assertFalse(run("scripts/build.js", self.root))
71
78
 
72
79
  def test_bypass_override_still_works(self):
73
80
  self.assertTrue(