15 lines
908 B
Python
15 lines
908 B
Python
import os,pathlib,subprocess,sys
|
|
assert os.getuid()==10000 and os.getenv('HERMES_HOME')=='/opt/data'
|
|
root=pathlib.Path('/opt/data/plugins/canina-reliability')
|
|
root.mkdir(mode=0o700,parents=True,exist_ok=True)
|
|
source=pathlib.Path(sys.argv[1])
|
|
for name in ['__init__.py','plugin.yaml']:
|
|
target=root/name
|
|
if target.exists() and target.read_bytes()!= (source/name).read_bytes(): raise RuntimeError('unmanaged plugin conflict')
|
|
target.write_bytes((source/name).read_bytes());target.chmod(0o600)
|
|
cli='/opt/hermes/bin/hermes'
|
|
for key,value in [('agent.verify_on_stop','true'),('agent.tool_use_enforcement','true'),('agent.execution_guidance','true'),('model.default','Canina-content')]:
|
|
subprocess.run([cli,'config','set',key,value],check=True)
|
|
subprocess.run([cli,'plugins','enable','canina-reliability'],check=True)
|
|
print('Scoped default reliability policy installed; gateway restart intentionally separate')
|