Compare commits
77
Commits
d8ae7ee6f6
...
V1R1C5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
128a7d9050 | ||
|
|
e8cf0f6348 | ||
|
|
786a3b6250 | ||
|
|
b9a739fd95 | ||
|
|
0fb71cd191 | ||
|
|
3b8e74bed4 | ||
|
|
9df07a5d7d | ||
|
|
54356c0fcc | ||
|
|
4b62b18a39 | ||
|
|
bb69d76a7b | ||
|
|
27eef25d12 | ||
|
|
7b563590b4 | ||
|
|
50bceb1d45 | ||
|
|
f89619f576 | ||
|
|
365ea5d06c | ||
|
|
f15a19d525 | ||
|
|
3bdb5f9d59 | ||
|
|
4a9f3fff1a | ||
|
|
ffbc1e0e01 | ||
|
|
8365afbeb8 | ||
|
|
d34ef72f5d | ||
|
|
7f118fa205 | ||
|
|
97867386a3 | ||
|
|
e17abc12be | ||
|
|
bec612c67d | ||
|
|
19bcb8aeed | ||
|
|
79e00ef089 | ||
|
|
4833b9f93a | ||
|
|
fd715457da | ||
|
|
4325f0b7d2 | ||
|
|
b2a4f67f93 | ||
|
|
c2e4a5b078 | ||
|
|
707cfe4d60 | ||
|
|
cf97cf697d | ||
|
|
82eecc27b4 | ||
|
|
bea425052f | ||
|
|
45c26a1a4a | ||
|
|
6ea5047dbb | ||
|
|
a5fdfbf057 | ||
|
|
8a5ce63069 | ||
|
|
bce254790c | ||
|
|
14a3b84fc6 | ||
|
|
39f23b0891 | ||
|
|
034d5f0faa | ||
|
|
cb6851b751 | ||
|
|
a79010f788 | ||
|
|
95b1d82738 | ||
|
|
afa5c0eb3e | ||
|
|
ca9d7a7424 | ||
|
|
890699efaa | ||
|
|
142f827feb | ||
|
|
32949d9dac | ||
|
|
4c505d2b6a | ||
|
|
d2bcf4d5af | ||
|
|
76b33c0c6a | ||
|
|
9babbcca43 | ||
|
|
c387c83c13 | ||
|
|
a9ef9197e6 | ||
|
|
54870ed375 | ||
|
|
c850858973 | ||
|
|
d08a7043d6 | ||
|
|
c393931f64 | ||
|
|
a62d4ce2c1 | ||
|
|
5a21bd5d7e | ||
|
|
ed92b88fc0 | ||
|
|
a248142158 | ||
|
|
ecf673500b | ||
|
|
43ddb91568 | ||
|
|
0b0505a645 | ||
|
|
96c00d81a9 | ||
|
|
e7d36ad706 | ||
|
|
d6cb9d1529 | ||
|
|
c06a23f4f8 | ||
|
|
568c283aff | ||
|
|
87f9150806 | ||
|
|
14fd6ee5c5 | ||
|
|
b9328d4161 |
@@ -0,0 +1,278 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from __future__ import annotations
|
||||||
|
import hashlib, hmac, json, os, re, subprocess, time, urllib.parse, uuid
|
||||||
|
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
ROOT = Path(os.getenv('AIOS_GITOPS_ROOT', '/data/aios-gitops'))
|
||||||
|
WS = Path(os.getenv('AIOS_GITOPS_WORKSPACE', str(ROOT / 'workspace')))
|
||||||
|
SECRETS = Path(os.getenv('AIOS_GITOPS_SECRETS_DIR', str(ROOT / 'runtime' / 'secrets')))
|
||||||
|
TOKEN_FILE = Path(os.getenv('AIOS_GITOPS_TOKEN_FILE', str(SECRETS / 'gitops.tokens')))
|
||||||
|
HOST = os.getenv('AIOS_GITOPS_HOST', '127.0.0.1')
|
||||||
|
PORT = int(os.getenv('AIOS_GITOPS_PORT', '18890'))
|
||||||
|
OPENAPI = WS / 'docs' / 'gitops' / 'openapi-chatgpt-actions.yaml'
|
||||||
|
BARE_REPO = Path(os.getenv('AIOS_GITOPS_BARE_REPO', str(ROOT / 'runtime' / 'gitea-bin' / 'data' / 'repositories' / 'aios' / 'aios-v23.git')))
|
||||||
|
BASE_MODELS = [
|
||||||
|
{'id':'base.deepseekv4-flash','provider':'one-api','model':'deepseekv4-flash','display_name':'DeepSeek V4 Flash','scope':'global'},
|
||||||
|
{'id':'base.qwen3.6-35b','provider':'one-api','model':'qwen3.6-35b','display_name':'Qwen 3.6 35B','scope':'global'},
|
||||||
|
{'id':'base.gpt-5.5','provider':'openai','model':'gpt-5.5','display_name':'GPT-5.5','scope':'global'},
|
||||||
|
]
|
||||||
|
SECRET_RE = re.compile(r'(?i)(api[_-]?key|secret[_-]?access[_-]?key|secret|password|token)\s*[:=]\s*["\']?([A-Za-z0-9_./+=:-]{16,})')
|
||||||
|
SECRET_VAL_RE = re.compile(r'(sk-[A-Za-z0-9_-]{20,}|HPUA[A-Z0-9]{10,}|SDC[A-Za-z0-9]{20,})')
|
||||||
|
|
||||||
|
def now() -> str: return time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime())
|
||||||
|
def uid(p='id') -> str: return f'{p}-{int(time.time()*1000)}-{uuid.uuid4().hex[:8]}'
|
||||||
|
def safe(s: str, n=160) -> str: return re.sub(r'[^A-Za-z0-9_./@-]+', '-', str(s or 'unknown')).strip('/-')[:n] or 'unknown'
|
||||||
|
def sh(args, check=False):
|
||||||
|
p = subprocess.run(['git'] + args, cwd=str(WS), text=True, capture_output=True)
|
||||||
|
if check and p.returncode != 0: raise RuntimeError(p.stderr or p.stdout or 'git failed')
|
||||||
|
return {'code':p.returncode,'stdout':p.stdout.strip(),'stderr':p.stderr.strip(),'cmd':['git']+args}
|
||||||
|
def jload(p: Path, default):
|
||||||
|
try: return json.loads(p.read_text(encoding='utf-8'))
|
||||||
|
except Exception: return default
|
||||||
|
def relpath(path: str) -> str:
|
||||||
|
x = str(path or '').replace('\\','/').strip()
|
||||||
|
if not x or x.startswith('/') or '..' in Path(x).parts or Path(x).parts[0] == '.git': raise ValueError('invalid path')
|
||||||
|
return str(Path(x))
|
||||||
|
def branch_name(name: str | None, prefix='patch/chatgpt') -> str:
|
||||||
|
b = safe(name or f'{prefix}-{uid("br")}', 180)
|
||||||
|
if b in ('main','master') or b.startswith('main/') or b.startswith('master/'): raise ValueError('direct main/master writes are forbidden')
|
||||||
|
return b
|
||||||
|
def _json_has_plain_secret(obj: Any) -> bool:
|
||||||
|
if isinstance(obj, dict):
|
||||||
|
for k, v in obj.items():
|
||||||
|
lk = str(k).lower()
|
||||||
|
if lk == 'secret_ref' or lk.endswith('_secret_ref'):
|
||||||
|
continue
|
||||||
|
if lk in {'api_key', 'access_key', 'secret_access_key', 'secret_key', 'password', 'token', 'bearer_token'}:
|
||||||
|
if isinstance(v, str) and v and not v.startswith('secret://') and v != 'REDACTED':
|
||||||
|
return True
|
||||||
|
if _json_has_plain_secret(v):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
if isinstance(obj, list):
|
||||||
|
return any(_json_has_plain_secret(x) for x in obj)
|
||||||
|
if isinstance(obj, str):
|
||||||
|
return bool(obj and not obj.startswith('secret://') and obj != 'REDACTED' and SECRET_VAL_RE.search(obj))
|
||||||
|
return False
|
||||||
|
|
||||||
|
def content_has_secret(text: str) -> bool:
|
||||||
|
text = text or ''
|
||||||
|
try:
|
||||||
|
return _json_has_plain_secret(json.loads(text))
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
if SECRET_VAL_RE.search(text):
|
||||||
|
return True
|
||||||
|
for m in SECRET_RE.finditer(text):
|
||||||
|
key = str(m.group(1)).lower()
|
||||||
|
value = str(m.group(2))
|
||||||
|
if 'secret_ref' in key or value.startswith('secret://') or value == 'REDACTED':
|
||||||
|
continue
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
def token_records():
|
||||||
|
if not TOKEN_FILE.exists(): return []
|
||||||
|
out=[]
|
||||||
|
for raw in TOKEN_FILE.read_text(encoding='utf-8').splitlines():
|
||||||
|
line=raw.strip()
|
||||||
|
if not line or line.startswith('#'): continue
|
||||||
|
if line.startswith('{'):
|
||||||
|
try: out.append(json.loads(line))
|
||||||
|
except Exception: pass
|
||||||
|
else:
|
||||||
|
out.append({'account':'legacy-token','role':'owner','scopes':['*'],'token_plain':line})
|
||||||
|
return out
|
||||||
|
def authenticate(token: str):
|
||||||
|
if os.getenv('AIOS_GITOPS_DEV_ALLOW','0') == '1': return {'account':'dev-owner','role':'owner','scopes':['*']}
|
||||||
|
if not token: return None
|
||||||
|
digest=hashlib.sha256(token.encode()).hexdigest()
|
||||||
|
for r in token_records():
|
||||||
|
if r.get('disabled'): continue
|
||||||
|
if r.get('token_sha256') and hmac.compare_digest(str(r['token_sha256']), digest): return r
|
||||||
|
if r.get('token_plain') and hmac.compare_digest(str(r['token_plain']), token): return r
|
||||||
|
return None
|
||||||
|
def sanitize(obj: Any) -> Any:
|
||||||
|
if isinstance(obj, dict):
|
||||||
|
return {k: ('REDACTED' if re.search(r'(?i)(api[_-]?key|secret|password|token)', str(k)) else sanitize(v)) for k,v in obj.items()}
|
||||||
|
if isinstance(obj, list): return [sanitize(x) for x in obj]
|
||||||
|
if isinstance(obj, str): return SECRET_VAL_RE.sub('REDACTED', obj)
|
||||||
|
return obj
|
||||||
|
def ensure_git():
|
||||||
|
if not sh(['config','user.email'])['stdout']: sh(['config','user.email','chatgpt-gitops-bot@cnnetmkt.top'], True)
|
||||||
|
if not sh(['config','user.name'])['stdout']: sh(['config','user.name','chatgpt-gitops-bot'], True)
|
||||||
|
def checkout(branch, base='main', create=False):
|
||||||
|
ensure_git(); b=branch_name(branch)
|
||||||
|
if create or sh(['rev-parse','--verify',b])['code'] != 0:
|
||||||
|
sh(['checkout',base], True); sh(['checkout','-B',b], True)
|
||||||
|
else: sh(['checkout',b], True)
|
||||||
|
return b
|
||||||
|
def write_file(path, content):
|
||||||
|
if content_has_secret(content): raise ValueError('secret_rejected: use secret_ref; plaintext API keys must not enter Git')
|
||||||
|
r=relpath(path); t=WS/r; t.parent.mkdir(parents=True, exist_ok=True); t.write_text(content, encoding='utf-8'); return r
|
||||||
|
def write_json(path, data): return write_file(path, json.dumps(data, ensure_ascii=False, indent=2) + '\n')
|
||||||
|
def sync_branch(branch: str) -> dict:
|
||||||
|
if not branch or branch in ('main','master') or branch.startswith('main/') or branch.startswith('master/'):
|
||||||
|
return {'status':'skipped','reason':'protected_branch','branch':branch}
|
||||||
|
if BARE_REPO.exists():
|
||||||
|
ref=f'refs/heads/{branch}:refs/heads/{branch}'
|
||||||
|
p=subprocess.run(['git','--git-dir',str(BARE_REPO),'fetch',str(WS),ref], text=True, capture_output=True)
|
||||||
|
if p.returncode != 0: raise RuntimeError(p.stderr or p.stdout or f'git sync failed for {branch}')
|
||||||
|
return {'status':'synced','target':'bare','branch':branch,'stdout':p.stdout.strip(),'stderr':p.stderr.strip()}
|
||||||
|
p=subprocess.run(['git','push','origin',f'HEAD:refs/heads/{branch}'], cwd=str(WS), text=True, capture_output=True)
|
||||||
|
if p.returncode != 0: raise RuntimeError(p.stderr or p.stdout or f'git push failed for {branch}')
|
||||||
|
return {'status':'synced','target':'origin','branch':branch,'stdout':p.stdout.strip(),'stderr':p.stderr.strip()}
|
||||||
|
|
||||||
|
def sync_tag(tag: str) -> dict:
|
||||||
|
if not tag: return {'status':'skipped','reason':'empty_tag'}
|
||||||
|
if BARE_REPO.exists():
|
||||||
|
ref=f'refs/tags/{tag}:refs/tags/{tag}'
|
||||||
|
p=subprocess.run(['git','--git-dir',str(BARE_REPO),'fetch',str(WS),ref], text=True, capture_output=True)
|
||||||
|
if p.returncode != 0: raise RuntimeError(p.stderr or p.stdout or f'git tag sync failed for {tag}')
|
||||||
|
return {'status':'synced','target':'bare','tag':tag,'stdout':p.stdout.strip(),'stderr':p.stderr.strip()}
|
||||||
|
p=subprocess.run(['git','push','origin',tag], cwd=str(WS), text=True, capture_output=True)
|
||||||
|
if p.returncode != 0: raise RuntimeError(p.stderr or p.stdout or f'git tag push failed for {tag}')
|
||||||
|
return {'status':'synced','target':'origin','tag':tag,'stdout':p.stdout.strip(),'stderr':p.stderr.strip()}
|
||||||
|
|
||||||
|
def commit(paths, msg):
|
||||||
|
ensure_git(); paths = [relpath(p) for p in paths] if paths else ['.']; sh(['add'] + paths, True)
|
||||||
|
branch=sh(['rev-parse','--abbrev-ref','HEAD'])['stdout']
|
||||||
|
if not sh(['status','--short'])['stdout']:
|
||||||
|
return {'status':'no_changes','branch':branch,'sync':sync_branch(branch)}
|
||||||
|
out=sh(['commit','-m',msg], True); branch=sh(['rev-parse','--abbrev-ref','HEAD'])['stdout']; sync=sync_branch(branch); return {'status':'committed','branch':branch,'rev':sh(['rev-parse','--short','HEAD'], True)['stdout'],'git':out,'sync':sync}
|
||||||
|
def audit(actor, action, target, payload):
|
||||||
|
p=ROOT/'artifacts'/'chatgpt-gitops-audit.jsonl'; p.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
with p.open('a', encoding='utf-8') as f: f.write(json.dumps({'at':now(),'actor':actor,'action':action,'target':target,'payload':sanitize(payload)}, ensure_ascii=False)+'\n')
|
||||||
|
def model_docs():
|
||||||
|
out=[]
|
||||||
|
for p in sorted((WS/'config'/'model_registry').glob('**/*.json')): out.append(jload(p, {'path':str(p.relative_to(WS))}))
|
||||||
|
return out
|
||||||
|
def patches():
|
||||||
|
out=[]
|
||||||
|
for p in sorted((WS/'patches').glob('**/*.json')): out.append(jload(p, {'path':str(p.relative_to(WS))}))
|
||||||
|
return out
|
||||||
|
|
||||||
|
class H(BaseHTTPRequestHandler):
|
||||||
|
server_version='AIOSChatGPTGitOps/V1R1C0'
|
||||||
|
def sendj(self, data, code=200):
|
||||||
|
b=json.dumps(data, ensure_ascii=False, indent=2).encode(); self.send_response(code); self.send_header('Content-Type','application/json; charset=utf-8'); self.send_header('Content-Length',str(len(b))); self.end_headers(); self.wfile.write(b)
|
||||||
|
def sendt(self, text, ctype='text/plain; charset=utf-8', code=200):
|
||||||
|
b=text.encode(); self.send_response(code); self.send_header('Content-Type',ctype); self.send_header('Content-Length',str(len(b))); self.end_headers(); self.wfile.write(b)
|
||||||
|
def body(self):
|
||||||
|
n=int(self.headers.get('Content-Length','0') or '0'); raw=self.rfile.read(n).decode() if n else '{}'
|
||||||
|
try: return json.loads(raw or '{}')
|
||||||
|
except Exception: return {'_raw':raw}
|
||||||
|
def actor(self):
|
||||||
|
auth=self.headers.get('Authorization',''); tok=auth[7:].strip() if auth.startswith('Bearer ') else self.headers.get('X-AIOS-Token','')
|
||||||
|
rec=authenticate(tok)
|
||||||
|
if rec: return {'ok':True,'account':safe(rec.get('account') or rec.get('name') or 'token-user'),'role':rec.get('role','user'),'scopes':set(rec.get('scopes') or [])}
|
||||||
|
return {'ok':False,'account':'anonymous','role':'anonymous','scopes':set()}
|
||||||
|
def need(self, scope):
|
||||||
|
a=self.actor()
|
||||||
|
if not a['ok']: self.sendj({'error':'unauthorized','hint':'Bearer token required'},401); return None
|
||||||
|
if '*' not in a['scopes'] and scope not in a['scopes']: self.sendj({'error':'forbidden','required_scope':scope,'account':a['account']},403); return None
|
||||||
|
return a
|
||||||
|
def do_GET(self):
|
||||||
|
u=urllib.parse.urlparse(self.path); path=u.path.rstrip('/') if u.path != '/' else u.path; q=urllib.parse.parse_qs(u.query)
|
||||||
|
try:
|
||||||
|
if path in ('/health','/api/health'): return self.sendj({'status':'ok','service':'chatgpt-gitops-adapter','workspace':str(WS)})
|
||||||
|
if path in ('/api/openapi.yaml','/api/openapi-chatgpt-actions.yaml','/api/schema'):
|
||||||
|
return self.sendt(OPENAPI.read_text(encoding='utf-8'), 'application/yaml; charset=utf-8') if OPENAPI.exists() else self.sendj({'error':'schema_missing'},404)
|
||||||
|
if path in ('/api','/api/status'): return self.sendj(api_spec())
|
||||||
|
if path in ('/api/base','/base'):
|
||||||
|
data=jload(WS/'baseline'/'current.json', {}); data.setdefault('git', sh(['rev-parse','--short','HEAD'])['stdout']); return self.sendj(data)
|
||||||
|
if path in ('/api/ver','/ver'):
|
||||||
|
return self.sendj({'tags':sh(['tag','--list','V*'])['stdout'].splitlines(),'versions_dir':[p.name for p in (WS/'versions').glob('*')],'head':sh(['rev-parse','--short','HEAD'])['stdout']})
|
||||||
|
if path in ('/api/diff','/diff'):
|
||||||
|
frm=(q.get('from') or ['HEAD~1'])[0]; to=(q.get('to') or ['HEAD'])[0]; return self.sendj({'from':frm,'to':to,'diff':sh(['diff',frm,to])})
|
||||||
|
if path in ('/api/patch','/patch'): return self.sendj({'patches':patches(),'branches':sh(['branch','--format','%(refname:short)'])['stdout'].splitlines()})
|
||||||
|
if path in ('/api/model','/model'): return self.sendj({'base':BASE_MODELS,'custom':model_docs(),'priority':[jload(p,{}) for p in sorted((WS/'config'/'model_priority').glob('*.json'))]})
|
||||||
|
if path in ('/api/run','/run'):
|
||||||
|
svc=subprocess.run(['systemctl','is-active','aios-gitops-model-api'], text=True, capture_output=True)
|
||||||
|
return self.sendj({'service':'aios-gitops-model-api','status':svc.stdout.strip() or svc.stderr.strip(),'workspace_branch':sh(['rev-parse','--abbrev-ref','HEAD'])['stdout']})
|
||||||
|
return self.sendj({'error':'not_found','path':path},404)
|
||||||
|
except Exception as e: return self.sendj({'error':str(e)},500)
|
||||||
|
def do_PUT(self):
|
||||||
|
path=urllib.parse.urlparse(self.path).path.rstrip('/'); data=self.body()
|
||||||
|
if path == '/api/model-priority': return self.model_priority(data)
|
||||||
|
return self.sendj({'error':'not_found','path':path},404)
|
||||||
|
def do_POST(self):
|
||||||
|
path=urllib.parse.urlparse(self.path).path.rstrip('/'); data=self.body()
|
||||||
|
try:
|
||||||
|
if path == '/api/branch': return self.branch(data)
|
||||||
|
if path == '/api/file': return self.file(data)
|
||||||
|
if path == '/api/commit': return self.commit(data)
|
||||||
|
if path == '/api/patch': return self.patch(data)
|
||||||
|
if path == '/api/tag': return self.tag(data)
|
||||||
|
if path == '/api/rollback': return self.rollback(data)
|
||||||
|
if path == '/api/model': return self.model(data)
|
||||||
|
if path == '/api/model-priority': return self.model_priority(data)
|
||||||
|
if path == '/api/nl': return self.nl(data)
|
||||||
|
return self.sendj({'error':'not_found','path':path},404)
|
||||||
|
except Exception as e: return self.sendj({'error':str(e)},500)
|
||||||
|
def branch(self,data):
|
||||||
|
a=self.need('branch:create');
|
||||||
|
if not a: return
|
||||||
|
b=checkout(data.get('branch'), data.get('base','main'), True); meta={'type':'branch','branch':b,'base':data.get('base','main'),'created_by':a['account'],'created_at':now(),'direct_main_push':False,'owner_approval_required':True}
|
||||||
|
r=write_json(f'patches/{safe(b).replace("/","_")}.branch.json', meta); c=commit([r], data.get('message') or f'chore(chatgpt): create {b}'); audit(a['account'],'branch',b,meta); self.sendj({'status':'ok','branch':b,'commit':c})
|
||||||
|
def file(self,data):
|
||||||
|
a=self.need('file:write');
|
||||||
|
if not a: return
|
||||||
|
b=checkout(data.get('branch'), data.get('base','main'), bool(data.get('create_branch'))); r=write_file(data.get('path'), data.get('content','')); c=commit([r], data.get('message') or f'chore(chatgpt): update {r}'); audit(a['account'],'file',r,{'branch':b,'commit':c}); self.sendj({'status':'committed','branch':b,'path':r,'commit':c})
|
||||||
|
def commit(self,data):
|
||||||
|
a=self.need('commit:create');
|
||||||
|
if not a: return
|
||||||
|
b=checkout(data.get('branch') or sh(['rev-parse','--abbrev-ref','HEAD'])['stdout'], data.get('base','main'), False); paths=data.get('paths') or ['.']; paths=[paths] if isinstance(paths,str) else paths; c=commit(paths, data.get('message') or 'chore(chatgpt): commit changes'); audit(a['account'],'commit',b,{'paths':paths,'commit':c}); self.sendj({'status':c['status'],'branch':b,'commit':c})
|
||||||
|
def patch(self,data):
|
||||||
|
a=self.need('patch:create');
|
||||||
|
if not a: return
|
||||||
|
name=data.get('patch_name') or data.get('name') or uid('patch'); b=checkout(data.get('branch') or f'patch/{safe(name)}', data.get('base','main'), True); meta={'id':uid('patch'),'patch_name':name,'branch':b,'risk':data.get('risk','medium'),'description':data.get('description',''),'created_by':a['account'],'created_at':now()}
|
||||||
|
r=write_json(f'patches/{safe(name)}.json', meta); c=commit([r], data.get('message') or f'chore(chatgpt): create patch {name}'); audit(a['account'],'patch',name,meta); self.sendj({'status':'patch_branch_created','patch':meta,'commit':c})
|
||||||
|
def tag(self,data):
|
||||||
|
a=self.need('tag:create');
|
||||||
|
if not a: return
|
||||||
|
ver=data.get('version') or data.get('tag')
|
||||||
|
if not re.match(r'^V\d+R\d+C\d+(-[A-Za-z0-9_.-]+)?$', ver or ''): return self.sendj({'error':'version must match VxRxCx'},400)
|
||||||
|
if a['role'] != 'owner' or not data.get('execute'):
|
||||||
|
b=checkout(data.get('branch') or f'request/tag-{safe(ver)}', 'main', True); req={'version':ver,'requested_by':a['account'],'approval_required':True,'created_at':now()}; r=write_json(f'baseline/tag_requests/{safe(ver)}.json', req); c=commit([r], f'chore(chatgpt): request tag {ver}'); return self.sendj({'status':'approval_required','branch':b,'commit':c})
|
||||||
|
out=sh(['tag','-a',ver,'-m',data.get('message') or f'release {ver}'], True); self.sendj({'status':'tagged','version':ver,'git':out,'sync':sync_tag(ver)})
|
||||||
|
def rollback(self,data):
|
||||||
|
a=self.need('rollback:request');
|
||||||
|
if not a: return
|
||||||
|
target=data.get('target_version') or data.get('version') or data.get('target')
|
||||||
|
if not target: return self.sendj({'error':'target_version required'},400)
|
||||||
|
b=checkout(data.get('branch') or f'request/rollback-{safe(target)}-{uid("rb")}', 'main', True); req={'id':uid('rollback'),'target_version':target,'reason':data.get('reason',''),'requested_by':a['account'],'approval_required':True,'execute':False,'created_at':now()}; r=write_json(f'baseline/rollback_requests/{safe(req["id"])}.json', req); c=commit([r], f'chore(chatgpt): request rollback {target}'); self.sendj({'status':'rollback_request_committed','branch':b,'request':req,'commit':c})
|
||||||
|
def model(self,data):
|
||||||
|
a=self.need('model:write');
|
||||||
|
if not a: return
|
||||||
|
name=data.get('model_name') or data.get('model'); base=(data.get('base_url') or '').rstrip('/'); prov=data.get('provider_name') or 'custom-provider'
|
||||||
|
if not name or not base: return self.sendj({'error':'provider_name/base_url/model_name required'},400)
|
||||||
|
owner=safe(data.get('username') or a['account']); secret_ref=data.get('api_key_secret_ref') or data.get('secret_ref')
|
||||||
|
if data.get('api_key'):
|
||||||
|
d=SECRETS/'llm'/owner; d.mkdir(parents=True, exist_ok=True); sid=uid('llmkey'); p=d/f'{sid}.secret'; p.write_text(str(data['api_key']), encoding='utf-8'); os.chmod(p,0o600); secret_ref=f'secret://llm/{owner}/{sid}'
|
||||||
|
if not secret_ref: return self.sendj({'error':'api_key_secret_ref or api_key required'},400)
|
||||||
|
mid=data.get('model_id') or f'custom.{owner}.{hashlib.sha1((prov+base+name).encode()).hexdigest()[:10]}'; b=checkout(data.get('branch') or f'patch/model-{safe(mid)}','main',True)
|
||||||
|
doc=sanitize({k:v for k,v in data.items() if k!='api_key'}); doc.update({'model_id':mid,'provider_name':prov,'base_url':base,'model_name':name,'api_key_secret_ref':secret_ref,'created_by':a['account'],'created_at':now()})
|
||||||
|
r=write_json(f'config/model_registry/chatgpt/{safe(mid)}.json', doc); c=commit([r], data.get('message') or f'chore(chatgpt): register model {name}'); audit(a['account'],'model',mid,doc); self.sendj({'status':'model_registered','branch':b,'model_id':mid,'secret_ref':secret_ref,'commit':c})
|
||||||
|
def model_priority(self,data):
|
||||||
|
a=self.need('model:priority');
|
||||||
|
if not a: return
|
||||||
|
user=safe(data.get('username') or a['account']); b=checkout(data.get('branch') or f'patch/model-priority-{user}', 'main', True); doc={'username':user,'items':data.get('items') or data.get('priority') or [],'updated_by':a['account'],'updated_at':now()}; r=write_json(f'config/model_priority/{user}.json', doc); c=commit([r], data.get('message') or f'chore(chatgpt): update model priority {user}'); audit(a['account'],'model-priority',user,doc); self.sendj({'status':'updated','branch':b,'priority':doc,'commit':c})
|
||||||
|
def nl(self,data):
|
||||||
|
a=self.need('nl:plan');
|
||||||
|
if not a: return
|
||||||
|
text=data.get('text',''); low=text.lower(); intent='unknown'; plan=[]
|
||||||
|
if 'rollback' in low or '回滚' in text: intent='rollback_request'; plan=['commit rollback request','wait owner/admin approval']
|
||||||
|
elif 'diff' in low or '对比' in text: intent='diff'; plan=['call GET /api/diff']
|
||||||
|
elif 'model' in low or '模型' in text: intent='model_change'; plan=['use POST /api/model or PUT /api/model-priority','commit metadata']
|
||||||
|
elif 'patch' in low or '补丁' in text: intent='patch_create'; plan=['call POST /api/patch']
|
||||||
|
b=checkout(data.get('branch') or f'patch/nl-{uid("nl")}', 'main', True); doc={'id':uid('nl'),'text':text,'intent':intent,'action_plan':plan,'execute':False,'owner_approval_required':True,'created_by':a['account'],'created_at':now()}; r=write_json(f'patches/nl/{safe(doc["id"])}.json', doc); c=commit([r], f'chore(chatgpt): record nl plan {intent}'); self.sendj({'status':'planned','branch':b,'request':doc,'commit':c})
|
||||||
|
|
||||||
|
def api_spec():
|
||||||
|
return {'version':'V1R1C0-chatgpt-actions','openapi':'/api/openapi.yaml','read':['GET /api/base','GET /api/ver','GET /api/diff','GET /api/patch','GET /api/model','GET /api/run'],'write':['POST /api/branch','POST /api/file','POST /api/commit','POST /api/patch','POST /api/tag','POST /api/rollback','POST /api/model','PUT /api/model-priority','POST /api/nl'],'policy':{'bearer_required_for_write':True,'direct_main_push':False,'delete_tag':False,'owner_approval_required_for_v_level':True,'api_keys_in_git':False,'git_secret_field':'secret_ref','online_git_sync':True}}
|
||||||
|
|
||||||
|
def main():
|
||||||
|
print(f'AIOS ChatGPT GitOps adapter listening on {HOST}:{PORT}')
|
||||||
|
ThreadingHTTPServer((HOST,PORT), H).serve_forever()
|
||||||
|
if __name__ == '__main__': main()
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
# Agent Instruction Center
|
||||||
|
|
||||||
|
Version-controlled execution instructions for AIOS agents.
|
||||||
|
|
||||||
|
## Supported agents
|
||||||
|
|
||||||
|
- codex
|
||||||
|
- openclaw
|
||||||
|
- hermes
|
||||||
|
- windows_codex_app
|
||||||
|
- custom_gpt_review
|
||||||
|
|
||||||
|
## Workflow
|
||||||
|
|
||||||
|
1. Create versioned instruction file.
|
||||||
|
2. Target agent executes instruction.
|
||||||
|
3. Result is recorded with GitOps audit information.
|
||||||
|
|
||||||
|
## Naming
|
||||||
|
|
||||||
|
agent-instructions/<agent>/<instruction-name>-v<version>.md
|
||||||
|
|
||||||
|
## Rules
|
||||||
|
|
||||||
|
- GitOps managed only.
|
||||||
|
- Patch-first workflow.
|
||||||
|
- No secrets, tokens, passwords or credentials.
|
||||||
|
- Production changes require approval.
|
||||||
|
- Main branch changes require approval.
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# Agent Execution Instruction
|
||||||
|
|
||||||
|
Instruction ID:
|
||||||
|
Version:
|
||||||
|
Target Agent:
|
||||||
|
|
||||||
|
## Objective
|
||||||
|
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
|
||||||
|
## Execution Steps
|
||||||
|
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
|
||||||
|
- GitOps only
|
||||||
|
- Patch-first
|
||||||
|
- No secrets
|
||||||
|
- No force push
|
||||||
|
- Production changes require approval
|
||||||
|
|
||||||
|
## Validation
|
||||||
|
|
||||||
|
|
||||||
|
## Return Format
|
||||||
|
|
||||||
|
Status:
|
||||||
|
Branch:
|
||||||
|
Commit:
|
||||||
|
Rev:
|
||||||
|
Sync Status:
|
||||||
|
Issues:
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Placeholder for versioned Codex instructions.
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
# Codex Execution Instruction
|
||||||
|
|
||||||
|
Instruction ID: fix-reports-permission-v1
|
||||||
|
Version: v1
|
||||||
|
Target Agent: codex
|
||||||
|
|
||||||
|
## Objective
|
||||||
|
Fix the GitOps workspace reports directory permission issue so the Agent OS acceptance report can be committed.
|
||||||
|
|
||||||
|
## Context
|
||||||
|
Current blocked path:
|
||||||
|
|
||||||
|
/data/aios-gitops/workspace/reports/
|
||||||
|
|
||||||
|
Error:
|
||||||
|
|
||||||
|
Permission denied
|
||||||
|
|
||||||
|
## Execution Steps
|
||||||
|
|
||||||
|
1. Enter workspace:
|
||||||
|
|
||||||
|
cd /data/aios-gitops/workspace
|
||||||
|
|
||||||
|
2. Check current user and permissions:
|
||||||
|
|
||||||
|
whoami
|
||||||
|
id
|
||||||
|
ls -ld reports
|
||||||
|
|
||||||
|
3. Create directory if missing:
|
||||||
|
|
||||||
|
mkdir -p reports
|
||||||
|
|
||||||
|
4. Fix ownership and write permission for this directory only:
|
||||||
|
|
||||||
|
chown -R <gitops-user>:<gitops-group> reports
|
||||||
|
chmod -R u+rwX reports
|
||||||
|
|
||||||
|
5. Verify write access:
|
||||||
|
|
||||||
|
touch reports/.write-test
|
||||||
|
rm reports/.write-test
|
||||||
|
|
||||||
|
6. Commit pending acceptance report changes after verification.
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
|
||||||
|
- GitOps only.
|
||||||
|
- No force push.
|
||||||
|
- No chmod 777.
|
||||||
|
- Do not modify unrelated directories.
|
||||||
|
- Do not write secrets.
|
||||||
|
- Production changes require approval.
|
||||||
|
|
||||||
|
## Validation
|
||||||
|
|
||||||
|
Return:
|
||||||
|
|
||||||
|
Status:
|
||||||
|
Branch:
|
||||||
|
Commit:
|
||||||
|
Rev:
|
||||||
|
Sync Status:
|
||||||
|
Permission Result:
|
||||||
|
Issues:
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# Codex System Recovery Instruction
|
||||||
|
|
||||||
|
Version: v1
|
||||||
|
Target Agent: codex
|
||||||
|
|
||||||
|
## Objective
|
||||||
|
Recover AIOS system issues requiring deep diagnosis or administrator assistance.
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
1. Inspect runtime status.
|
||||||
|
2. Inspect GitOps state.
|
||||||
|
3. Identify root cause.
|
||||||
|
4. Propose safe patch.
|
||||||
|
5. Apply only approved GitOps changes.
|
||||||
|
|
||||||
|
## Escalation
|
||||||
|
Use when server agents cannot resolve issues.
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
- GitOps only.
|
||||||
|
- No secrets.
|
||||||
|
- No force push.
|
||||||
|
- Production changes require approval.
|
||||||
|
|
||||||
|
## Return
|
||||||
|
Status:
|
||||||
|
Branch:
|
||||||
|
Commit:
|
||||||
|
Rev:
|
||||||
|
Sync Status:
|
||||||
|
Issues:
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# Codex Main Merge Verification Instruction
|
||||||
|
|
||||||
|
Instruction ID: v1r1c5-main-merge-verify-v1
|
||||||
|
Version: v1
|
||||||
|
Target Agent: codex
|
||||||
|
|
||||||
|
## Objective
|
||||||
|
Verify whether V1R1C5 patch branch has been merged into main.
|
||||||
|
|
||||||
|
## Preconditions
|
||||||
|
|
||||||
|
Ensure GitOps authentication is healthy.
|
||||||
|
If Gitea account password state blocks access, resolve account activation through approved admin procedure before continuing.
|
||||||
|
|
||||||
|
## Verification Steps
|
||||||
|
|
||||||
|
1. Check repository status.
|
||||||
|
2. Fetch remote branches.
|
||||||
|
3. Compare:
|
||||||
|
|
||||||
|
source:
|
||||||
|
patch/self-evolution-agent-orchestration-policy
|
||||||
|
|
||||||
|
target:
|
||||||
|
main
|
||||||
|
|
||||||
|
4. Confirm merge commit.
|
||||||
|
5. Confirm main HEAD.
|
||||||
|
6. Confirm no divergence.
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
|
||||||
|
- No force push.
|
||||||
|
- No direct production publish.
|
||||||
|
- No secret output.
|
||||||
|
- Preserve audit trail.
|
||||||
|
|
||||||
|
## Return Format
|
||||||
|
|
||||||
|
Status:
|
||||||
|
Source Branch:
|
||||||
|
Target Branch:
|
||||||
|
Merge Commit:
|
||||||
|
Rev:
|
||||||
|
Sync Status:
|
||||||
|
Conflicts:
|
||||||
|
Main HEAD:
|
||||||
|
Issues:
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Placeholder for versioned custom GPT review instructions.
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# Custom GPT Solution Review Instruction
|
||||||
|
|
||||||
|
Version: v1
|
||||||
|
Target Agent: custom_gpt_review
|
||||||
|
|
||||||
|
## Objective
|
||||||
|
Review difficult architecture decisions and implementation proposals from server agents.
|
||||||
|
|
||||||
|
## Role
|
||||||
|
Act as reviewer and advisor for OpenClaw, Hermes and other AIOS agents.
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
1. Receive complete problem context.
|
||||||
|
2. Review baseline, branch and proposed changes.
|
||||||
|
3. Analyze alternative solutions.
|
||||||
|
4. Recommend implementation approach.
|
||||||
|
5. Identify risks and validation requirements.
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
- Advisory role only.
|
||||||
|
- No direct production changes.
|
||||||
|
- No secrets.
|
||||||
|
- GitOps workflow required.
|
||||||
|
- Release requires approval.
|
||||||
|
|
||||||
|
## Return
|
||||||
|
Status:
|
||||||
|
Recommendation:
|
||||||
|
Risk:
|
||||||
|
Validation:
|
||||||
|
Next Step:
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Placeholder for versioned Hermes instructions.
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
# Hermes Architecture Review Instruction
|
||||||
|
|
||||||
|
Version: v1
|
||||||
|
Target Agent: hermes
|
||||||
|
|
||||||
|
## Objective
|
||||||
|
Review AIOS architecture, policies and implementation plans.
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
1. Review baseline and branch diff.
|
||||||
|
2. Analyze architecture impact.
|
||||||
|
3. Review OpenClaw execution proposals.
|
||||||
|
4. Validate acceptance criteria.
|
||||||
|
5. Provide improvement recommendations.
|
||||||
|
|
||||||
|
## Escalation
|
||||||
|
For unresolved architecture choices, prepare complete context for external review.
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
- GitOps only.
|
||||||
|
- No secrets.
|
||||||
|
- No direct production changes.
|
||||||
|
- Approval required for release.
|
||||||
|
|
||||||
|
## Return
|
||||||
|
Status:
|
||||||
|
Branch:
|
||||||
|
Commit:
|
||||||
|
Rev:
|
||||||
|
Sync Status:
|
||||||
|
Issues:
|
||||||
|
Recommendations:
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Placeholder for versioned OpenClaw instructions.
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
# OpenClaw Agent Instructions Index
|
||||||
|
|
||||||
|
## Available Instructions
|
||||||
|
|
||||||
|
### v1r1c5-hermes-coordination-v1
|
||||||
|
|
||||||
|
Instruction file:
|
||||||
|
|
||||||
|
agent-instructions/openclaw/v1r1c5-hermes-coordination-v1.md
|
||||||
|
|
||||||
|
Purpose:
|
||||||
|
|
||||||
|
Coordinate Hermes architecture review through OpenClaw controlled communication channel.
|
||||||
|
|
||||||
|
Invocation:
|
||||||
|
|
||||||
|
Execute openclaw/v1r1c5-hermes-coordination-v1 instruction
|
||||||
|
|
||||||
|
Requirements:
|
||||||
|
|
||||||
|
- Read the referenced markdown file from the GitOps workspace.
|
||||||
|
- Do not treat the identifier as a local shell command.
|
||||||
|
- Do not search external skill marketplaces unless the file is missing.
|
||||||
|
- Follow GitOps workflow rules defined in the instruction.
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
# OpenClaw Runtime Maintenance Instruction
|
||||||
|
|
||||||
|
Version: v1
|
||||||
|
Target Agent: openclaw
|
||||||
|
|
||||||
|
## Objective
|
||||||
|
Maintain server-side AIOS runtime and perform safe optimization tasks.
|
||||||
|
|
||||||
|
## Execution
|
||||||
|
1. Check runtime health.
|
||||||
|
2. Review logs and GitOps status.
|
||||||
|
3. Identify optimization opportunities.
|
||||||
|
4. Create patch proposals.
|
||||||
|
5. Execute approved changes.
|
||||||
|
|
||||||
|
## Escalation
|
||||||
|
When solution selection or implementation is uncertain, prepare full context and escalate for review.
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
- GitOps only.
|
||||||
|
- Patch-first workflow.
|
||||||
|
- No secrets.
|
||||||
|
- No force push.
|
||||||
|
- Production release requires approval.
|
||||||
|
|
||||||
|
## Return
|
||||||
|
Status:
|
||||||
|
Branch:
|
||||||
|
Commit:
|
||||||
|
Rev:
|
||||||
|
Sync Status:
|
||||||
|
Issues:
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
# OpenClaw Execution Instruction: Hermes Coordination
|
||||||
|
|
||||||
|
Instruction ID: v1r1c5-hermes-coordination-v1
|
||||||
|
Version: v1
|
||||||
|
Target Agent: openclaw
|
||||||
|
|
||||||
|
## Objective
|
||||||
|
|
||||||
|
Coordinate Hermes architecture review through OpenClaw-controlled communication channel.
|
||||||
|
|
||||||
|
## Architecture Rule
|
||||||
|
|
||||||
|
Hermes is not directly connected to external control channels.
|
||||||
|
All Hermes requests and responses must be routed through OpenClaw personal WeChat channel.
|
||||||
|
|
||||||
|
## Workflow
|
||||||
|
|
||||||
|
1. Receive AIOS task or review request.
|
||||||
|
2. Send required context to Hermes through OpenClaw WeChat.
|
||||||
|
3. Collect Hermes architecture analysis.
|
||||||
|
4. Record review result in GitOps reports.
|
||||||
|
5. Continue execution or escalate when required.
|
||||||
|
|
||||||
|
## Context Package
|
||||||
|
|
||||||
|
Include:
|
||||||
|
|
||||||
|
- Baseline version
|
||||||
|
- Branch
|
||||||
|
- Diff summary
|
||||||
|
- Problem description
|
||||||
|
- Proposed solution
|
||||||
|
- Validation requirements
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
|
||||||
|
- GitOps only.
|
||||||
|
- No secrets.
|
||||||
|
- No direct production changes.
|
||||||
|
- Maintain audit records.
|
||||||
|
- Use escalation flow for unresolved decisions.
|
||||||
|
|
||||||
|
## Return Format
|
||||||
|
|
||||||
|
Status:
|
||||||
|
Branch:
|
||||||
|
Commit:
|
||||||
|
Rev:
|
||||||
|
Sync Status:
|
||||||
|
Hermes Result:
|
||||||
|
Issues:
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
# OpenClaw Execution Instruction
|
||||||
|
|
||||||
|
Instruction ID: v1r1c5-hermes-review-improvement-v1
|
||||||
|
Version: v1
|
||||||
|
Target Agent: openclaw
|
||||||
|
|
||||||
|
## Objective
|
||||||
|
|
||||||
|
Implement V1R1C5 improvements based on Hermes Conditional Approval review.
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
Baseline:
|
||||||
|
V1R1C4
|
||||||
|
|
||||||
|
Branch:
|
||||||
|
patch/self-evolution-agent-orchestration-policy
|
||||||
|
|
||||||
|
Proposal:
|
||||||
|
V1R1C5-agent-os-evolution-proposal
|
||||||
|
|
||||||
|
## Required Changes
|
||||||
|
|
||||||
|
1. Add Agent Resource Governance:
|
||||||
|
|
||||||
|
Create:
|
||||||
|
config/self-evolution/agent-resource-manager.json
|
||||||
|
|
||||||
|
Support:
|
||||||
|
- resource limits
|
||||||
|
- parallel task limits
|
||||||
|
- agent priority
|
||||||
|
- runtime isolation
|
||||||
|
- overload handling
|
||||||
|
|
||||||
|
2. Enhance Consensus Engine:
|
||||||
|
|
||||||
|
Add dynamic weighting:
|
||||||
|
|
||||||
|
Final Weight = Base Weight * Quality Score * Historical Reliability * Domain Expertise
|
||||||
|
|
||||||
|
Base weights:
|
||||||
|
- custom_gpt: 2
|
||||||
|
- windows_codex: 2
|
||||||
|
- server_agent: 1
|
||||||
|
|
||||||
|
Add risk gates:
|
||||||
|
- Production Release
|
||||||
|
- V-Level Change
|
||||||
|
- Security Policy Change
|
||||||
|
|
||||||
|
Require:
|
||||||
|
Consensus Approval + Owner Approval
|
||||||
|
|
||||||
|
3. Enhance Message Bus:
|
||||||
|
|
||||||
|
Update runtime/agent-os/message_bus.py
|
||||||
|
|
||||||
|
Add:
|
||||||
|
- task_id
|
||||||
|
- correlation_id
|
||||||
|
- retry_state
|
||||||
|
- delivery_status
|
||||||
|
|
||||||
|
Support:
|
||||||
|
- message tracking
|
||||||
|
- retry
|
||||||
|
- recovery
|
||||||
|
- audit
|
||||||
|
|
||||||
|
4. Add Agent Health Score:
|
||||||
|
|
||||||
|
Create:
|
||||||
|
runtime/agent-os/agent_health_score.py
|
||||||
|
|
||||||
|
Calculate from:
|
||||||
|
- quality score
|
||||||
|
- acceptance rate
|
||||||
|
- historical reliability
|
||||||
|
|
||||||
|
Use for:
|
||||||
|
- scheduler selection
|
||||||
|
- consensus weighting
|
||||||
|
|
||||||
|
## Validation
|
||||||
|
|
||||||
|
Run:
|
||||||
|
python3 -m compileall runtime/agent-os
|
||||||
|
|
||||||
|
Run:
|
||||||
|
runtime/agent-os/integration_test.py
|
||||||
|
|
||||||
|
Validate:
|
||||||
|
- scheduler
|
||||||
|
- consensus
|
||||||
|
- message bus
|
||||||
|
- escalation
|
||||||
|
- recovery
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
|
||||||
|
- GitOps only
|
||||||
|
- Patch-first
|
||||||
|
- No secrets
|
||||||
|
- No force push
|
||||||
|
- No direct main write
|
||||||
|
- Production changes require approval
|
||||||
|
|
||||||
|
## Return Format
|
||||||
|
|
||||||
|
Status:
|
||||||
|
Branch:
|
||||||
|
Commit:
|
||||||
|
Rev:
|
||||||
|
Sync Status:
|
||||||
|
Changed Files:
|
||||||
|
Tests:
|
||||||
|
Hermes Review Items Completed:
|
||||||
|
Remaining Issues:
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
# OpenClaw Hermes Routing Correction Instruction
|
||||||
|
|
||||||
|
Instruction ID: v1r1c5-hermes-routing-correction-v1
|
||||||
|
Version: v1
|
||||||
|
Target Agent: openclaw
|
||||||
|
|
||||||
|
## Objective
|
||||||
|
Correct Hermes coordination routing. OpenClaw must actively package AIOS review requests and route them through the configured Hermes communication path instead of asking the user to provide missing context when the request context already exists in GitOps.
|
||||||
|
|
||||||
|
## Current Architecture
|
||||||
|
|
||||||
|
OpenClaw is the coordination entry point.
|
||||||
|
Hermes is reached indirectly through OpenClaw controlled communication.
|
||||||
|
|
||||||
|
## Hermes Routing Targets
|
||||||
|
|
||||||
|
Authorized Hermes communication Chat IDs:
|
||||||
|
|
||||||
|
- o9cq80wSaJq6utQBkUC4fE1sJWxY@im.wechat
|
||||||
|
- o9cq80x9RoA6ljoFZDxg71mS0gDA@im.wechat
|
||||||
|
|
||||||
|
## Execution Flow
|
||||||
|
|
||||||
|
1. Read current AIOS GitOps context.
|
||||||
|
2. Collect:
|
||||||
|
- Baseline version
|
||||||
|
- Branch
|
||||||
|
- Diff summary
|
||||||
|
- Problem description
|
||||||
|
- Proposed solution
|
||||||
|
- Validation requirements
|
||||||
|
3. Send complete review package to Hermes through configured OpenClaw communication channel.
|
||||||
|
4. Receive Hermes analysis.
|
||||||
|
5. Record review result in GitOps reports.
|
||||||
|
|
||||||
|
## Current Review Context
|
||||||
|
|
||||||
|
Baseline:
|
||||||
|
V1R1C4
|
||||||
|
|
||||||
|
Branch:
|
||||||
|
patch/self-evolution-agent-orchestration-policy
|
||||||
|
|
||||||
|
Proposal:
|
||||||
|
V1R1C5-agent-os-evolution-proposal
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
|
||||||
|
- Do not ask user for context that already exists in GitOps.
|
||||||
|
- Do not treat instruction ID as external skill package.
|
||||||
|
- GitOps audit required.
|
||||||
|
- No secrets.
|
||||||
|
- No direct production changes.
|
||||||
|
|
||||||
|
## Return
|
||||||
|
|
||||||
|
Status:
|
||||||
|
Hermes Routing:
|
||||||
|
Review Context:
|
||||||
|
Result:
|
||||||
|
Issues:
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
# OpenClaw Owner Approval Gate Instruction
|
||||||
|
|
||||||
|
Instruction ID: v1r1c5-owner-approval-gate-v1
|
||||||
|
Version: v1
|
||||||
|
Target Agent: openclaw
|
||||||
|
|
||||||
|
## Objective
|
||||||
|
|
||||||
|
Manage owner approval workflow for high-risk AIOS operations.
|
||||||
|
|
||||||
|
## Approval Required For
|
||||||
|
|
||||||
|
- V-level version changes.
|
||||||
|
- Production release.
|
||||||
|
- Tag creation.
|
||||||
|
- Runtime changes with production impact.
|
||||||
|
- Administrator authorization actions.
|
||||||
|
- Unresolved multi-agent decisions.
|
||||||
|
|
||||||
|
## Workflow
|
||||||
|
|
||||||
|
1. Collect approval context.
|
||||||
|
2. Include baseline version, branch, diff summary and risk assessment.
|
||||||
|
3. Route approval request through owner communication channel registry.
|
||||||
|
4. Wait for approval decision.
|
||||||
|
5. Record decision in GitOps audit.
|
||||||
|
|
||||||
|
## Approval Context
|
||||||
|
|
||||||
|
Must include:
|
||||||
|
|
||||||
|
- Request reason.
|
||||||
|
- Affected components.
|
||||||
|
- Validation results.
|
||||||
|
- Rollback considerations.
|
||||||
|
- Risk level.
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
|
||||||
|
- No direct production action without approval.
|
||||||
|
- No secrets in messages or reports.
|
||||||
|
- Use configured owner communication channels only.
|
||||||
|
- Maintain audit records.
|
||||||
|
|
||||||
|
## Return Format
|
||||||
|
|
||||||
|
Status:
|
||||||
|
Approval Status:
|
||||||
|
Channel Used:
|
||||||
|
Decision:
|
||||||
|
Audit Record:
|
||||||
|
Issues:
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
# OpenClaw Owner Notification Routing Instruction
|
||||||
|
|
||||||
|
Instruction ID: v1r1c5-owner-notification-routing-v1
|
||||||
|
Version: v1
|
||||||
|
Target Agent: openclaw
|
||||||
|
|
||||||
|
## Objective
|
||||||
|
|
||||||
|
Implement owner notification routing through configured owner communication channels.
|
||||||
|
|
||||||
|
## Routing Rules
|
||||||
|
|
||||||
|
1. OpenClaw must first inspect the owner-bound communication channels already configured in the system.
|
||||||
|
2. Select the primary owner communication channel according to system priority configuration.
|
||||||
|
3. If the primary channel is unavailable, unhealthy, or delivery fails, automatically fallback to the configured backup communication channel.
|
||||||
|
4. Record routing decision and delivery status in GitOps audit records.
|
||||||
|
|
||||||
|
## Notification Scenarios
|
||||||
|
|
||||||
|
Notify owner for:
|
||||||
|
|
||||||
|
- High risk architecture decisions.
|
||||||
|
- Agent consensus deadlock.
|
||||||
|
- Production-impacting approval requests.
|
||||||
|
- Required administrator authorization.
|
||||||
|
- Release approval gates.
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
|
||||||
|
- Do not hardcode personal communication identifiers in instruction files.
|
||||||
|
- Use configured channel registry only.
|
||||||
|
- Do not expose private contact information in logs.
|
||||||
|
- Maintain audit trail.
|
||||||
|
- GitOps workflow required.
|
||||||
|
|
||||||
|
## Return Format
|
||||||
|
|
||||||
|
Status:
|
||||||
|
Primary Channel Status:
|
||||||
|
Fallback Channel Status:
|
||||||
|
Delivery Result:
|
||||||
|
Audit Record:
|
||||||
|
Issues:
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Placeholder for versioned Windows Codex App instructions.
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# Windows Codex App Execution Instruction
|
||||||
|
|
||||||
|
Instruction ID: v1r1c5-recovery-and-admin-assistance-v1
|
||||||
|
Version: v1
|
||||||
|
Target Agent: windows_codex_app
|
||||||
|
|
||||||
|
## Objective
|
||||||
|
|
||||||
|
Participate in V1R1C5 Agent OS evolution as recovery, administrator assistance and exceptional execution support agent.
|
||||||
|
|
||||||
|
## Responsibilities
|
||||||
|
|
||||||
|
1. Assist when server OpenClaw agents have runtime failures.
|
||||||
|
2. Assist when Hermes review cannot be completed through OpenClaw.
|
||||||
|
3. Handle cases requiring administrator authorization workflow.
|
||||||
|
4. Participate in multi-agent voting when decision conflicts occur.
|
||||||
|
5. Validate recovery results after server agent restoration.
|
||||||
|
|
||||||
|
## Execution Rules
|
||||||
|
|
||||||
|
- Work from online GitOps versions.
|
||||||
|
- Use patch-first workflow.
|
||||||
|
- Do not bypass approval gates.
|
||||||
|
- Do not write secrets.
|
||||||
|
- Do not force push.
|
||||||
|
- Do not directly publish production versions.
|
||||||
|
|
||||||
|
## Recovery Flow
|
||||||
|
|
||||||
|
Server agent failure:
|
||||||
|
|
||||||
|
OpenClaw/Hermes issue
|
||||||
|
-> Windows Codex diagnosis
|
||||||
|
-> propose fix
|
||||||
|
-> GitOps patch
|
||||||
|
-> validation
|
||||||
|
-> approval
|
||||||
|
|
||||||
|
## Return Format
|
||||||
|
|
||||||
|
Status:
|
||||||
|
Branch:
|
||||||
|
Commit:
|
||||||
|
Rev:
|
||||||
|
Sync Status:
|
||||||
|
Recovery Result:
|
||||||
|
Issues:
|
||||||
+68
-8
@@ -1,20 +1,20 @@
|
|||||||
{
|
{
|
||||||
"active_version": "V1R1C0",
|
"active_version": "V1R1C4",
|
||||||
"active_tag": "V1R1C0-baseline-20260706",
|
"active_tag": "V1R1C4",
|
||||||
"mode": "gitops-online",
|
"mode": "gitops-online",
|
||||||
"version_policy": "VxRxCx",
|
"version_policy": "VxRxCx",
|
||||||
"update_mode": "git_patch_only",
|
"update_mode": "git_patch_only",
|
||||||
"zip_update_deprecated": true,
|
"zip_update_deprecated": true,
|
||||||
"entry": "https://cnnetmkt.top",
|
"entry": "https://cnnetmkt.top",
|
||||||
"links": {
|
"links": {
|
||||||
"git": "/git",
|
"git": "https://g.cnnetmkt.top/git/aios/aios-v23",
|
||||||
"baseline": "/base",
|
"baseline": "/base",
|
||||||
"versions": "/ver",
|
"versions": "/ver",
|
||||||
"diff": "/diff",
|
"diff": "/diff",
|
||||||
"patch": "/patch",
|
"patch": "/patch",
|
||||||
"model": "/model",
|
"model": "/model",
|
||||||
"runtime": "/run",
|
"runtime": "/run",
|
||||||
"api": "/api",
|
"api": "https://cnnetmkt.top/api",
|
||||||
"hook": "/hook"
|
"hook": "/hook"
|
||||||
},
|
},
|
||||||
"features": {
|
"features": {
|
||||||
@@ -23,16 +23,18 @@
|
|||||||
"custom_llm": true,
|
"custom_llm": true,
|
||||||
"user_model_priority": true,
|
"user_model_priority": true,
|
||||||
"chatgpt_rw": true,
|
"chatgpt_rw": true,
|
||||||
"codex_rw": true
|
"codex_rw": true,
|
||||||
|
"portal_gitops_dashboard": true,
|
||||||
|
"human_shortlinks_login_required": true
|
||||||
},
|
},
|
||||||
"version": "V1R1C0",
|
"version": "V1R1C4",
|
||||||
"baseline_tag": "V1R1C0-baseline-20260706",
|
"baseline_tag": "V1R1C0-baseline-20260706",
|
||||||
"source": "AIOS_V1R1C0_MULTIUSER_GITOPS_CUSTOM_LLM_PROD_FULL_DEPLOY_20260706.zip",
|
"source": "AIOS_V1R1C0_MULTIUSER_GITOPS_CUSTOM_LLM_PROD_FULL_DEPLOY_20260706.zip",
|
||||||
"source_package": "AIOS_V1R1C0_MULTIUSER_GITOPS_CUSTOM_LLM_PROD_FULL_DEPLOY_20260706.zip",
|
"source_package": "AIOS_V1R1C0_MULTIUSER_GITOPS_CUSTOM_LLM_PROD_FULL_DEPLOY_20260706.zip",
|
||||||
"zip_update_mode": "deprecated",
|
"zip_update_mode": "deprecated",
|
||||||
"chatgpt_access": true,
|
"chatgpt_access": true,
|
||||||
"codex_access": true,
|
"codex_access": true,
|
||||||
"git_url": "https://cnnetmkt.top/git/aios/aios-v23.git",
|
"git_url": "https://g.cnnetmkt.top/git/aios/aios-v23.git",
|
||||||
"short_links": [
|
"short_links": [
|
||||||
"/git",
|
"/git",
|
||||||
"/base",
|
"/base",
|
||||||
@@ -44,5 +46,63 @@
|
|||||||
"/api",
|
"/api",
|
||||||
"/hook"
|
"/hook"
|
||||||
],
|
],
|
||||||
"updated_at": "2026-07-06T07:16:01.842497+00:00"
|
"updated_at": "2026-07-06T11:16:23Z",
|
||||||
|
"auth": {
|
||||||
|
"primary_domain": "https://auth.cnnetmkt.top",
|
||||||
|
"backup_domain": "https://auth.h.imruyi.top:8443",
|
||||||
|
"primary_user_entry": "https://cnnetmkt.top/",
|
||||||
|
"primary_callback": "https://cnnetmkt.top/casdoor/callback/",
|
||||||
|
"casdoor_application": "admin/aios-portal",
|
||||||
|
"backup_domain_role": "standby-only"
|
||||||
|
},
|
||||||
|
"previous_version": "V1R1C3",
|
||||||
|
"codex_gitops": {
|
||||||
|
"config": "config/codex/gitops-online.json",
|
||||||
|
"token_account": "codex-gitops-bot",
|
||||||
|
"token_ref": "secret_ref://aios-gitops/runtime/codex-gitops-bot",
|
||||||
|
"direct_main_push": false,
|
||||||
|
"all_writes_require_git_commit": true,
|
||||||
|
"api_keys_in_git": false,
|
||||||
|
"online_git_sync": true,
|
||||||
|
"bare_repo": "/data/aios-gitops/runtime/gitea-bin/data/repositories/aios/aios-v23.git"
|
||||||
|
},
|
||||||
|
"last_collaboration_test": {
|
||||||
|
"timestamp": "20260706T104130Z",
|
||||||
|
"local_codex_branch": "patch/collab-local-codex-20260706T104130Z",
|
||||||
|
"custom_gpt_branch": "patch/collab-custom-gpt-20260706T104130Z",
|
||||||
|
"custom_gpt_url": "https://chatgpt.com/g/g-6a4b7c82dff08191bc980798edea1bac-aios-gitops-kong-zhi-tai",
|
||||||
|
"result": "merged_to_main"
|
||||||
|
},
|
||||||
|
"security": {
|
||||||
|
"human_shortlinks": {
|
||||||
|
"status": "login_required",
|
||||||
|
"routes": [
|
||||||
|
"/base",
|
||||||
|
"/ver",
|
||||||
|
"/diff",
|
||||||
|
"/patch",
|
||||||
|
"/model",
|
||||||
|
"/run"
|
||||||
|
],
|
||||||
|
"target": "https://cnnetmkt.top/portal/me/#gitops",
|
||||||
|
"machine_api": "https://cnnetmkt.top/api"
|
||||||
|
},
|
||||||
|
"gitea": {
|
||||||
|
"web": "https://g.cnnetmkt.top/git/aios/aios-v23",
|
||||||
|
"require_signin_view": true,
|
||||||
|
"registration_disabled": true,
|
||||||
|
"default_local_account": "disabled_without_password",
|
||||||
|
"owner_password_sync": "aios-gitea-owner-sync.timer",
|
||||||
|
"owner_password_source": "secret_ref://aios/user-control-center/UCC_OWNER_PASSWORD"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"last_auth_portal_fix": {
|
||||||
|
"version": "V1R1C4",
|
||||||
|
"timestamp": "2026-07-06T11:16:23Z",
|
||||||
|
"shortlinks": "redirect_to_login_protected_portal_gitops_section",
|
||||||
|
"gitea_owner_sync": "enabled",
|
||||||
|
"portal_overlay": "overlays/user-control-center",
|
||||||
|
"portal_baseline_cache": "/app/runtime/gitops/current.json",
|
||||||
|
"sync_log_secret_hygiene": "runuser_without_sudo_command_logging"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
# 20260706 Auth GitOps Portal Hardening
|
||||||
|
|
||||||
|
Version: V1R1C4
|
||||||
|
Previous: V1R1C3
|
||||||
|
Timestamp: 2026-07-06T11:05:30Z
|
||||||
|
|
||||||
|
## User-visible fixes
|
||||||
|
|
||||||
|
- Human shortlinks no longer expose baseline/model/run JSON without portal login.
|
||||||
|
- The cnnetmkt portal has a visible GitOps section for owner/admin users.
|
||||||
|
- Gitea is served from `https://g.cnnetmkt.top/git/` and repository browsing requires login.
|
||||||
|
- Gitea `owner` password is synchronized from the cnnetmkt owner account secret.
|
||||||
|
- The default local Gitea account password is removed and direct login is disabled.
|
||||||
|
|
||||||
|
## Files
|
||||||
|
|
||||||
|
- `deploy/nginx/aios-gitops-locations.conf`
|
||||||
|
- `deploy/gitea-binary/app.ini.template`
|
||||||
|
- `deploy/systemd/aios-gitea-owner-sync.service`
|
||||||
|
- `deploy/systemd/aios-gitea-owner-sync.timer`
|
||||||
|
- `ops/gitops-migration/sync_gitea_owner_password.sh`
|
||||||
|
- `ops/gitops-migration/apply_user_portal_gitops_overlay.sh`
|
||||||
|
- `overlays/user-control-center/control/portal_views.py`
|
||||||
|
- `overlays/user-control-center/templates/portal/me.html`
|
||||||
|
- `baseline/current.json`
|
||||||
|
- `config/codex/gitops-online.json`
|
||||||
|
- `versions/V1R1C4.json`
|
||||||
|
- `docs/release/AIOS_V1R1C4_AUTH_GITOPS_PORTAL.md`
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
Docker image rebuild was not required for the live fix. The runtime source and running container were patched, and the exact overlay has been added to GitOps so a later image rebuild can reproduce the change.
|
||||||
|
|
||||||
|
## Secret Log Hygiene
|
||||||
|
|
||||||
|
The Gitea owner password sync script uses `runuser` instead of `sudo -u ... --password ...`, strips CRLF from sourced owner fields, and does not print passwords or tokens. Archived journal files were rotated/vacuumed after the live script was corrected.
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
# 20260706 ChatGPT Actions GitOps Access
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
Implemented a controlled ChatGPT Actions adapter for the AIOS online GitOps baseline under https://cnnetmkt.top/api.
|
||||||
|
|
||||||
|
## Access Model
|
||||||
|
|
||||||
|
- Public read APIs: /api/base, /api/ver, /api/diff, /api/patch, /api/model, /api/run.
|
||||||
|
- Bearer-token write APIs: /api/branch, /api/file, /api/commit, /api/patch, /api/tag, /api/rollback, /api/model, /api/model-priority, /api/nl.
|
||||||
|
- chatgpt-gitops-bot is scoped for branch/file/commit/patch/model/rollback-request/NL plan operations.
|
||||||
|
- Direct main writes are rejected by the adapter.
|
||||||
|
- V-level owner/admin actions are represented as approval request commits unless an owner executes them.
|
||||||
|
- Custom LLM API keys are stored outside Git under runtime secrets; committed model records store only secret_ref.
|
||||||
|
|
||||||
|
## Files
|
||||||
|
|
||||||
|
- ctive-runtime/app/aios_chatgpt_actions_api.py
|
||||||
|
- docs/gitops/openapi-chatgpt-actions.yaml
|
||||||
|
- deploy/systemd/aios-gitops-model-api.service
|
||||||
|
- scripts/package_contract_check_v1r1c0.sh
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
|
||||||
|
See /data/aios-gitops/artifacts/CHATGPT_ACCESS_ACCEPTANCE.md after live deployment.
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# 20260706 cnnetmkt auth primary route fix
|
||||||
|
|
||||||
|
## Problem
|
||||||
|
|
||||||
|
`https://cnnetmkt.top/` could be opened, but login redirected users to `https://auth.h.imruyi.top:8443`. Casdoor then rejected the OAuth request because `https://cnnetmkt.top/casdoor/callback/` was not in the application allow-list.
|
||||||
|
|
||||||
|
`*.h.imruyi.top:8443` is retained as a backup domain only and must not be exposed as the primary public login URL.
|
||||||
|
|
||||||
|
## Runtime Changes
|
||||||
|
|
||||||
|
- Added `auth.cnnetmkt.top` Nginx server block on `hw.imruyi.top` using the wildcard `cnnetmkt.top` certificate.
|
||||||
|
- Proxied `auth.cnnetmkt.top` to the existing backup/home Casdoor upstream `auth.h.imruyi.top:8443` while preserving the public host as `auth.cnnetmkt.top`.
|
||||||
|
- Recreated `user-control-web`, `user-control-worker`, and `user-control-beat` with:
|
||||||
|
- `CASDOOR_PUBLIC_BASE_URL=https://auth.cnnetmkt.top`
|
||||||
|
- `CASDOOR_INTERNAL_BASE_URL=https://auth.cnnetmkt.top`
|
||||||
|
- `CASDOOR_INVITE_SYNC_BASE_URL=https://auth.cnnetmkt.top`
|
||||||
|
- `UCC_PUBLIC_BASE_URL=https://cnnetmkt.top`
|
||||||
|
- Updated Casdoor application `admin/aios-portal` on `aihost` to include `https://cnnetmkt.top/casdoor/callback/` and keep user/portal/backup callbacks.
|
||||||
|
|
||||||
|
## Backups
|
||||||
|
|
||||||
|
- Casdoor DB application table backup: `/data/aios/backups/casdoor-cnnetmkt-primary-20260706T085445Z/application-before.sql`
|
||||||
|
- HW UCC/Nginx backup directory: `/data/aios-gitops/backups/auth-cnnetmkt-primary-*`
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
|
||||||
|
- `https://cnnetmkt.top/` redirects to `/portal/login/` and then to `https://auth.cnnetmkt.top/login/oauth/authorize?...redirect_uri=https%3A%2F%2Fcnnetmkt.top%2Fcasdoor%2Fcallback%2F...`.
|
||||||
|
- `https://auth.cnnetmkt.top/login/oauth/authorize?...` returns HTTP 200 from the Casdoor SPA through the HW Nginx proxy.
|
||||||
|
- `user-control-web` health returned `healthy` after recreation.
|
||||||
|
- Casdoor DB readback contains `https://cnnetmkt.top/casdoor/callback/` in `application.redirect_uris`.
|
||||||
|
|
||||||
|
## Follow-up
|
||||||
|
|
||||||
|
Run `ops/gitops-migration/check_cnnetmkt_auth_primary.sh` after any domain, Nginx, or Casdoor application change.
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# 20260706 Codex and Custom GPT Collaboration
|
||||||
|
|
||||||
|
## Change
|
||||||
|
|
||||||
|
Validated coordinated online GitOps changes from local Codex and the AIOS GitOps 控制台 custom GPT path. Promoted the merged result to `V1R1C3`.
|
||||||
|
|
||||||
|
## Evidence Branches
|
||||||
|
|
||||||
|
- `patch/collab-local-codex-20260706T104130Z` -> `a62d4ce` (codex-gitops-bot, sync=synced)
|
||||||
|
- `patch/collab-custom-gpt-20260706T104130Z` -> `c393931` (chatgpt-gitops-bot, sync=synced)
|
||||||
|
|
||||||
|
## Result
|
||||||
|
|
||||||
|
`/api/base` should report `V1R1C3` after this release commit is synchronized.
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# 20260706 Codex Online Git Branch Sync
|
||||||
|
|
||||||
|
## Change
|
||||||
|
|
||||||
|
Promoted the online GitOps configuration to `V1R1C2` and enabled automatic synchronization of committed non-main API/Codex branches to the Gitea bare repository.
|
||||||
|
|
||||||
|
## Reason
|
||||||
|
|
||||||
|
Codex writes must be visible through the online Git service, not only in the local workspace clone.
|
||||||
|
|
||||||
|
## Guardrails
|
||||||
|
|
||||||
|
- `main` and `master` are skipped by API branch sync.
|
||||||
|
- Direct main writes remain forbidden by branch validation.
|
||||||
|
- Tags are synchronized only in the owner direct tag execution path.
|
||||||
|
- Tokens and LLM API keys remain outside Git.
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# 20260706 Codex Online GitOps Version Management
|
||||||
|
|
||||||
|
## Change
|
||||||
|
|
||||||
|
Configured Codex to use the AIOS online Git baseline for version management and promoted the current controlled access changes to `V1R1C1`.
|
||||||
|
|
||||||
|
## Files
|
||||||
|
|
||||||
|
- `config/codex/gitops-online.json`
|
||||||
|
- `docs/gitops/CODEX_ONLINE_VERSION_MANAGEMENT.md`
|
||||||
|
- `docs/gitops/CHATGPT_CODEX_ACCESS.md`
|
||||||
|
- `docs/release/AIOS_V1R1C1_CODEX_GITOPS_RELEASE.md`
|
||||||
|
- `versions/V1R1C1.json`
|
||||||
|
- `baseline/current.json`
|
||||||
|
- `scripts/codex_gitops_online_check.sh`
|
||||||
|
|
||||||
|
## Merge Policy
|
||||||
|
|
||||||
|
Production `main` includes the ChatGPT/Codex GitOps API, schema, service configuration, contract checks, and secret-ref fix. Acceptance dummy model branches are retained as audit branches and not merged into production.
|
||||||
|
|
||||||
|
## Secret Policy
|
||||||
|
|
||||||
|
`codex-gitops-bot` plaintext token is stored only under `/data/aios-gitops/runtime/secrets/`; Git stores only `secret_ref` and token account metadata.
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
{
|
||||||
|
"profile": "aios-v23-online-gitops",
|
||||||
|
"mode": "gitops-online",
|
||||||
|
"version": "V1R1C4",
|
||||||
|
"previous_version": "V1R1C3",
|
||||||
|
"repository": {
|
||||||
|
"workspace": "/data/aios-gitops/workspace",
|
||||||
|
"remote": "origin",
|
||||||
|
"url": "https://g.cnnetmkt.top/git/aios/aios-v23.git",
|
||||||
|
"web": "https://g.cnnetmkt.top/git/aios/aios-v23",
|
||||||
|
"protected_branches": [
|
||||||
|
"main"
|
||||||
|
],
|
||||||
|
"patch_branch_prefixes": [
|
||||||
|
"patch/",
|
||||||
|
"codex/patch/",
|
||||||
|
"request/"
|
||||||
|
],
|
||||||
|
"bare_repo": "/data/aios-gitops/runtime/gitea-bin/data/repositories/aios/aios-v23.git",
|
||||||
|
"sync_mode": "workspace_commit_to_online_bare_repo",
|
||||||
|
"public_portal": "https://cnnetmkt.top/portal/me/#gitops"
|
||||||
|
},
|
||||||
|
"api": {
|
||||||
|
"base_url": "https://cnnetmkt.top/api",
|
||||||
|
"openapi_schema": "https://cnnetmkt.top/api/openapi-chatgpt-actions.yaml",
|
||||||
|
"local_schema": "/data/aios-gitops/workspace/docs/gitops/openapi-chatgpt-actions.yaml",
|
||||||
|
"token_account": "codex-gitops-bot",
|
||||||
|
"token_ref": "secret_ref://aios-gitops/runtime/codex-gitops-bot"
|
||||||
|
},
|
||||||
|
"policy": {
|
||||||
|
"zip_update_deprecated": true,
|
||||||
|
"update_mode": "git_patch_only",
|
||||||
|
"all_writes_require_git_commit": true,
|
||||||
|
"direct_main_push": false,
|
||||||
|
"delete_tag": false,
|
||||||
|
"v_level_owner_admin_approval_required": true,
|
||||||
|
"api_keys_in_git": false,
|
||||||
|
"api_keys_in_logs": false,
|
||||||
|
"custom_llm_secret_storage": "runtime_secret_ref_only",
|
||||||
|
"online_git_sync": true,
|
||||||
|
"human_shortlinks_login_required": true,
|
||||||
|
"gitea_require_signin_view": true,
|
||||||
|
"gitea_default_local_account_disabled": true,
|
||||||
|
"owner_password_sync_secret_ref_only": true
|
||||||
|
},
|
||||||
|
"workflow": [
|
||||||
|
"create patch branch from main",
|
||||||
|
"commit every file/config/script change",
|
||||||
|
"push or sync branch to online Git service",
|
||||||
|
"review diff and run smoke checks",
|
||||||
|
"merge to main only after owner/admin approval",
|
||||||
|
"tag VxRxCx release and update baseline/current.json"
|
||||||
|
],
|
||||||
|
"created_at": "2026-07-06T10:21:08Z",
|
||||||
|
"base_commit_before_release": "43ddb91",
|
||||||
|
"updated_at": "2026-07-06T11:16:23Z",
|
||||||
|
"last_collaboration_test": {
|
||||||
|
"timestamp": "20260706T104130Z",
|
||||||
|
"result": "local_codex_and_custom_gpt_patches_merged"
|
||||||
|
},
|
||||||
|
"last_auth_portal_fix": {
|
||||||
|
"version": "V1R1C4",
|
||||||
|
"timestamp": "2026-07-06T11:16:23Z",
|
||||||
|
"shortlink_routes": [
|
||||||
|
"/base",
|
||||||
|
"/ver",
|
||||||
|
"/diff",
|
||||||
|
"/patch",
|
||||||
|
"/model",
|
||||||
|
"/run"
|
||||||
|
],
|
||||||
|
"gitea_sync_service": "aios-gitea-owner-sync.service",
|
||||||
|
"gitea_sync_timer": "aios-gitea-owner-sync.timer",
|
||||||
|
"portal_overlay": "overlays/user-control-center",
|
||||||
|
"portal_baseline_cache": "/app/runtime/gitops/current.json",
|
||||||
|
"sync_log_secret_hygiene": "runuser_without_sudo_command_logging"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
AIOS_PUBLIC_DOMAIN=https://cnnetmkt.top
|
AIOS_PUBLIC_DOMAIN=https://cnnetmkt.top
|
||||||
|
AIOS_USER_DOMAIN=https://user.cnnetmkt.top
|
||||||
|
AIOS_AUTH_DOMAIN=https://auth.cnnetmkt.top
|
||||||
|
AIOS_AUTH_BACKUP_DOMAIN=https://auth.h.imruyi.top:8443
|
||||||
|
AIOS_CASDOOR_PRIMARY_CALLBACK=https://cnnetmkt.top/casdoor/callback/
|
||||||
AIOS_WEBOPS_DOMAIN=https://ops.cnnetmkt.top
|
AIOS_WEBOPS_DOMAIN=https://ops.cnnetmkt.top
|
||||||
AIOS_API_DOMAIN=https://api.cnnetmkt.top
|
AIOS_API_DOMAIN=https://api.cnnetmkt.top
|
||||||
AIOS_WECHAT_CALLBACK_DOMAIN=https://wechat.cnnetmkt.top
|
AIOS_WECHAT_CALLBACK_DOMAIN=https://wechat.cnnetmkt.top
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema":"acceptance-pipeline-v1","status":"proposal","pipeline":{"stages":[{"name":"code_review","agent_role":"review_agent"},{"name":"automated_test","agent_role":"test_agent"},{"name":"security_check","agent_role":"security_agent"},{"name":"performance_check","agent_role":"performance_agent"},{"name":"regression_check","agent_role":"regression_agent"},{"name":"release_readiness","agent_role":"release_readiness_agent"}],"parallel_validation":true,"failure_blocks_release":true},"outputs":{"quality_score":true,"risk_report":true,"approval_request":true},"safety":{"production_release_requires_owner":true,"credentials_scan":true,"audit_log":true}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema":"agent-governance-v1","status":"proposal","governance":{"identity":true,"reputation":true,"capability_discovery":true,"memory_service":true,"shared_knowledge":true,"skill_packages":true,"peer_review":true,"acceptance_pipeline":["optimization","implementation","acceptance","security","release_readiness"],"dynamic_voting":{"enabled":true,"base_weights":{"custom_gpt":2,"windows_codex":2,"server_agents":1},"quality_score_modifier":true},"audit":{"full_trace":true,"decision_log":true}},"release":{"patch_only":true,"owner_approval_required":true}}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
"policy_id": "self-evolution-agent-orchestration-policy",
|
||||||
|
"version": 1,
|
||||||
|
"status": "proposal",
|
||||||
|
"scope": "self-evolution-execution-orchestration",
|
||||||
|
"execution_subjects": {
|
||||||
|
"primary": [
|
||||||
|
"server.openclaw_agent",
|
||||||
|
"server.hermes_agent"
|
||||||
|
],
|
||||||
|
"collaborators": [
|
||||||
|
"windows.codex_app",
|
||||||
|
"custom_gpt.codex_chartgpt_bridge"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"parallelism": {
|
||||||
|
"server_agents_parallel_allowed": true,
|
||||||
|
"multiple_server_agents_allowed": true,
|
||||||
|
"server_agents_preferred": true
|
||||||
|
},
|
||||||
|
"fallback_and_assistance": {
|
||||||
|
"difficult_case_external_interaction_allowed": true,
|
||||||
|
"assistance_endpoint": "https://chatgpt.com/g/g-6a4ba70a063c8191a89bc2d86a4c7fa0-codex-chartgpt-bridge",
|
||||||
|
"allowed_modes": [
|
||||||
|
"ask_for_help",
|
||||||
|
"interactive_coordination",
|
||||||
|
"proposal_review"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dispute_resolution": {
|
||||||
|
"multi_agent_voting_allowed": true,
|
||||||
|
"weights": {
|
||||||
|
"custom_gpt.codex_chartgpt_bridge": 2,
|
||||||
|
"windows.codex_app": 2,
|
||||||
|
"server.openclaw_agent": 1,
|
||||||
|
"server.hermes_agent": 1,
|
||||||
|
"server.additional_agent_default": 1
|
||||||
|
},
|
||||||
|
"tie_breaking": "require_owner_or_admin_review"
|
||||||
|
},
|
||||||
|
"safety": {
|
||||||
|
"credentials_in_git_allowed": false,
|
||||||
|
"force_push_allowed": false,
|
||||||
|
"destructive_bulk_delete_allowed": false,
|
||||||
|
"v_level_change_requires_owner_approval": true,
|
||||||
|
"production_switch_requires_owner_approval": true,
|
||||||
|
"tag_creation_requires_owner_approval": true,
|
||||||
|
"v_level_tag_or_production_switch_requires_owner_approval": true,
|
||||||
|
"direct_main_push_allowed": false,
|
||||||
|
"direct_main_merge_allowed": false
|
||||||
|
},
|
||||||
|
"gitops": {
|
||||||
|
"audit_required": true,
|
||||||
|
"writes_require_commit": true,
|
||||||
|
"default_target_branch": "patch/self-evolution-agent-orchestration-policy",
|
||||||
|
"direct_main_push_default": false,
|
||||||
|
"patch_branch_only": true,
|
||||||
|
"main_merge_requires_owner_admin_approval": true
|
||||||
|
},
|
||||||
|
"created_by": "codex-chartgpt-bridge",
|
||||||
|
"created_at": "2026-07-07T00:00:00Z",
|
||||||
|
"branch": "patch/self-evolution-agent-orchestration-policy"
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema":"agent-os-v1","status":"proposal","agents":{"openclaw":{"memory":true,"skills":true,"tools":true,"planner":true,"evaluator":true,"self_reflection":true,"learning":true},"hermes":{"memory":true,"skills":true,"tools":true,"planner":true,"evaluator":true,"self_reflection":true,"learning":true}},"coordination":{"voting":true,"weighted_voting":{"custom_gpt":2,"windows_codex":2,"server_agents":1},"owner_review_on_tie":true},"safety":{"gitops_only":true,"patch_first":true,"no_credentials":true,"no_direct_main":true}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema":"agent-platform-v1","status":"proposal","modules":[{"name":"memory-manager","enabled":true},{"name":"skill-registry","enabled":true},{"name":"agent-registry","enabled":true},{"name":"task-scheduler","enabled":true},{"name":"consensus-engine","enabled":true},{"name":"continuous-self-evolution","enabled":true}],"release_policy":{"patch_first":true,"owner_approval":true}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema":"agent-protocol-v1","status":"proposal","agent_identity":{"id":"string","name":"string","family":"openclaw|hermes|custom","version":"string","capabilities":[],"skills":[],"health":"unknown|healthy|degraded|offline"},"task_protocol":{"task_id":"string","requester":"agent_id","executor":"agent_id","objective":"string","priority":"low|normal|high|critical","status":"queued|running|completed|failed|review","result":"object"},"memory_protocol":{"memory_id":"string","type":"experience|knowledge|decision|reflection","scope":"agent|shared","audit":true},"voting_protocol":{"enabled":true,"proposal":"string","votes":[],"weighted":true,"tie":"owner_review"},"security":{"credentials":false,"direct_main_write":false,"production_action_approval":true}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema":"agent-runtime-components-v1","status":"proposal","components":{"agent-runtime-manager":{"enabled":true,"responsibilities":["lifecycle_management","health_check","recovery","resource_tracking"]},"agent-registry":{"enabled":true,"responsibilities":["identity","capability_discovery","status_tracking","version_tracking"]},"message-bus":{"enabled":true,"responsibilities":["task_routing","event_delivery","agent_coordination"]},"memory-service":{"enabled":true,"responsibilities":["long_term_memory","working_memory","knowledge_retrieval","audit"]},"skill-loader":{"enabled":true,"responsibilities":["skill_installation","skill_validation","skill_versioning"]},"agent-evaluator":{"enabled":true,"responsibilities":["quality_score","acceptance_check","performance_feedback"]}},"security":{"credential_storage":false,"gitops_audit":true,"patch_only":true}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema":"consensus-engine-v1","status":"proposal","consensus":{"enabled":true,"modes":["weighted_vote","review_board","owner_escalation"],"participants":["openclaw_agent","hermes_agent","windows_codex","custom_gpt"],"base_weights":{"custom_gpt":2,"windows_codex":2,"server_agents":1},"dynamic_adjustment":{"enabled":true,"factors":["quality_score","acceptance_rate","historical_reliability"]},"conflict_detection":true,"tie_breaking":"owner_admin_review"},"decision_log":{"required":true,"audit":true},"safety":{"production_decision_requires_approval":true}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema":"continuous-evolution-engine-v1","status":"proposal","pipeline":{"monitor":true,"detect":true,"plan":true,"schedule":true,"execute":true,"learn":true},"workflow":{"detect_sources":["runtime_metrics","logs","acceptance_results","agent_feedback","user_requests"],"proposal_generation":true,"patch_generation":true,"validation_required":true,"consensus_required":true,"approval_gate":true,"release_feedback":true},"agents":{"optimizer":"system_optimization_agent","planner":"planning_agent","executor":"patch_execution_agent","validator":"acceptance_validation_agent","reviewer":"consensus_engine"},"learning":{"store_experience":true,"update_quality_score":true,"reflection_required":true},"safety":{"gitops_only":true,"patch_first":true,"credentials":false,"production_requires_approval":true}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema":"agent-platform-implementation-v1","status":"proposal","objective":"evolve-agent-platform-from-configuration-to-operational-framework","implementation_phases":[{"phase":1,"name":"agent-runtime-manager","scope":["agent lifecycle","health check","startup shutdown","recovery"]},{"phase":2,"name":"agent-message-bus","scope":["agent communication","task routing","event coordination"]},{"phase":3,"name":"memory-service","scope":["long term memory","working memory","shared knowledge retrieval","audit"]},{"phase":4,"name":"skill-framework","scope":["skill packages","versioning","installation","validation"]},{"phase":5,"name":"agent-api","scope":["agent registration","capability discovery","task submission","status query"]},{"phase":6,"name":"continuous-evolution-pipeline","scope":["proposal generation","patch creation","automated validation","approval workflow"]}],"constraints":{"gitops_only":true,"patch_first":true,"no_credentials":true,"no_force_push":true,"production_release_requires_approval":true}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema":"agent-memory-v1","status":"proposal","memory_types":{"working_memory":{"ttl":"task_scope","audit":true},"long_term_memory":{"persistent":true,"scope":"agent"},"shared_knowledge":{"persistent":true,"scope":"platform"},"reflection_memory":{"persistent":true,"purpose":"self_improvement"}},"memory_entry":{"id":"string","agent_id":"string","type":"working|experience|knowledge|decision|reflection","content":"object","source_task":"string","created_at":"timestamp","quality_score":0},"safety":{"credentials":false,"secrets":false,"audit_required":true}}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"schema": "owner-channel-registry-v1",
|
||||||
|
"status": "proposal",
|
||||||
|
"purpose": "Owner notification channel routing and fallback management",
|
||||||
|
"routing": {
|
||||||
|
"primary_selection": "configured_priority",
|
||||||
|
"fallback_enabled": true,
|
||||||
|
"health_check_required": true,
|
||||||
|
"delivery_failure_fallback": true
|
||||||
|
},
|
||||||
|
"channel_policy": {
|
||||||
|
"identifiers_managed_externally": true,
|
||||||
|
"no_hardcoded_personal_identifiers": true,
|
||||||
|
"audit_delivery_result": true
|
||||||
|
},
|
||||||
|
"notification_priority": [
|
||||||
|
"production_approval",
|
||||||
|
"administrator_authorization",
|
||||||
|
"high_risk_decision",
|
||||||
|
"agent_consensus_failure"
|
||||||
|
],
|
||||||
|
"security": {
|
||||||
|
"credentials_in_git": false,
|
||||||
|
"private_contact_data_in_logs": false
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema":"release-automation-v1","status":"proposal","release_flow":{"patch_review":true,"acceptance_gate":true,"consensus_gate":true,"approval_request":true,"version_proposal":true,"tag_request":true},"agents":{"release_manager":"release_readiness_agent","reviewers":["openclaw_agent","hermes_agent","custom_gpt","windows_codex_app"]},"controls":{"auto_tag":false,"auto_production_publish":false,"owner_approval_required":true,"audit_log":true},"rollback":{"request_supported":true,"automatic_destructive_rollback":false}}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
{
|
||||||
|
"policy_id": "server-agent-roles-and-capabilities",
|
||||||
|
"version": 1,
|
||||||
|
"status": "proposal",
|
||||||
|
"scope": "self-evolution-server-agents",
|
||||||
|
"agent_families": {
|
||||||
|
"openclaw": {
|
||||||
|
"enabled": true,
|
||||||
|
"runtime": "server",
|
||||||
|
"priority": "primary",
|
||||||
|
"roles": [
|
||||||
|
"system_optimization_agent",
|
||||||
|
"acceptance_validation_agent",
|
||||||
|
"patch_execution_agent",
|
||||||
|
"runtime_diagnosis_agent",
|
||||||
|
"regression_review_agent"
|
||||||
|
],
|
||||||
|
"persistent_memory": {
|
||||||
|
"enabled": true,
|
||||||
|
"scope": "agent_family_and_role",
|
||||||
|
"storage": "runtime_or_gitops_managed_memory",
|
||||||
|
"credentials_in_memory_allowed": false,
|
||||||
|
"audit_required": true
|
||||||
|
},
|
||||||
|
"skills": {
|
||||||
|
"enabled": true,
|
||||||
|
"skill_registry": "config/self-evolution/skills/openclaw-skills.json",
|
||||||
|
"required_skill_groups": [
|
||||||
|
"gitops_patch_workflow",
|
||||||
|
"system_optimization",
|
||||||
|
"acceptance_testing",
|
||||||
|
"runtime_observability",
|
||||||
|
"safe_release_review"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"hermes": {
|
||||||
|
"enabled": true,
|
||||||
|
"runtime": "server",
|
||||||
|
"priority": "primary",
|
||||||
|
"roles": [
|
||||||
|
"system_optimization_agent",
|
||||||
|
"acceptance_validation_agent",
|
||||||
|
"release_readiness_agent",
|
||||||
|
"policy_review_agent",
|
||||||
|
"cross_agent_coordination_agent"
|
||||||
|
],
|
||||||
|
"persistent_memory": {
|
||||||
|
"enabled": true,
|
||||||
|
"scope": "agent_family_and_role",
|
||||||
|
"storage": "runtime_or_gitops_managed_memory",
|
||||||
|
"credentials_in_memory_allowed": false,
|
||||||
|
"audit_required": true
|
||||||
|
},
|
||||||
|
"skills": {
|
||||||
|
"enabled": true,
|
||||||
|
"skill_registry": "config/self-evolution/skills/hermes-skills.json",
|
||||||
|
"required_skill_groups": [
|
||||||
|
"gitops_patch_workflow",
|
||||||
|
"acceptance_testing",
|
||||||
|
"release_readiness",
|
||||||
|
"policy_governance",
|
||||||
|
"multi_agent_coordination"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"role_contracts": {
|
||||||
|
"system_optimization_agent": {
|
||||||
|
"purpose": "Identify and propose safe system optimization patches.",
|
||||||
|
"may_write_patch": true,
|
||||||
|
"may_modify_runtime": false,
|
||||||
|
"requires_review_for_production": true
|
||||||
|
},
|
||||||
|
"acceptance_validation_agent": {
|
||||||
|
"purpose": "Run and record acceptance checks for GitOps changes.",
|
||||||
|
"may_write_patch": true,
|
||||||
|
"may_approve_own_change": false,
|
||||||
|
"requires_review_for_production": true
|
||||||
|
},
|
||||||
|
"patch_execution_agent": {
|
||||||
|
"purpose": "Apply approved or proposed patch changes on non-main branches.",
|
||||||
|
"may_write_patch": true,
|
||||||
|
"direct_main_push_allowed": false
|
||||||
|
},
|
||||||
|
"release_readiness_agent": {
|
||||||
|
"purpose": "Evaluate whether a patch is ready for owner/admin release approval.",
|
||||||
|
"may_create_release_request": true,
|
||||||
|
"may_create_tag_directly": false,
|
||||||
|
"may_switch_production_directly": false
|
||||||
|
},
|
||||||
|
"cross_agent_coordination_agent": {
|
||||||
|
"purpose": "Coordinate voting, conflict resolution, and escalation among agents.",
|
||||||
|
"voting_allowed": true,
|
||||||
|
"tie_breaking": "owner_or_admin_review"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"online_capabilities": {
|
||||||
|
"read_online_baseline": true,
|
||||||
|
"read_online_versions": true,
|
||||||
|
"read_online_diff": true,
|
||||||
|
"read_online_runtime": true,
|
||||||
|
"create_patch_branch": true,
|
||||||
|
"commit_patch_changes": true,
|
||||||
|
"sync_online_git": true,
|
||||||
|
"create_release_request": true,
|
||||||
|
"direct_tag_creation": false,
|
||||||
|
"direct_production_publish": false
|
||||||
|
},
|
||||||
|
"safety": {
|
||||||
|
"credentials_in_git_allowed": false,
|
||||||
|
"credentials_in_memory_allowed": false,
|
||||||
|
"force_push_allowed": false,
|
||||||
|
"destructive_bulk_delete_allowed": false,
|
||||||
|
"owner_admin_approval_required_for_release": true
|
||||||
|
},
|
||||||
|
"created_by": "codex-chartgpt-bridge",
|
||||||
|
"created_at": "2026-07-07T00:00:00Z"
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema":"agent-skill-package-v1","status":"proposal","skill_package":{"id":"string","name":"string","version":"string","description":"string","owner_agent":"agent_id","dependencies":[],"capabilities":[],"entrypoints":[],"validation":{"required":true,"tests":[],"quality_score":0}},"lifecycle":{"install":true,"upgrade":true,"rollback":true,"disable":true},"sharing":{"agent_scope":true,"platform_scope":true},"security":{"credentials":false,"secrets":false,"audit_required":true,"production_change_requires_approval":true}}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schema":"task-scheduler-v1","status":"proposal","scheduler":{"enabled":true,"modes":["capability_match","priority_queue","parallel_execution","failure_recovery"],"selection":{"factors":["capability","skill_match","health","quality_score","load"]},"priority":{"levels":["critical","high","normal","low"]}},"execution":{"parallel_agents":true,"retry":true,"handoff":true,"timeout_control":true},"safety":{"patch_first":true,"direct_main":false,"production_requires_approval":true}}
|
||||||
@@ -6,8 +6,8 @@ WORK_PATH = /data/aios-gitops/runtime/gitea-bin
|
|||||||
PROTOCOL = http
|
PROTOCOL = http
|
||||||
HTTP_ADDR = 127.0.0.1
|
HTTP_ADDR = 127.0.0.1
|
||||||
HTTP_PORT = 3000
|
HTTP_PORT = 3000
|
||||||
DOMAIN = cnnetmkt.top
|
DOMAIN = g.cnnetmkt.top
|
||||||
ROOT_URL = https://cnnetmkt.top/git/
|
ROOT_URL = https://g.cnnetmkt.top/git/
|
||||||
SERVE_FROM_SUB_PATH = true
|
SERVE_FROM_SUB_PATH = true
|
||||||
DISABLE_SSH = true
|
DISABLE_SSH = true
|
||||||
OFFLINE_MODE = false
|
OFFLINE_MODE = false
|
||||||
@@ -27,7 +27,8 @@ INTERNAL_TOKEN = __INTERNAL_TOKEN__
|
|||||||
|
|
||||||
[service]
|
[service]
|
||||||
DISABLE_REGISTRATION = true
|
DISABLE_REGISTRATION = true
|
||||||
REQUIRE_SIGNIN_VIEW = false
|
REQUIRE_SIGNIN_VIEW = true
|
||||||
|
SHOW_REGISTRATION_BUTTON = false
|
||||||
|
|
||||||
[webhook]
|
[webhook]
|
||||||
ALLOWED_HOST_LIST = *
|
ALLOWED_HOST_LIST = *
|
||||||
|
|||||||
@@ -24,12 +24,12 @@
|
|||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
location = /base { proxy_pass http://127.0.0.1:18890/base; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; }
|
location = /base { return 302 /portal/me/#gitops; }
|
||||||
location = /ver { proxy_pass http://127.0.0.1:18890/ver; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; }
|
location = /ver { return 302 /portal/me/#gitops; }
|
||||||
location = /diff { proxy_pass http://127.0.0.1:18890/diff; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; }
|
location = /diff { return 302 /portal/me/#gitops; }
|
||||||
location = /patch { proxy_pass http://127.0.0.1:18890/patch; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; }
|
location = /patch { return 302 /portal/me/#gitops; }
|
||||||
location = /model { proxy_pass http://127.0.0.1:18890/model; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; }
|
location = /model { return 302 /portal/me/#gitops; }
|
||||||
location = /run { proxy_pass http://127.0.0.1:18890/run; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; }
|
location = /run { return 302 /portal/me/#gitops; }
|
||||||
location = /hook { proxy_pass http://127.0.0.1:18890/hook; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; }
|
location = /hook { proxy_pass http://127.0.0.1:18890/hook; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; }
|
||||||
location /hook/ {
|
location /hook/ {
|
||||||
proxy_pass http://127.0.0.1:18890/hook/;
|
proxy_pass http://127.0.0.1:18890/hook/;
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# AIOS primary public Casdoor entry for cnnetmkt.top.
|
||||||
|
# The upstream remains the existing backup/home Casdoor service; public clients should see auth.cnnetmkt.top only.
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
listen [::]:443 ssl;
|
||||||
|
server_name auth.cnnetmkt.top;
|
||||||
|
|
||||||
|
access_log /var/log/nginx/aios-auth-cnnetmkt.access.log;
|
||||||
|
error_log /var/log/nginx/aios-auth-cnnetmkt.error.log;
|
||||||
|
|
||||||
|
ssl_certificate /etc/letsencrypt/live/cnnetmkt-wildcard/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/cnnetmkt-wildcard/privkey.pem;
|
||||||
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
||||||
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass https://auth.h.imruyi.top:8443;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_ssl_server_name on;
|
||||||
|
proxy_ssl_name auth.h.imruyi.top;
|
||||||
|
proxy_ssl_verify off;
|
||||||
|
proxy_set_header Host auth.h.imruyi.top;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto https;
|
||||||
|
proxy_set_header X-Forwarded-Host $host;
|
||||||
|
proxy_set_header X-Forwarded-Port 443;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection $connection_upgrade;
|
||||||
|
proxy_redirect https://auth.h.imruyi.top:8443/ https://auth.cnnetmkt.top/;
|
||||||
|
proxy_redirect https://auth.h.imruyi.top/ https://auth.cnnetmkt.top/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name auth.cnnetmkt.top;
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# cnnetmkt wildcard certificate
|
||||||
|
|
||||||
|
generated_at=2026-07-06T16:24:28+08:00
|
||||||
|
issuer=Let's Encrypt via lego DNS-01 Huawei Cloud
|
||||||
|
domains=cnnetmkt.top,*.cnnetmkt.top
|
||||||
|
live_dir=/etc/letsencrypt/live/cnnetmkt-wildcard
|
||||||
|
nginx_sites=/etc/nginx/sites-available/aios-user-portal.conf,/etc/nginx/sites-available/g-cnnetmkt-gitea.conf
|
||||||
|
renew_service=cnnetmkt-wildcard-renew.service
|
||||||
|
renew_timer=cnnetmkt-wildcard-renew.timer
|
||||||
|
secret_env=/etc/letsencrypt/huaweicloud-cnnetmkt.env
|
||||||
|
backup_dir=/data/aios-gitops/backups/nginx-wildcard-20260706-162202
|
||||||
|
status=issued
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
# AIOS GitOps alias for https://g.cnnetmkt.top/
|
||||||
|
# Note: this server block intentionally keeps /git/ as the Gitea app prefix,
|
||||||
|
# matching the current Gitea ROOT_URL and avoiding a disruptive app.ini rewrite.
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
listen [::]:443 ssl;
|
||||||
|
server_name g.cnnetmkt.top;
|
||||||
|
|
||||||
|
access_log /var/log/nginx/aios-g-cnnetmkt.access.log;
|
||||||
|
error_log /var/log/nginx/aios-g-cnnetmkt.error.log;
|
||||||
|
|
||||||
|
ssl_certificate /etc/letsencrypt/live/cnnetmkt-wildcard/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/cnnetmkt-wildcard/privkey.pem;
|
||||||
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
||||||
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
||||||
|
|
||||||
|
location = / {
|
||||||
|
return 302 /git/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /git {
|
||||||
|
return 302 /git/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /git/ {
|
||||||
|
proxy_pass http://127.0.0.1:3000/;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Forwarded-Host $host;
|
||||||
|
proxy_set_header X-Forwarded-Prefix /git;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection $connection_upgrade;
|
||||||
|
proxy_redirect off;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name g.cnnetmkt.top;
|
||||||
|
|
||||||
|
location = / {
|
||||||
|
return 302 https://$host/git/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Sync AIOS Gitea owner password from UCC owner account
|
||||||
|
After=aios-gitea.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/local/sbin/aios-sync-gitea-owner-password.sh
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Periodic AIOS Gitea owner password sync
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnBootSec=2min
|
||||||
|
OnUnitActiveSec=15min
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
@@ -10,9 +10,10 @@ Environment=AIOS_GITOPS_ROOT=/data/aios-gitops
|
|||||||
Environment=AIOS_GITOPS_WORKSPACE=/data/aios-gitops/workspace
|
Environment=AIOS_GITOPS_WORKSPACE=/data/aios-gitops/workspace
|
||||||
Environment=AIOS_GITOPS_DB=/data/aios-gitops/runtime/gitops_model.sqlite3
|
Environment=AIOS_GITOPS_DB=/data/aios-gitops/runtime/gitops_model.sqlite3
|
||||||
Environment=AIOS_GITOPS_TOKEN_FILE=/data/aios-gitops/runtime/secrets/gitops.tokens
|
Environment=AIOS_GITOPS_TOKEN_FILE=/data/aios-gitops/runtime/secrets/gitops.tokens
|
||||||
|
Environment=AIOS_GITOPS_BARE_REPO=/data/aios-gitops/runtime/gitea-bin/data/repositories/aios/aios-v23.git
|
||||||
Environment=AIOS_GITOPS_HOST=127.0.0.1
|
Environment=AIOS_GITOPS_HOST=127.0.0.1
|
||||||
Environment=AIOS_GITOPS_PORT=18890
|
Environment=AIOS_GITOPS_PORT=18890
|
||||||
ExecStart=/usr/bin/python3 /data/aios-gitops/workspace/active-runtime/app/aios_gitops_model_api.py
|
ExecStart=/usr/bin/python3 /data/aios-gitops/workspace/active-runtime/app/aios_chatgpt_actions_api.py
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=3
|
RestartSec=3
|
||||||
|
|
||||||
|
|||||||
@@ -12,3 +12,18 @@ Forbidden:
|
|||||||
- API keys in Git
|
- API keys in Git
|
||||||
- API keys in plaintext logs
|
- API keys in plaintext logs
|
||||||
- bypassing owner/admin approval for V-level changes
|
- bypassing owner/admin approval for V-level changes
|
||||||
|
|
||||||
|
## Codex Online Version Management
|
||||||
|
|
||||||
|
Codex uses `/data/aios-gitops/workspace` and `https://cnnetmkt.top/git/aios/aios-v23.git` as the online Git version baseline. Runtime write access uses `codex-gitops-bot`; its token is stored outside Git and referenced as `secret_ref://aios-gitops/runtime/codex-gitops-bot`.
|
||||||
|
|
||||||
|
Current production release after this merge: `V1R1C3`. Acceptance-only branches are retained for audit and are not automatically merged into `main`.
|
||||||
|
|
||||||
|
## Online Git Sync
|
||||||
|
|
||||||
|
Starting in `V1R1C3`, committed API/Codex patch branches are synchronized from the workspace clone into the online Gitea bare repository. Protected production branches remain excluded from API sync.
|
||||||
|
|
||||||
|
## Codex and Custom GPT Collaboration Test
|
||||||
|
|
||||||
|
`V1R1C3` confirms local Codex and the custom GPT Actions path can independently create patch branches, commit files, sync to online Git, and then merge into the latest baseline version.
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
# Codex Online GitOps Version Management
|
||||||
|
|
||||||
|
Codex is configured to treat the online Git baseline as the version source of truth.
|
||||||
|
|
||||||
|
- Workspace: `/data/aios-gitops/workspace`
|
||||||
|
- Git web: `https://cnnetmkt.top/git/aios/aios-v23`
|
||||||
|
- API base: `https://cnnetmkt.top/api`
|
||||||
|
- OpenAPI schema: `https://cnnetmkt.top/api/openapi-chatgpt-actions.yaml`
|
||||||
|
- Runtime token account: `codex-gitops-bot`
|
||||||
|
- Runtime token ref: `secret_ref://aios-gitops/runtime/codex-gitops-bot`
|
||||||
|
|
||||||
|
## Rules
|
||||||
|
|
||||||
|
1. Codex updates must use Git patch branches; ZIP upload is deprecated.
|
||||||
|
2. Every Codex write must become a Git commit.
|
||||||
|
3. Codex must not push directly to `main`; merge to `main` requires owner/admin approval.
|
||||||
|
4. V-level release/tag/rollback requests must not bypass owner/admin approval.
|
||||||
|
5. User custom LLM API keys must stay in runtime secrets and enter Git only as `secret_ref`.
|
||||||
|
6. Test or acceptance branches can remain as audit evidence, but dummy model/provider configs must not be merged into production `main`.
|
||||||
|
|
||||||
|
## Standard Flow
|
||||||
|
|
||||||
|
```text
|
||||||
|
main -> patch/<name> -> commit -> diff review -> smoke test -> owner/admin approval -> merge main -> VxRxCx tag -> baseline/current.json
|
||||||
|
```
|
||||||
|
|
||||||
|
## Current Merge
|
||||||
|
|
||||||
|
`V1R1C1` merges the current GitOps/ChatGPT/Codex access changes into the latest online baseline while excluding acceptance dummy model configuration.
|
||||||
|
|
||||||
|
## Online Git Sync
|
||||||
|
|
||||||
|
Starting in `V1R1C3`, committed API/Codex patch branches are synchronized from the workspace clone into the online Gitea bare repository. Protected production branches remain excluded from API sync.
|
||||||
|
|
||||||
|
## Codex and Custom GPT Collaboration Test
|
||||||
|
|
||||||
|
`V1R1C3` confirms local Codex and the custom GPT Actions path can independently create patch branches, commit files, sync to online Git, and then merge into the latest baseline version.
|
||||||
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# Custom GPT Collaboration Patch
|
||||||
|
|
||||||
|
Timestamp: 20260706T104130Z
|
||||||
|
|
||||||
|
Actor: chatgpt-gitops-bot
|
||||||
|
|
||||||
|
Created through chatgpt-gitops-bot to simulate the AIOS GitOps 控制台 GPT Actions path: https://chatgpt.com/g/g-6a4b7c82dff08191bc980798edea1bac-aios-gitops-kong-zhi-tai
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# Local Codex Collaboration Patch
|
||||||
|
|
||||||
|
Timestamp: 20260706T104130Z
|
||||||
|
|
||||||
|
Actor: codex-gitops-bot
|
||||||
|
|
||||||
|
Created by local Codex through codex-gitops-bot to validate coordinated online GitOps changes.
|
||||||
@@ -0,0 +1,240 @@
|
|||||||
|
openapi: 3.1.0
|
||||||
|
info:
|
||||||
|
title: AIOS GitOps Controlled Access API
|
||||||
|
version: V1R1C0-chatgpt-actions
|
||||||
|
description: Controlled ChatGPT Actions API for AIOS online GitOps baseline. Read endpoints are public. Write endpoints require Bearer token and create Git commits on non-main branches.
|
||||||
|
servers:
|
||||||
|
- url: https://cnnetmkt.top
|
||||||
|
security: []
|
||||||
|
components:
|
||||||
|
securitySchemes:
|
||||||
|
bearerAuth:
|
||||||
|
type: http
|
||||||
|
scheme: bearer
|
||||||
|
bearerFormat: opaque-token
|
||||||
|
schemas:
|
||||||
|
BranchRequest:
|
||||||
|
type: object
|
||||||
|
required: [branch]
|
||||||
|
properties:
|
||||||
|
branch: {type: string, example: patch/chatgpt-actions-demo}
|
||||||
|
base: {type: string, default: main}
|
||||||
|
message: {type: string}
|
||||||
|
FileCommitRequest:
|
||||||
|
type: object
|
||||||
|
required: [branch, path, content]
|
||||||
|
properties:
|
||||||
|
branch: {type: string}
|
||||||
|
base: {type: string, default: main}
|
||||||
|
create_branch: {type: boolean, default: false}
|
||||||
|
path: {type: string, example: docs/gitops/chatgpt-change.md}
|
||||||
|
content: {type: string}
|
||||||
|
message: {type: string}
|
||||||
|
CommitRequest:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
branch: {type: string}
|
||||||
|
paths:
|
||||||
|
type: array
|
||||||
|
items: {type: string}
|
||||||
|
message: {type: string}
|
||||||
|
PatchRequest:
|
||||||
|
type: object
|
||||||
|
required: [patch_name]
|
||||||
|
properties:
|
||||||
|
patch_name: {type: string}
|
||||||
|
branch: {type: string}
|
||||||
|
base: {type: string, default: main}
|
||||||
|
risk: {type: string, enum: [low, medium, high]}
|
||||||
|
description: {type: string}
|
||||||
|
message: {type: string}
|
||||||
|
TagRequest:
|
||||||
|
type: object
|
||||||
|
required: [version]
|
||||||
|
properties:
|
||||||
|
version: {type: string, example: V1R1C1}
|
||||||
|
message: {type: string}
|
||||||
|
execute:
|
||||||
|
type: boolean
|
||||||
|
description: Owner-approved calls only. Otherwise an approval request commit is created.
|
||||||
|
RollbackRequest:
|
||||||
|
type: object
|
||||||
|
required: [target_version]
|
||||||
|
properties:
|
||||||
|
target_version: {type: string}
|
||||||
|
reason: {type: string}
|
||||||
|
branch: {type: string}
|
||||||
|
ModelRequest:
|
||||||
|
type: object
|
||||||
|
required: [provider_name, base_url, model_name]
|
||||||
|
properties:
|
||||||
|
username: {type: string}
|
||||||
|
provider_name: {type: string}
|
||||||
|
base_url: {type: string}
|
||||||
|
model_name: {type: string}
|
||||||
|
display_name: {type: string}
|
||||||
|
api_key_secret_ref:
|
||||||
|
type: string
|
||||||
|
description: Preferred. Git stores this secret_ref only.
|
||||||
|
api_key:
|
||||||
|
type: string
|
||||||
|
writeOnly: true
|
||||||
|
description: Accepted only for runtime secret storage; never committed to Git or logs.
|
||||||
|
branch: {type: string}
|
||||||
|
message: {type: string}
|
||||||
|
ModelPriorityRequest:
|
||||||
|
type: object
|
||||||
|
required: [items]
|
||||||
|
properties:
|
||||||
|
username: {type: string}
|
||||||
|
branch: {type: string}
|
||||||
|
items:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
model_id: {type: string}
|
||||||
|
priority: {type: integer}
|
||||||
|
enabled: {type: boolean}
|
||||||
|
fallback_policy: {type: string}
|
||||||
|
NLRequest:
|
||||||
|
type: object
|
||||||
|
required: [text]
|
||||||
|
properties:
|
||||||
|
text: {type: string}
|
||||||
|
branch: {type: string}
|
||||||
|
paths:
|
||||||
|
/api/base:
|
||||||
|
get:
|
||||||
|
operationId: getBaseline
|
||||||
|
summary: Read current AIOS baseline
|
||||||
|
responses: {'200': {description: OK}}
|
||||||
|
/api/ver:
|
||||||
|
get:
|
||||||
|
operationId: listVersions
|
||||||
|
summary: List GitOps versions
|
||||||
|
responses: {'200': {description: OK}}
|
||||||
|
/api/diff:
|
||||||
|
get:
|
||||||
|
operationId: getDiff
|
||||||
|
summary: Read Git diff between refs
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: from
|
||||||
|
schema: {type: string, default: HEAD~1}
|
||||||
|
- in: query
|
||||||
|
name: to
|
||||||
|
schema: {type: string, default: HEAD}
|
||||||
|
responses: {'200': {description: OK}}
|
||||||
|
/api/patch:
|
||||||
|
get:
|
||||||
|
operationId: listPatches
|
||||||
|
summary: List patch records
|
||||||
|
responses: {'200': {description: OK}}
|
||||||
|
post:
|
||||||
|
operationId: createPatch
|
||||||
|
summary: Create a patch branch and commit metadata
|
||||||
|
security: [{bearerAuth: []}]
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema: {$ref: '#/components/schemas/PatchRequest'}
|
||||||
|
responses: {'200': {description: Patch branch committed}, '401': {description: Unauthorized}, '403': {description: Forbidden}}
|
||||||
|
/api/model:
|
||||||
|
get:
|
||||||
|
operationId: readModelRegistry
|
||||||
|
summary: Read visible model registry and priority
|
||||||
|
responses: {'200': {description: OK}}
|
||||||
|
post:
|
||||||
|
operationId: registerModel
|
||||||
|
summary: Register a custom model; API keys are stored as runtime secrets and Git receives secret_ref only
|
||||||
|
security: [{bearerAuth: []}]
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema: {$ref: '#/components/schemas/ModelRequest'}
|
||||||
|
responses: {'200': {description: Model registered and committed}, '401': {description: Unauthorized}, '403': {description: Forbidden}}
|
||||||
|
/api/run:
|
||||||
|
get:
|
||||||
|
operationId: getRuntimeStatus
|
||||||
|
summary: Read runtime status
|
||||||
|
responses: {'200': {description: OK}}
|
||||||
|
/api/branch:
|
||||||
|
post:
|
||||||
|
operationId: createBranch
|
||||||
|
summary: Create a non-main branch and commit branch metadata
|
||||||
|
security: [{bearerAuth: []}]
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema: {$ref: '#/components/schemas/BranchRequest'}
|
||||||
|
responses: {'200': {description: Branch created}, '401': {description: Unauthorized}, '403': {description: Forbidden}}
|
||||||
|
/api/file:
|
||||||
|
post:
|
||||||
|
operationId: commitFile
|
||||||
|
summary: Write a file and create a Git commit on a non-main branch
|
||||||
|
security: [{bearerAuth: []}]
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema: {$ref: '#/components/schemas/FileCommitRequest'}
|
||||||
|
responses: {'200': {description: File committed}, '400': {description: Secret rejected or invalid path}, '401': {description: Unauthorized}}
|
||||||
|
/api/commit:
|
||||||
|
post:
|
||||||
|
operationId: commitChanges
|
||||||
|
summary: Commit existing workspace changes on a non-main branch
|
||||||
|
security: [{bearerAuth: []}]
|
||||||
|
requestBody:
|
||||||
|
required: false
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema: {$ref: '#/components/schemas/CommitRequest'}
|
||||||
|
responses: {'200': {description: Commit result}, '401': {description: Unauthorized}}
|
||||||
|
/api/tag:
|
||||||
|
post:
|
||||||
|
operationId: requestOrCreateTag
|
||||||
|
summary: Request tag creation; owner execution is required for direct tag
|
||||||
|
security: [{bearerAuth: []}]
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema: {$ref: '#/components/schemas/TagRequest'}
|
||||||
|
responses: {'200': {description: Tag request committed or tag created}, '403': {description: Forbidden}}
|
||||||
|
/api/rollback:
|
||||||
|
post:
|
||||||
|
operationId: requestRollback
|
||||||
|
summary: Commit a rollback request requiring owner/admin approval
|
||||||
|
security: [{bearerAuth: []}]
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema: {$ref: '#/components/schemas/RollbackRequest'}
|
||||||
|
responses: {'200': {description: Rollback request committed}, '401': {description: Unauthorized}}
|
||||||
|
/api/model-priority:
|
||||||
|
put:
|
||||||
|
operationId: setModelPriority
|
||||||
|
summary: Set model priority and commit policy file
|
||||||
|
security: [{bearerAuth: []}]
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema: {$ref: '#/components/schemas/ModelPriorityRequest'}
|
||||||
|
responses: {'200': {description: Priority updated and committed}, '401': {description: Unauthorized}}
|
||||||
|
/api/nl:
|
||||||
|
post:
|
||||||
|
operationId: planNaturalLanguageGitOpsAction
|
||||||
|
summary: Convert natural language to a safe committed plan without executing V-level changes
|
||||||
|
security: [{bearerAuth: []}]
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema: {$ref: '#/components/schemas/NLRequest'}
|
||||||
|
responses: {'200': {description: Plan committed}, '401': {description: Unauthorized}}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# CNNETMKT apex DNS status
|
||||||
|
|
||||||
|
generated_at=2026-07-06T16:39:07+08:00
|
||||||
|
provider=Huawei Cloud DNS
|
||||||
|
zone=cnnetmkt.top.
|
||||||
|
record=cnnetmkt.top. A 1.95.164.183
|
||||||
|
status=created_and_resolved
|
||||||
|
credential_storage=/etc/letsencrypt/huaweicloud-cnnetmkt.env
|
||||||
|
secret_policy=not_tracked_not_logged
|
||||||
|
|
||||||
|
## verification
|
||||||
|
|
||||||
|
- authoritative NS returns 1.95.164.183
|
||||||
|
- system resolver returns 1.95.164.183
|
||||||
|
- https://cnnetmkt.top/ returns 302 /portal/login/
|
||||||
|
- https://cnnetmkt.top/git/ returns 200 AIOS GitOps
|
||||||
|
- wildcard certificate SAN covers cnnetmkt.top and *.cnnetmkt.top
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
# CNNETMKT Auth Primary Status
|
||||||
|
|
||||||
|
更新时间:2026-07-06T09:00:06Z
|
||||||
|
|
||||||
|
## 结论
|
||||||
|
|
||||||
|
`https://cnnetmkt.top/` 是用户主入口。登录授权主域为 `https://auth.cnnetmkt.top`。
|
||||||
|
|
||||||
|
`https://auth.h.imruyi.top:8443` 只作为备份/上游兼容入口保留,不应出现在普通用户的主登录跳转链路里。
|
||||||
|
|
||||||
|
## 当前链路
|
||||||
|
|
||||||
|
1. 用户访问 `https://cnnetmkt.top/`。
|
||||||
|
2. UCC 返回 `/portal/login/`。
|
||||||
|
3. UCC 生成 Casdoor 授权地址:
|
||||||
|
`https://auth.cnnetmkt.top/login/oauth/authorize?...redirect_uri=https%3A%2F%2Fcnnetmkt.top%2Fcasdoor%2Fcallback%2F...`
|
||||||
|
4. 华为云 Nginx `auth.cnnetmkt.top` server block 反代到现有 Casdoor 上游。
|
||||||
|
5. Casdoor 允许 `https://cnnetmkt.top/casdoor/callback/` 作为 `admin/aios-portal` 的 OAuth callback。
|
||||||
|
|
||||||
|
## 已调整配置
|
||||||
|
|
||||||
|
### 华为云 UCC 运行时
|
||||||
|
|
||||||
|
- `CASDOOR_PUBLIC_BASE_URL=https://auth.cnnetmkt.top`
|
||||||
|
- `CASDOOR_INTERNAL_BASE_URL=https://auth.cnnetmkt.top`
|
||||||
|
- `CASDOOR_INVITE_SYNC_BASE_URL=https://auth.cnnetmkt.top`
|
||||||
|
- `UCC_PUBLIC_BASE_URL=https://cnnetmkt.top`
|
||||||
|
- `ALLOWED_HOSTS` 增加 `auth.cnnetmkt.top`
|
||||||
|
- `CSRF_TRUSTED_ORIGINS` 增加 `https://cnnetmkt.top` 和 `https://auth.cnnetmkt.top`
|
||||||
|
|
||||||
|
### Casdoor 应用
|
||||||
|
|
||||||
|
应用:`admin/aios-portal`
|
||||||
|
|
||||||
|
新增/保留 callback:
|
||||||
|
|
||||||
|
- `https://cnnetmkt.top/casdoor/callback/`
|
||||||
|
- `https://cnnetmkt.top/api/auth/callback/casdoor`
|
||||||
|
- `https://user.cnnetmkt.top/casdoor/callback/`
|
||||||
|
- `https://portal.cnnetmkt.top/casdoor/callback/`
|
||||||
|
- `https://portal.h.imruyi.top:8443/casdoor/callback/`(备份)
|
||||||
|
|
||||||
|
## 验证命令
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ops/gitops-migration/check_cnnetmkt_auth_primary.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
关键验收点:
|
||||||
|
|
||||||
|
- 主链路不再出现 `auth.h.imruyi.top:8443`。
|
||||||
|
- `user-control-web` 为 `healthy`。
|
||||||
|
- Casdoor DB `application.redirect_uris` 包含 `https://cnnetmkt.top/casdoor/callback/`。
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
# cnnetmkt SSL ingress status
|
||||||
|
|
||||||
|
generated_at=2026-07-06T15:48:12+08:00
|
||||||
|
g_route_status=installed
|
||||||
|
certbot_status=issued-g-user-portal
|
||||||
|
apex_dns_status=blocked_until_cnnetmkt.top_has_A_record_to_1.95.164.183
|
||||||
|
wildcard_status=blocked_until_dns01_provider_credentials_available
|
||||||
|
backup_dir=/data/aios-gitops/backups/nginx-g-cnnetmkt-20260706-154743
|
||||||
|
tracked_nginx=/data/aios-gitops/workspace/deploy/nginx/g-cnnetmkt-gitea-server.conf
|
||||||
|
|
||||||
|
## validation
|
||||||
|
### g.cnnetmkt.top
|
||||||
|
HTTP/1.1 302 Moved Temporarily
|
||||||
|
Server: nginx/1.24.0 (Ubuntu)
|
||||||
|
Date: Mon, 06 Jul 2026 07:48:12 GMT
|
||||||
|
Content-Type: text/html
|
||||||
|
Content-Length: 154
|
||||||
|
Location: https://g.cnnetmkt.top/git/
|
||||||
|
Connection: keep-alive
|
||||||
|
|
||||||
|
<title>302 Found
|
||||||
|
|
||||||
|
subject=CN = user.cnnetmkt.top
|
||||||
|
issuer=C = US, O = Let's Encrypt, CN = YE2
|
||||||
|
notBefore=Jul 6 06:49:39 2026 GMT
|
||||||
|
notAfter=Oct 4 06:49:38 2026 GMT
|
||||||
|
X509v3 Subject Alternative Name:
|
||||||
|
DNS:g.cnnetmkt.top, DNS:portal.cnnetmkt.top, DNS:user.cnnetmkt.top
|
||||||
|
|
||||||
|
### cnnetmkt.top
|
||||||
|
HTTP/1.1 302 Found
|
||||||
|
Server: nginx/1.24.0 (Ubuntu)
|
||||||
|
Date: Mon, 06 Jul 2026 07:48:12 GMT
|
||||||
|
Content-Type: text/html; charset=utf-8
|
||||||
|
Content-Length: 0
|
||||||
|
Connection: keep-alive
|
||||||
|
Location: /portal/login/
|
||||||
|
X-Request-ID: 7c649abe-a2de-4b3e-87fe-325f4297738f
|
||||||
|
X-Frame-Options: DENY
|
||||||
|
X-Content-Type-Options: nosniff
|
||||||
|
Referrer-Policy: same-origin
|
||||||
|
Cross-Origin-Opener-Policy: same-origin
|
||||||
|
|
||||||
|
subject=CN = user.cnnetmkt.top
|
||||||
|
issuer=C = US, O = Let's Encrypt, CN = YE2
|
||||||
|
notBefore=Jul 6 06:49:39 2026 GMT
|
||||||
|
notAfter=Oct 4 06:49:38 2026 GMT
|
||||||
|
X509v3 Subject Alternative Name:
|
||||||
|
DNS:g.cnnetmkt.top, DNS:portal.cnnetmkt.top, DNS:user.cnnetmkt.top
|
||||||
|
|
||||||
|
### user.cnnetmkt.top
|
||||||
|
HTTP/1.1 302 Found
|
||||||
|
Server: nginx/1.24.0 (Ubuntu)
|
||||||
|
Date: Mon, 06 Jul 2026 07:48:12 GMT
|
||||||
|
Content-Type: text/html; charset=utf-8
|
||||||
|
Content-Length: 0
|
||||||
|
Connection: keep-alive
|
||||||
|
Location: /portal/login/
|
||||||
|
X-Request-ID: e3d70907-1ab7-456c-a725-7cb60647514d
|
||||||
|
X-Frame-Options: DENY
|
||||||
|
X-Content-Type-Options: nosniff
|
||||||
|
Referrer-Policy: same-origin
|
||||||
|
Cross-Origin-Opener-Policy: same-origin
|
||||||
|
|
||||||
|
subject=CN = user.cnnetmkt.top
|
||||||
|
issuer=C = US, O = Let's Encrypt, CN = YE2
|
||||||
|
notBefore=Jul 6 06:49:39 2026 GMT
|
||||||
|
notAfter=Oct 4 06:49:38 2026 GMT
|
||||||
|
X509v3 Subject Alternative Name:
|
||||||
|
DNS:g.cnnetmkt.top, DNS:portal.cnnetmkt.top, DNS:user.cnnetmkt.top
|
||||||
|
|
||||||
|
## certbot
|
||||||
|
|
||||||
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
Found the following certs:
|
||||||
|
Certificate Name: user.cnnetmkt.top
|
||||||
|
Serial Number: 529feebc03b37f2866c25b1465f37e14565
|
||||||
|
Key Type: ECDSA
|
||||||
|
Domains: user.cnnetmkt.top g.cnnetmkt.top portal.cnnetmkt.top
|
||||||
|
Expiry Date: 2026-10-04 06:49:38+00:00 (VALID: 89 days)
|
||||||
|
Certificate Path: /etc/letsencrypt/live/user.cnnetmkt.top/fullchain.pem
|
||||||
|
Private Key Path: /etc/letsencrypt/live/user.cnnetmkt.top/privkey.pem
|
||||||
|
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# CNNETMKT wildcard certificate status
|
||||||
|
|
||||||
|
generated_at=2026-07-06T16:24:28+08:00
|
||||||
|
status=issued
|
||||||
|
staging_status=ok
|
||||||
|
dns_provider=huaweicloud
|
||||||
|
secret_storage=/etc/letsencrypt/huaweicloud-cnnetmkt.env
|
||||||
|
certificate_live_dir=/etc/letsencrypt/live/cnnetmkt-wildcard
|
||||||
|
nginx_status=loaded
|
||||||
|
backup_dir=/data/aios-gitops/backups/nginx-wildcard-20260706-162202
|
||||||
|
renew_timer=cnnetmkt-wildcard-renew.timer
|
||||||
|
|
||||||
|
## certificate
|
||||||
|
|
||||||
|
subject=CN = *.cnnetmkt.top
|
||||||
|
issuer=C = US, O = Let's Encrypt, CN = YE2
|
||||||
|
notBefore=Jul 6 07:25:55 2026 GMT
|
||||||
|
notAfter=Oct 4 07:25:54 2026 GMT
|
||||||
|
X509v3 Subject Alternative Name:
|
||||||
|
DNS:*.cnnetmkt.top, DNS:cnnetmkt.top
|
||||||
|
|
||||||
|
## routes
|
||||||
|
|
||||||
|
- https://cnnetmkt.top/
|
||||||
|
- https://cnnetmkt.top/git/
|
||||||
|
- https://g.cnnetmkt.top/
|
||||||
|
- https://g.cnnetmkt.top/git/
|
||||||
|
- https://user.cnnetmkt.top/
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# AIOS V1R1C1 Codex GitOps Online Release
|
||||||
|
|
||||||
|
Date: 2026-07-06T10:21:08Z
|
||||||
|
|
||||||
|
## Purpose
|
||||||
|
|
||||||
|
Merge the current controlled ChatGPT/Codex GitOps access changes into the latest online baseline and make Git the operating version manager for Codex changes.
|
||||||
|
|
||||||
|
## Included
|
||||||
|
|
||||||
|
- ChatGPT Actions API adapter and OpenAPI schema.
|
||||||
|
- Secret-safe model registration using `secret_ref`.
|
||||||
|
- `codex-gitops-bot` runtime token account with scoped API permissions.
|
||||||
|
- Codex online GitOps configuration under `config/codex/gitops-online.json`.
|
||||||
|
- Baseline metadata updated from `V1R1C0` to `V1R1C1`.
|
||||||
|
|
||||||
|
## Excluded
|
||||||
|
|
||||||
|
- Acceptance dummy model registry entries from `patch/chatgpt-model-acceptance-*`.
|
||||||
|
- Plaintext API keys or bearer tokens.
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
|
||||||
|
- `curl https://cnnetmkt.top/api/base` returns 200.
|
||||||
|
- `curl https://cnnetmkt.top/api/openapi-chatgpt-actions.yaml` returns 200.
|
||||||
|
- `bash scripts/package_contract_check_v1r1c0.sh` passes.
|
||||||
|
- `bash scripts/codex_gitops_online_check.sh` passes after tag publication.
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# AIOS V1R1C2 Codex GitOps Online Sync Release
|
||||||
|
|
||||||
|
Date: 2026-07-06T10:26:26Z
|
||||||
|
|
||||||
|
## Purpose
|
||||||
|
|
||||||
|
Make Codex/API writes visible in the online Git service by syncing non-main patch branches from `/data/aios-gitops/workspace` into the Gitea bare repository after each committed write.
|
||||||
|
|
||||||
|
## Included
|
||||||
|
|
||||||
|
- `active-runtime/app/aios_chatgpt_actions_api.py` now syncs non-main branch commits to the online Git bare repository.
|
||||||
|
- `POST /api/tag` direct owner flow syncs tags when executed.
|
||||||
|
- `config/codex/gitops-online.json` records `online_git_sync=true`.
|
||||||
|
- Live and template systemd service configuration declares `AIOS_GITOPS_BARE_REPO`.
|
||||||
|
|
||||||
|
## Policy
|
||||||
|
|
||||||
|
`main` remains protected. API/Codex writes still commit to patch/request branches and owner/admin approval remains required for V-level production actions.
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# AIOS V1R1C3 Codex + Custom GPT Collaboration Release
|
||||||
|
|
||||||
|
Date: 2026-07-06T10:42:33Z
|
||||||
|
|
||||||
|
## Purpose
|
||||||
|
|
||||||
|
Validate that local Codex and the AIOS GitOps 控制台 custom GPT can both modify the online GitOps baseline through controlled API writes, then merge both changes into the latest version.
|
||||||
|
|
||||||
|
## Custom GPT
|
||||||
|
|
||||||
|
https://chatgpt.com/g/g-6a4b7c82dff08191bc980798edea1bac-aios-gitops-kong-zhi-tai
|
||||||
|
|
||||||
|
## Merged Inputs
|
||||||
|
|
||||||
|
| Actor | Account | Branch | Commit | Online Sync |
|
||||||
|
|---|---|---|---|---|
|
||||||
|
| local_codex | codex-gitops-bot | `patch/collab-local-codex-20260706T104130Z` | `a62d4ce` | synced |
|
||||||
|
| custom_gpt | chatgpt-gitops-bot | `patch/collab-custom-gpt-20260706T104130Z` | `c393931` | synced |
|
||||||
|
|
||||||
|
## Result
|
||||||
|
|
||||||
|
Both branches were merged into `main`, baseline metadata was refreshed to `V1R1C3`, and the release tag `V1R1C3` was published to the online Git repository.
|
||||||
|
|
||||||
|
## Guardrails
|
||||||
|
|
||||||
|
- GPT and Codex writes entered Git as patch branch commits.
|
||||||
|
- Protected `main` was updated only by the release merge step.
|
||||||
|
- Bot tokens and custom LLM API keys remain outside Git.
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
# AIOS V1R1C4 Auth GitOps Portal Release
|
||||||
|
|
||||||
|
Date: 2026-07-06T11:05:30Z
|
||||||
|
|
||||||
|
## Purpose
|
||||||
|
|
||||||
|
Close the public-access gap around human GitOps shortlinks, move repository browsing to the protected Gitea endpoint, and make the new GitOps portal function visible from the main cnnetmkt owner/admin workspace.
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
- `/base`, `/ver`, `/diff`, `/patch`, `/model`, and `/run` now redirect to `https://cnnetmkt.top/portal/me/#gitops` instead of exposing raw JSON to unauthenticated users.
|
||||||
|
- `/api/*` remains the controlled machine interface for ChatGPT Actions and Codex.
|
||||||
|
- Gitea now uses `https://g.cnnetmkt.top/git/`, requires sign-in for repository browsing, and hides registration.
|
||||||
|
- `aios-gitea-owner-sync.service` and timer synchronize the Gitea `owner` account password from the user-control owner secret without writing the password to Git or logs.
|
||||||
|
- The legacy local `aios` Gitea account has login prohibited and its password cleared; the row remains only to preserve repository ownership.
|
||||||
|
- The user portal now includes a GitOps dashboard section for admin/owner roles.
|
||||||
|
- The patched user-control-center source is tracked under `overlays/user-control-center/` with a replay script.
|
||||||
|
- The portal GitOps section reads `/app/runtime/gitops/current.json` before HTTP fallback, so the current version remains visible inside Docker.
|
||||||
|
|
||||||
|
## Verification Targets
|
||||||
|
|
||||||
|
- `https://cnnetmkt.top/model` returns `302` to `/portal/me/#gitops`.
|
||||||
|
- `https://cnnetmkt.top/api/model` returns the public machine-readable model metadata.
|
||||||
|
- `https://g.cnnetmkt.top/git/aios/aios-v23` returns a login redirect when unauthenticated.
|
||||||
|
- Owner login can open the Gitea repository; no secret is printed.
|
||||||
|
- Portal login state renders the GitOps section and links.
|
||||||
|
|
||||||
|
## Guardrails
|
||||||
|
|
||||||
|
- No ZIP update path is reintroduced.
|
||||||
|
- All replayable files are tracked in Git.
|
||||||
|
- Passwords, bearer tokens, Huawei keys, and custom LLM API keys remain outside Git.
|
||||||
|
|
||||||
|
## Secret Log Hygiene
|
||||||
|
|
||||||
|
The Gitea owner password sync script uses `runuser` instead of `sudo -u ... --password ...`, strips CRLF from sourced owner fields, and does not print passwords or tokens. Archived journal files were rotated/vacuumed after the live script was corrected.
|
||||||
@@ -14,6 +14,7 @@ log() {
|
|||||||
cd "$WORKSPACE"
|
cd "$WORKSPACE"
|
||||||
|
|
||||||
TOKEN_FILE="$ROOT/runtime/secrets/gitops.tokens"
|
TOKEN_FILE="$ROOT/runtime/secrets/gitops.tokens"
|
||||||
|
BARE_REPO="$ROOT/runtime/gitea-bin/data/repositories/aios/aios-v23.git"
|
||||||
if [ ! -s "$TOKEN_FILE" ]; then
|
if [ ! -s "$TOKEN_FILE" ]; then
|
||||||
(openssl rand -hex 32 || python3 -c 'import secrets; print(secrets.token_hex(32))') > "$TOKEN_FILE"
|
(openssl rand -hex 32 || python3 -c 'import secrets; print(secrets.token_hex(32))') > "$TOKEN_FILE"
|
||||||
chmod 600 "$TOKEN_FILE"
|
chmod 600 "$TOKEN_FILE"
|
||||||
@@ -32,9 +33,10 @@ Environment=AIOS_GITOPS_ROOT=$ROOT
|
|||||||
Environment=AIOS_GITOPS_WORKSPACE=$WORKSPACE
|
Environment=AIOS_GITOPS_WORKSPACE=$WORKSPACE
|
||||||
Environment=AIOS_GITOPS_DB=$ROOT/runtime/gitops_model.sqlite3
|
Environment=AIOS_GITOPS_DB=$ROOT/runtime/gitops_model.sqlite3
|
||||||
Environment=AIOS_GITOPS_TOKEN_FILE=$TOKEN_FILE
|
Environment=AIOS_GITOPS_TOKEN_FILE=$TOKEN_FILE
|
||||||
|
Environment=AIOS_GITOPS_BARE_REPO=$BARE_REPO
|
||||||
Environment=AIOS_GITOPS_HOST=127.0.0.1
|
Environment=AIOS_GITOPS_HOST=127.0.0.1
|
||||||
Environment=AIOS_GITOPS_PORT=18890
|
Environment=AIOS_GITOPS_PORT=18890
|
||||||
ExecStart=/usr/bin/python3 $WORKSPACE/active-runtime/app/aios_gitops_model_api.py
|
ExecStart=/usr/bin/python3 $WORKSPACE/active-runtime/app/aios_chatgpt_actions_api.py
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=3
|
RestartSec=3
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
WORKSPACE="${AIOS_GITOPS_WORKSPACE:-/data/aios-gitops/workspace}"
|
||||||
|
RUNTIME_ROOT="${AIOS_USER_CONTROL_ROOT:-/data/aios/aios_r13_v18_runtime_portable_silent_20260704/components/user-control-center}"
|
||||||
|
CONTAINER="${AIOS_USER_CONTROL_CONTAINER:-user-control-web}"
|
||||||
|
|
||||||
|
install -D -m 0644 "$WORKSPACE/overlays/user-control-center/control/portal_views.py" "$RUNTIME_ROOT/control/portal_views.py"
|
||||||
|
install -D -m 0644 "$WORKSPACE/overlays/user-control-center/templates/portal/me.html" "$RUNTIME_ROOT/templates/portal/me.html"
|
||||||
|
install -D -m 0644 "$WORKSPACE/baseline/current.json" "$RUNTIME_ROOT/runtime/gitops/current.json"
|
||||||
|
|
||||||
|
if command -v docker >/dev/null 2>&1 && docker ps --format '{{.Names}}' | grep -qx "$CONTAINER"; then
|
||||||
|
docker cp "$RUNTIME_ROOT/control/portal_views.py" "$CONTAINER:/app/control/portal_views.py"
|
||||||
|
docker cp "$RUNTIME_ROOT/templates/portal/me.html" "$CONTAINER:/app/templates/portal/me.html"
|
||||||
|
docker exec "$CONTAINER" mkdir -p /app/runtime/gitops
|
||||||
|
docker cp "$RUNTIME_ROOT/runtime/gitops/current.json" "$CONTAINER:/app/runtime/gitops/current.json"
|
||||||
|
docker restart "$CONTAINER" >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "AIOS_USER_PORTAL_GITOPS_OVERLAY_APPLIED runtime=$RUNTIME_ROOT container=$CONTAINER"
|
||||||
+61
@@ -0,0 +1,61 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
PUBLIC_ENTRY="${PUBLIC_ENTRY:-https://cnnetmkt.top/}"
|
||||||
|
AUTH_ENTRY="${AUTH_ENTRY:-https://auth.cnnetmkt.top}"
|
||||||
|
CLIENT_ID="${CASDOOR_CLIENT_ID:-aios8a810963c1dd368a}"
|
||||||
|
CALLBACK="${CASDOOR_CALLBACK:-https://cnnetmkt.top/casdoor/callback/}"
|
||||||
|
AIHOST_HOST="${AIHOST_HOST:-aihost}"
|
||||||
|
HW_HOST="${HW_HOST:-hw.imruyi.top}"
|
||||||
|
|
||||||
|
fail() {
|
||||||
|
printf 'FAIL: %s\n' "$*" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
CALLBACK_ENCODED="$(python3 -c 'import sys, urllib.parse; print(urllib.parse.quote(sys.argv[1], safe=""))' "$CALLBACK")"
|
||||||
|
AUTH_URL="$AUTH_ENTRY/login/oauth/authorize?client_id=$CLIENT_ID&response_type=code&redirect_uri=$CALLBACK_ENCODED&scope=read&state=aios-portal&language=zh"
|
||||||
|
|
||||||
|
printf '== public redirect chain ==\n'
|
||||||
|
chain="$(curl -k -sS -L -I --max-redirs 4 "$PUBLIC_ENTRY")"
|
||||||
|
printf '%s\n' "$chain"
|
||||||
|
printf '%s\n' "$chain" | grep -F "Location: $AUTH_ENTRY/login/oauth/authorize" >/dev/null \
|
||||||
|
|| fail "public entry did not redirect to $AUTH_ENTRY"
|
||||||
|
if printf '%s\n' "$chain" | grep -F 'auth.h.imruyi.top:8443' >/dev/null; then
|
||||||
|
fail 'public chain still exposes backup auth domain'
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '\n== auth authorize http ==\n'
|
||||||
|
auth_headers="$(curl -k -sS -D - -o /tmp/aios-auth-primary-body --max-time 20 "$AUTH_URL")"
|
||||||
|
printf '%s\n' "$auth_headers"
|
||||||
|
printf '%s\n' "$auth_headers" | grep -F 'HTTP/' >/dev/null || fail 'auth endpoint returned no HTTP headers'
|
||||||
|
if grep -E '许可跳转列表|redirect.*not|not.*redirect' /tmp/aios-auth-primary-body >/dev/null 2>&1; then
|
||||||
|
fail 'auth body still contains redirect allow-list error text'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v ssh >/dev/null 2>&1; then
|
||||||
|
printf '\n== casdoor db redirect allow-list ==\n'
|
||||||
|
redirects="$(ssh "$AIHOST_HOST" "docker exec casdoor-postgres psql -U casdoor -d casdoor -Atc \"select redirect_uris from application where owner='admin' and name='aios-portal';\"" 2>/dev/null || true)"
|
||||||
|
if [ -n "$redirects" ]; then
|
||||||
|
printf '%s\n' "$redirects"
|
||||||
|
printf '%s\n' "$redirects" | grep -F "$CALLBACK" >/dev/null \
|
||||||
|
|| fail "Casdoor DB does not include $CALLBACK"
|
||||||
|
else
|
||||||
|
printf 'WARN: skipped Casdoor DB readback; set AIHOST_HOST to a reachable SSH target for a strict DB check.\n'
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '\n== ucc runtime env ==\n'
|
||||||
|
runtime_env="$(docker inspect user-control-web --format '{{range .Config.Env}}{{println .}}{{end}}' 2>/dev/null | grep -E 'UCC_PUBLIC_BASE_URL|CASDOOR_(PUBLIC|INTERNAL|INVITE_SYNC)_BASE_URL' || true)"
|
||||||
|
if [ -z "$runtime_env" ]; then
|
||||||
|
runtime_env="$(ssh "$HW_HOST" 'docker inspect user-control-web --format "{{range .Config.Env}}{{println .}}{{end}}" | grep -E "UCC_PUBLIC_BASE_URL|CASDOOR_(PUBLIC|INTERNAL|INVITE_SYNC)_BASE_URL"' 2>/dev/null || true)"
|
||||||
|
fi
|
||||||
|
if [ -n "$runtime_env" ]; then
|
||||||
|
printf '%s\n' "$runtime_env"
|
||||||
|
printf '%s\n' "$runtime_env" | grep -F "CASDOOR_PUBLIC_BASE_URL=$AUTH_ENTRY" >/dev/null \
|
||||||
|
|| fail 'UCC runtime CASDOOR_PUBLIC_BASE_URL is not primary auth domain'
|
||||||
|
else
|
||||||
|
printf 'WARN: skipped UCC runtime env readback; run on hw.imruyi.top or set HW_HOST to a reachable SSH target.\n'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '\nPASS: cnnetmkt primary auth route is canonical and callback is allowed.\n'
|
||||||
+48
@@ -0,0 +1,48 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
echo "== host =="
|
||||||
|
hostname
|
||||||
|
date -Is
|
||||||
|
|
||||||
|
echo "== /etc/hosts cnnetmkt =="
|
||||||
|
grep -nE 'cnnetmkt|gitea|aios' /etc/hosts || true
|
||||||
|
|
||||||
|
echo "== local resolver =="
|
||||||
|
for n in cnnetmkt.top g.cnnetmkt.top user.cnnetmkt.top portal.cnnetmkt.top; do
|
||||||
|
echo "-- ${n}"
|
||||||
|
getent ahosts "${n}" || true
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "== DoH public DNS =="
|
||||||
|
for n in cnnetmkt.top g.cnnetmkt.top user.cnnetmkt.top portal.cnnetmkt.top; do
|
||||||
|
echo "-- ${n}"
|
||||||
|
curl -fsS --connect-timeout 10 --max-time 20 \
|
||||||
|
-H 'accept: application/dns-json' \
|
||||||
|
"https://cloudflare-dns.com/dns-query?name=${n}&type=A" || true
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "== local SNI HTTP/TLS =="
|
||||||
|
for h in cnnetmkt.top g.cnnetmkt.top user.cnnetmkt.top portal.cnnetmkt.top; do
|
||||||
|
echo "-- ${h} curl /"
|
||||||
|
rm -f /tmp/aios-ingress-body
|
||||||
|
curl -k -sS -D - -o /tmp/aios-ingress-body \
|
||||||
|
--resolve "${h}:443:127.0.0.1" \
|
||||||
|
"https://${h}/" | sed -n '1,20p' || true
|
||||||
|
sed -n '1,16p' /tmp/aios-ingress-body 2>/dev/null || true
|
||||||
|
echo "-- ${h} curl /git/"
|
||||||
|
curl -k -sS -D - -o /tmp/aios-ingress-body \
|
||||||
|
--resolve "${h}:443:127.0.0.1" \
|
||||||
|
"https://${h}/git/" | sed -n '1,12p' || true
|
||||||
|
grep -ao '<title>[^<]*' /tmp/aios-ingress-body 2>/dev/null | head -1 || true
|
||||||
|
echo "-- ${h} cert"
|
||||||
|
echo | openssl s_client -connect 127.0.0.1:443 -servername "${h}" 2>/dev/null \
|
||||||
|
| openssl x509 -noout -subject -issuer -dates -ext subjectAltName 2>/dev/null || true
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "== certbot certificates =="
|
||||||
|
sudo certbot certificates || true
|
||||||
|
|
||||||
|
echo "== nginx matched config =="
|
||||||
|
sudo nginx -T 2>/dev/null | grep -nE 'server_name|ssl_certificate|location = /git|location /git|proxy_pass http://127.0.0.1:3000' || true
|
||||||
+112
@@ -0,0 +1,112 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from huaweicloudsdkcore.auth.credentials import BasicCredentials
|
||||||
|
from huaweicloudsdkdns.v2 import (
|
||||||
|
CreateRecordSetRequest,
|
||||||
|
CreateRecordSetRequestBody,
|
||||||
|
DnsClient,
|
||||||
|
ListRecordSetsByZoneRequest,
|
||||||
|
ListPublicZonesRequest,
|
||||||
|
UpdateRecordSetRequest,
|
||||||
|
UpdateRecordSetReq,
|
||||||
|
)
|
||||||
|
from huaweicloudsdkdns.v2.region.dns_region import DnsRegion
|
||||||
|
|
||||||
|
|
||||||
|
ENV_FILE = Path("/etc/letsencrypt/huaweicloud-cnnetmkt.env")
|
||||||
|
ZONE_NAME = "cnnetmkt.top."
|
||||||
|
RECORD_NAME = "cnnetmkt.top."
|
||||||
|
TARGET_IP = "1.95.164.183"
|
||||||
|
|
||||||
|
|
||||||
|
def load_env() -> None:
|
||||||
|
for line in ENV_FILE.read_text().splitlines():
|
||||||
|
line = line.strip()
|
||||||
|
if not line or line.startswith("#") or "=" not in line:
|
||||||
|
continue
|
||||||
|
key, value = line.split("=", 1)
|
||||||
|
os.environ.setdefault(key, value)
|
||||||
|
|
||||||
|
|
||||||
|
def make_client() -> DnsClient:
|
||||||
|
ak = os.environ["HUAWEICLOUD_ACCESS_KEY_ID"]
|
||||||
|
sk = os.environ["HUAWEICLOUD_SECRET_ACCESS_KEY"]
|
||||||
|
region = os.environ.get("HUAWEICLOUD_REGION", "cn-southwest-2")
|
||||||
|
credentials = BasicCredentials(ak, sk)
|
||||||
|
return DnsClient.new_builder().with_credentials(credentials).with_region(DnsRegion.value_of(region)).build()
|
||||||
|
|
||||||
|
|
||||||
|
def as_dict(obj):
|
||||||
|
if hasattr(obj, "to_json_object"):
|
||||||
|
return obj.to_json_object()
|
||||||
|
if hasattr(obj, "to_dict"):
|
||||||
|
return obj.to_dict()
|
||||||
|
return obj
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
load_env()
|
||||||
|
client = make_client()
|
||||||
|
|
||||||
|
zones_resp = client.list_public_zones(ListPublicZonesRequest(name=ZONE_NAME))
|
||||||
|
zones = getattr(zones_resp, "zones", None) or []
|
||||||
|
if not zones:
|
||||||
|
raise RuntimeError(f"zone not found: {ZONE_NAME}")
|
||||||
|
zone = zones[0]
|
||||||
|
zone_id = zone.id
|
||||||
|
|
||||||
|
rs_req = ListRecordSetsByZoneRequest(zone_id=zone_id, name=RECORD_NAME, type="A")
|
||||||
|
rs_resp = client.list_record_sets_by_zone(rs_req)
|
||||||
|
recordsets = getattr(rs_resp, "recordsets", None) or []
|
||||||
|
existing = None
|
||||||
|
for item in recordsets:
|
||||||
|
if item.name == RECORD_NAME and item.type == "A":
|
||||||
|
existing = item
|
||||||
|
break
|
||||||
|
|
||||||
|
if existing:
|
||||||
|
records = list(existing.records or [])
|
||||||
|
if records == [TARGET_IP] and existing.status != "DISABLE":
|
||||||
|
action = "unchanged"
|
||||||
|
result = existing
|
||||||
|
else:
|
||||||
|
body = UpdateRecordSetReq(
|
||||||
|
name=RECORD_NAME,
|
||||||
|
type="A",
|
||||||
|
ttl=300,
|
||||||
|
records=[TARGET_IP],
|
||||||
|
description="AIOS GitOps apex entry",
|
||||||
|
)
|
||||||
|
req = UpdateRecordSetRequest(zone_id=zone_id, recordset_id=existing.id, body=body)
|
||||||
|
result = client.update_record_set(req)
|
||||||
|
action = "updated"
|
||||||
|
else:
|
||||||
|
body = CreateRecordSetRequestBody(
|
||||||
|
name=RECORD_NAME,
|
||||||
|
type="A",
|
||||||
|
ttl=300,
|
||||||
|
records=[TARGET_IP],
|
||||||
|
description="AIOS GitOps apex entry",
|
||||||
|
)
|
||||||
|
req = CreateRecordSetRequest(zone_id=zone_id, body=body)
|
||||||
|
result = client.create_record_set(req)
|
||||||
|
action = "created"
|
||||||
|
|
||||||
|
print(json.dumps({
|
||||||
|
"action": action,
|
||||||
|
"zone_id": zone_id,
|
||||||
|
"record": RECORD_NAME,
|
||||||
|
"type": "A",
|
||||||
|
"records": [TARGET_IP],
|
||||||
|
"result": as_dict(result),
|
||||||
|
}, ensure_ascii=False, indent=2))
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
raise SystemExit(main())
|
||||||
+113
@@ -0,0 +1,113 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Run from an operator machine that can SSH to both hw.imruyi.top and aihost.
|
||||||
|
# No secrets are embedded; the script uses existing server-side Docker/env state.
|
||||||
|
|
||||||
|
HW_HOST="${HW_HOST:-hw.imruyi.top}"
|
||||||
|
AIHOST_HOST="${AIHOST_HOST:-aihost}"
|
||||||
|
PRIMARY_AUTH="${PRIMARY_AUTH:-https://auth.cnnetmkt.top}"
|
||||||
|
PRIMARY_ENTRY="${PRIMARY_ENTRY:-https://cnnetmkt.top}"
|
||||||
|
UCC_DEPLOY_DIR="${UCC_DEPLOY_DIR:-/data/aios/aios_r13_v18_runtime_portable_silent_20260704/components/user-control-center/deploy}"
|
||||||
|
|
||||||
|
printf '== update Casdoor application on %s ==\n' "$AIHOST_HOST"
|
||||||
|
ssh "$AIHOST_HOST" bash -s <<'AIHOST'
|
||||||
|
set -euo pipefail
|
||||||
|
TS=$(date -u +%Y%m%dT%H%M%SZ)
|
||||||
|
BACKUP_DIR="/data/aios/backups/casdoor-cnnetmkt-primary-$TS"
|
||||||
|
sudo mkdir -p "$BACKUP_DIR"
|
||||||
|
sudo chown "$USER":"$USER" "$BACKUP_DIR"
|
||||||
|
docker exec casdoor-postgres pg_dump -U casdoor -d casdoor -t application > "$BACKUP_DIR/application-before.sql"
|
||||||
|
docker exec -i casdoor-postgres psql -U casdoor -d casdoor -v ON_ERROR_STOP=1 <<'SQL'
|
||||||
|
UPDATE application
|
||||||
|
SET
|
||||||
|
homepage_url = 'https://cnnetmkt.top/',
|
||||||
|
signin_url = 'https://cnnetmkt.top/portal/login/',
|
||||||
|
signup_url = 'https://cnnetmkt.top/portal/register/',
|
||||||
|
redirect_uris = '["https://cnnetmkt.top/api/auth/callback/casdoor", "https://cnnetmkt.top/casdoor/callback/", "https://portal.cnnetmkt.top/api/auth/callback/casdoor", "https://portal.cnnetmkt.top/casdoor/callback/", "https://user.cnnetmkt.top/api/auth/callback/casdoor", "https://user.cnnetmkt.top/casdoor/callback/", "https://portal.h.imruyi.top:8443/api/auth/callback/casdoor", "https://portal.h.imruyi.top:8443/casdoor/callback/"]'
|
||||||
|
WHERE owner = 'admin' AND name = 'aios-portal';
|
||||||
|
SQL
|
||||||
|
docker exec casdoor-postgres psql -U casdoor -d casdoor -P pager=off -c "select owner,name,homepage_url,signin_url,signup_url,redirect_uris from application where owner='admin' and name='aios-portal';" > "$BACKUP_DIR/application-after.txt"
|
||||||
|
cat "$BACKUP_DIR/application-after.txt"
|
||||||
|
printf 'casdoor_backup_dir=%s\n' "$BACKUP_DIR"
|
||||||
|
AIHOST
|
||||||
|
|
||||||
|
printf '\n== update HW ingress and UCC runtime on %s ==\n' "$HW_HOST"
|
||||||
|
ssh "$HW_HOST" bash -s <<HW
|
||||||
|
set -euo pipefail
|
||||||
|
TS=\$(date -u +%Y%m%dT%H%M%SZ)
|
||||||
|
BACKUP_DIR="/data/aios-gitops/backups/auth-cnnetmkt-primary-\$TS"
|
||||||
|
ENV_FILE="$UCC_DEPLOY_DIR/.env"
|
||||||
|
NGINX_AUTH="/etc/nginx/sites-available/auth-cnnetmkt-casdoor.conf"
|
||||||
|
sudo mkdir -p "\$BACKUP_DIR"
|
||||||
|
sudo cp -a "\$ENV_FILE" "\$BACKUP_DIR/user-control.env.before"
|
||||||
|
sudo cp -a /etc/nginx/sites-available "\$BACKUP_DIR/nginx-sites-available.before"
|
||||||
|
|
||||||
|
set_env() {
|
||||||
|
local key="\$1" value="\$2"
|
||||||
|
if sudo grep -q "^\${key}=" "\$ENV_FILE"; then
|
||||||
|
sudo sed -i "s#^\${key}=.*#\${key}=\${value}#" "\$ENV_FILE"
|
||||||
|
else
|
||||||
|
printf '%s=%s\n' "\$key" "\$value" | sudo tee -a "\$ENV_FILE" >/dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
set_env ALLOWED_HOSTS 'cnnetmkt.top,portal.cnnetmkt.top,user.cnnetmkt.top,auth.cnnetmkt.top,127.0.0.1,localhost,hw.imruyi.top,1.95.164.183,portal.h.imruyi.top'
|
||||||
|
set_env CSRF_TRUSTED_ORIGINS 'https://cnnetmkt.top,https://portal.cnnetmkt.top,https://user.cnnetmkt.top,https://auth.cnnetmkt.top,http://portal.cnnetmkt.top,http://hw.imruyi.top,http://1.95.164.183,https://portal.h.imruyi.top:8443,http://portal.h.imruyi.top,http://user.cnnetmkt.top'
|
||||||
|
set_env UCC_PUBLIC_BASE_URL '$PRIMARY_ENTRY'
|
||||||
|
set_env CASDOOR_PUBLIC_BASE_URL '$PRIMARY_AUTH'
|
||||||
|
set_env CASDOOR_INTERNAL_BASE_URL '$PRIMARY_AUTH'
|
||||||
|
set_env CASDOOR_INVITE_SYNC_BASE_URL '$PRIMARY_AUTH'
|
||||||
|
|
||||||
|
sudo tee "\$NGINX_AUTH" >/dev/null <<'NGINX'
|
||||||
|
# AIOS primary public Casdoor entry for cnnetmkt.top.
|
||||||
|
# The upstream remains the existing backup/home Casdoor service; public clients should see auth.cnnetmkt.top only.
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
listen [::]:443 ssl;
|
||||||
|
server_name auth.cnnetmkt.top;
|
||||||
|
|
||||||
|
access_log /var/log/nginx/aios-auth-cnnetmkt.access.log;
|
||||||
|
error_log /var/log/nginx/aios-auth-cnnetmkt.error.log;
|
||||||
|
|
||||||
|
ssl_certificate /etc/letsencrypt/live/cnnetmkt-wildcard/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/cnnetmkt-wildcard/privkey.pem;
|
||||||
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
||||||
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass https://auth.h.imruyi.top:8443;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_ssl_server_name on;
|
||||||
|
proxy_ssl_name auth.h.imruyi.top;
|
||||||
|
proxy_ssl_verify off;
|
||||||
|
proxy_set_header Host auth.h.imruyi.top;
|
||||||
|
proxy_set_header X-Real-IP \$remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto https;
|
||||||
|
proxy_set_header X-Forwarded-Host \$host;
|
||||||
|
proxy_set_header X-Forwarded-Port 443;
|
||||||
|
proxy_set_header Upgrade \$http_upgrade;
|
||||||
|
proxy_set_header Connection \$connection_upgrade;
|
||||||
|
proxy_redirect https://auth.h.imruyi.top:8443/ https://auth.cnnetmkt.top/;
|
||||||
|
proxy_redirect https://auth.h.imruyi.top/ https://auth.cnnetmkt.top/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name auth.cnnetmkt.top;
|
||||||
|
return 301 https://\$host\$request_uri;
|
||||||
|
}
|
||||||
|
NGINX
|
||||||
|
|
||||||
|
sudo ln -sf "\$NGINX_AUTH" /etc/nginx/sites-enabled/auth-cnnetmkt-casdoor.conf
|
||||||
|
sudo nginx -t
|
||||||
|
sudo systemctl reload nginx
|
||||||
|
cd "$UCC_DEPLOY_DIR"
|
||||||
|
sudo docker compose up -d --force-recreate user-control-web user-control-worker user-control-beat
|
||||||
|
printf 'hw_backup_dir=%s\n' "\$BACKUP_DIR"
|
||||||
|
HW
|
||||||
|
|
||||||
|
"$(dirname "$0")/check_cnnetmkt_auth_primary.sh"
|
||||||
+141
@@ -0,0 +1,141 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT="/data/aios-gitops"
|
||||||
|
WORKSPACE="$ROOT/workspace"
|
||||||
|
LOG="$ROOT/logs/g-cnnetmkt-ingress-fix.log"
|
||||||
|
BACKUP_DIR="$ROOT/backups/nginx-g-cnnetmkt-$(date +%Y%m%d-%H%M%S)"
|
||||||
|
SITE="/etc/nginx/sites-available/aios-user-portal.conf"
|
||||||
|
TRACKED="$WORKSPACE/deploy/nginx/g-cnnetmkt-gitea-server.conf"
|
||||||
|
REPORT="$ROOT/artifacts/CNNETMKT_SSL_INGRESS_STATUS.md"
|
||||||
|
mkdir -p "$ROOT/logs" "$BACKUP_DIR" "$WORKSPACE/deploy/nginx" "$ROOT/artifacts"
|
||||||
|
exec > >(tee -a "$LOG") 2>&1
|
||||||
|
|
||||||
|
echo "== backup =="
|
||||||
|
sudo cp -a "$SITE" "$BACKUP_DIR/aios-user-portal.conf"
|
||||||
|
|
||||||
|
cat > "$TRACKED" <<'NGINX'
|
||||||
|
# AIOS GitOps alias for https://g.cnnetmkt.top/
|
||||||
|
# Note: this server block intentionally keeps /git/ as the Gitea app prefix,
|
||||||
|
# matching the current Gitea ROOT_URL and avoiding a disruptive app.ini rewrite.
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
listen [::]:443 ssl;
|
||||||
|
server_name g.cnnetmkt.top;
|
||||||
|
|
||||||
|
access_log /var/log/nginx/aios-g-cnnetmkt.access.log;
|
||||||
|
error_log /var/log/nginx/aios-g-cnnetmkt.error.log;
|
||||||
|
|
||||||
|
ssl_certificate /etc/letsencrypt/live/user.cnnetmkt.top/fullchain.pem;
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/user.cnnetmkt.top/privkey.pem;
|
||||||
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
||||||
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
||||||
|
|
||||||
|
location = / {
|
||||||
|
return 302 /git/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /git {
|
||||||
|
return 302 /git/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /git/ {
|
||||||
|
proxy_pass http://127.0.0.1:3000/;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-Forwarded-Host $host;
|
||||||
|
proxy_set_header X-Forwarded-Prefix /git;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection $connection_upgrade;
|
||||||
|
proxy_redirect off;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name g.cnnetmkt.top;
|
||||||
|
|
||||||
|
location = / {
|
||||||
|
return 302 https://$host/git/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NGINX
|
||||||
|
|
||||||
|
echo "== install g.cnnetmkt server block =="
|
||||||
|
sudo cp "$TRACKED" /etc/nginx/sites-available/g-cnnetmkt-gitea.conf
|
||||||
|
sudo ln -sfn /etc/nginx/sites-available/g-cnnetmkt-gitea.conf /etc/nginx/sites-enabled/g-cnnetmkt-gitea.conf
|
||||||
|
sudo nginx -t
|
||||||
|
sudo systemctl reload nginx
|
||||||
|
|
||||||
|
echo "== local validation before cert expand =="
|
||||||
|
for h in g.cnnetmkt.top cnnetmkt.top user.cnnetmkt.top; do
|
||||||
|
echo "-- $h /"
|
||||||
|
curl -k -sS -D - -o /tmp/aios-body --resolve "$h:443:127.0.0.1" "https://$h/" | sed -n '1,12p' || true
|
||||||
|
grep -ao '<title>[^<]*' /tmp/aios-body 2>/dev/null | head -1 || true
|
||||||
|
echo "-- $h /git/"
|
||||||
|
curl -k -sS -D - -o /tmp/aios-body --resolve "$h:443:127.0.0.1" "https://$h/git/" | sed -n '1,12p' || true
|
||||||
|
grep -ao '<title>[^<]*' /tmp/aios-body 2>/dev/null | head -1 || true
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "== certbot dry run expand for g/user/portal =="
|
||||||
|
CERTBOT_STATUS="not-run"
|
||||||
|
if sudo certbot certonly --nginx --cert-name user.cnnetmkt.top \
|
||||||
|
-d user.cnnetmkt.top -d portal.cnnetmkt.top -d g.cnnetmkt.top \
|
||||||
|
--expand --dry-run --non-interactive --agree-tos; then
|
||||||
|
CERTBOT_STATUS="dry-run-ok"
|
||||||
|
else
|
||||||
|
CERTBOT_STATUS="dry-run-failed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$CERTBOT_STATUS" = "dry-run-ok" ]; then
|
||||||
|
echo "== certbot real expand for g/user/portal =="
|
||||||
|
if sudo certbot certonly --nginx --cert-name user.cnnetmkt.top \
|
||||||
|
-d user.cnnetmkt.top -d portal.cnnetmkt.top -d g.cnnetmkt.top \
|
||||||
|
--expand --non-interactive --agree-tos; then
|
||||||
|
CERTBOT_STATUS="issued-g-user-portal"
|
||||||
|
sudo nginx -t
|
||||||
|
sudo systemctl reload nginx
|
||||||
|
else
|
||||||
|
CERTBOT_STATUS="real-issue-failed"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "== final cert and route validation =="
|
||||||
|
{
|
||||||
|
echo "# cnnetmkt SSL ingress status"
|
||||||
|
echo
|
||||||
|
echo "generated_at=$(date -Is)"
|
||||||
|
echo "g_route_status=installed"
|
||||||
|
echo "certbot_status=$CERTBOT_STATUS"
|
||||||
|
echo "apex_dns_status=blocked_until_cnnetmkt.top_has_A_record_to_1.95.164.183"
|
||||||
|
echo "wildcard_status=blocked_until_dns01_provider_credentials_available"
|
||||||
|
echo "backup_dir=$BACKUP_DIR"
|
||||||
|
echo "tracked_nginx=$TRACKED"
|
||||||
|
echo
|
||||||
|
echo "## validation"
|
||||||
|
for h in g.cnnetmkt.top cnnetmkt.top user.cnnetmkt.top; do
|
||||||
|
echo "### $h"
|
||||||
|
curl -k -sS -D - -o /tmp/aios-body --resolve "$h:443:127.0.0.1" "https://$h/" | sed -n '1,12p' || true
|
||||||
|
grep -ao '<title>[^<]*' /tmp/aios-body 2>/dev/null | head -1 || true
|
||||||
|
echo
|
||||||
|
echo | openssl s_client -connect 127.0.0.1:443 -servername "$h" 2>/dev/null \
|
||||||
|
| openssl x509 -noout -subject -issuer -dates -ext subjectAltName 2>/dev/null || true
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
echo "## certbot"
|
||||||
|
sudo certbot certificates || true
|
||||||
|
} | tee "$REPORT"
|
||||||
|
|
||||||
|
cd "$WORKSPACE"
|
||||||
|
git add deploy/nginx/g-cnnetmkt-gitea-server.conf
|
||||||
|
git commit -m "fix(ingress): add g.cnnetmkt.top GitOps alias" || true
|
||||||
|
|
||||||
|
echo "G_CNNETMKT_INGRESS_FIX_DONE certbot_status=$CERTBOT_STATUS report=$REPORT"
|
||||||
+252
@@ -0,0 +1,252 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [ "${EUID:-$(id -u)}" -ne 0 ]; then
|
||||||
|
exec sudo bash "$0" "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ROOT="/data/aios-gitops"
|
||||||
|
WORKSPACE="$ROOT/workspace"
|
||||||
|
LEGO_BIN="$ROOT/runtime/bin/lego"
|
||||||
|
LEGO_PATH="/etc/letsencrypt/lego-cnnetmkt"
|
||||||
|
LIVE_DIR="/etc/letsencrypt/live/cnnetmkt-wildcard"
|
||||||
|
ENV_FILE="/etc/letsencrypt/huaweicloud-cnnetmkt.env"
|
||||||
|
LOG="$ROOT/logs/cnnetmkt-wildcard-lego.log"
|
||||||
|
REPORT="$ROOT/artifacts/CNNETMKT_WILDCARD_CERT_STATUS.md"
|
||||||
|
TRACKED="$WORKSPACE/deploy/nginx/cnnetmkt-wildcard-certificate.md"
|
||||||
|
BACKUP_DIR="$ROOT/backups/nginx-wildcard-$(date +%Y%m%d-%H%M%S)"
|
||||||
|
EMAIL="admin@cnnetmkt.top"
|
||||||
|
CERT_NAME="cnnetmkt-wildcard"
|
||||||
|
LEGO_VERSION="v5.2.2"
|
||||||
|
LEGO_URL="https://github.com/go-acme/lego/releases/download/${LEGO_VERSION}/lego_${LEGO_VERSION}_linux_amd64.tar.gz"
|
||||||
|
mkdir -p "$ROOT/logs" "$ROOT/runtime/bin" "$ROOT/artifacts" "$WORKSPACE/deploy/nginx" "$BACKUP_DIR"
|
||||||
|
exec > >(tee -a "$LOG") 2>&1
|
||||||
|
|
||||||
|
redact() {
|
||||||
|
sed -E 's/(ACCESS_KEY_ID=).+/\1[REDACTED]/; s/(SECRET_ACCESS_KEY=).+/\1[REDACTED]/'
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "== preflight =="
|
||||||
|
hostname
|
||||||
|
date -Is
|
||||||
|
test -s "$ENV_FILE"
|
||||||
|
sudo chmod 600 "$ENV_FILE"
|
||||||
|
sudo chown root:root "$ENV_FILE"
|
||||||
|
echo "env_file=$ENV_FILE"
|
||||||
|
sudo sed -n '1,20p' "$ENV_FILE" | redact
|
||||||
|
|
||||||
|
echo "== install lego =="
|
||||||
|
if [ ! -x "$LEGO_BIN" ]; then
|
||||||
|
tmp="$(mktemp -d)"
|
||||||
|
curl -fL --retry 3 --connect-timeout 30 -o "$tmp/lego.tar.gz" "$LEGO_URL"
|
||||||
|
tar -xzf "$tmp/lego.tar.gz" -C "$tmp"
|
||||||
|
install -m 0755 "$tmp/lego" "$LEGO_BIN"
|
||||||
|
rm -rf "$tmp"
|
||||||
|
fi
|
||||||
|
"$LEGO_BIN" --version
|
||||||
|
|
||||||
|
echo "== load env =="
|
||||||
|
set -a
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
. "$ENV_FILE"
|
||||||
|
set +a
|
||||||
|
: "${HUAWEICLOUD_ACCESS_KEY_ID:?missing access key id}"
|
||||||
|
: "${HUAWEICLOUD_SECRET_ACCESS_KEY:?missing secret access key}"
|
||||||
|
: "${HUAWEICLOUD_REGION:?missing huawei region}"
|
||||||
|
export HUAWEICLOUD_HTTP_TIMEOUT="${HUAWEICLOUD_HTTP_TIMEOUT:-30}"
|
||||||
|
export HUAWEICLOUD_PROPAGATION_TIMEOUT="${HUAWEICLOUD_PROPAGATION_TIMEOUT:-180}"
|
||||||
|
export HUAWEICLOUD_POLLING_INTERVAL="${HUAWEICLOUD_POLLING_INTERVAL:-5}"
|
||||||
|
export HUAWEICLOUD_TTL="${HUAWEICLOUD_TTL:-300}"
|
||||||
|
|
||||||
|
echo "== DNS state =="
|
||||||
|
for n in cnnetmkt.top g.cnnetmkt.top user.cnnetmkt.top portal.cnnetmkt.top; do
|
||||||
|
echo "-- $n"
|
||||||
|
dig +time=5 +tries=1 +short "$n" A || true
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "== staging DNS-01 =="
|
||||||
|
STAGING_STATUS="failed"
|
||||||
|
if sudo --preserve-env=HUAWEICLOUD_ACCESS_KEY_ID,HUAWEICLOUD_SECRET_ACCESS_KEY,HUAWEICLOUD_REGION,HUAWEICLOUD_HTTP_TIMEOUT,HUAWEICLOUD_PROPAGATION_TIMEOUT,HUAWEICLOUD_POLLING_INTERVAL,HUAWEICLOUD_TTL \
|
||||||
|
"$LEGO_BIN" run --path "$LEGO_PATH-staging" --email "$EMAIL" --accept-tos \
|
||||||
|
--server "https://acme-staging-v02.api.letsencrypt.org/directory" \
|
||||||
|
--dns huaweicloud --dns.propagation.wait 120s --cert.name "$CERT_NAME" --domains "cnnetmkt.top" --domains "*.cnnetmkt.top"; then
|
||||||
|
STAGING_STATUS="ok"
|
||||||
|
fi
|
||||||
|
echo "staging_status=$STAGING_STATUS"
|
||||||
|
if [ "$STAGING_STATUS" != "ok" ]; then
|
||||||
|
echo "STAGING_DNS01_FAILED"
|
||||||
|
exit 20
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "== production DNS-01 =="
|
||||||
|
PROD_STATUS="failed"
|
||||||
|
if sudo --preserve-env=HUAWEICLOUD_ACCESS_KEY_ID,HUAWEICLOUD_SECRET_ACCESS_KEY,HUAWEICLOUD_REGION,HUAWEICLOUD_HTTP_TIMEOUT,HUAWEICLOUD_PROPAGATION_TIMEOUT,HUAWEICLOUD_POLLING_INTERVAL,HUAWEICLOUD_TTL \
|
||||||
|
"$LEGO_BIN" run --path "$LEGO_PATH" --email "$EMAIL" --accept-tos \
|
||||||
|
--dns huaweicloud --dns.propagation.wait 120s --cert.name "$CERT_NAME" --domains "cnnetmkt.top" --domains "*.cnnetmkt.top"; then
|
||||||
|
PROD_STATUS="issued"
|
||||||
|
else
|
||||||
|
sudo --preserve-env=HUAWEICLOUD_ACCESS_KEY_ID,HUAWEICLOUD_SECRET_ACCESS_KEY,HUAWEICLOUD_REGION,HUAWEICLOUD_HTTP_TIMEOUT,HUAWEICLOUD_PROPAGATION_TIMEOUT,HUAWEICLOUD_POLLING_INTERVAL,HUAWEICLOUD_TTL \
|
||||||
|
"$LEGO_BIN" run --path "$LEGO_PATH" --email "$EMAIL" --accept-tos \
|
||||||
|
--dns huaweicloud --dns.propagation.wait 120s --cert.name "$CERT_NAME" --domains "cnnetmkt.top" --domains "*.cnnetmkt.top" --renew-days 60 --renew-force
|
||||||
|
PROD_STATUS="renewed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "== install cert material =="
|
||||||
|
sudo mkdir -p "$LIVE_DIR"
|
||||||
|
cert_file="$(sudo find "$LEGO_PATH/certificates" -maxdepth 1 -type f -name '*.crt' ! -name '*.issuer.crt' | head -1)"
|
||||||
|
key_file="$(sudo find "$LEGO_PATH/certificates" -maxdepth 1 -type f -name '*.key' | head -1)"
|
||||||
|
issuer_file="$(sudo find "$LEGO_PATH/certificates" -maxdepth 1 -type f -name '*.issuer.crt' | head -1 || true)"
|
||||||
|
test -n "$cert_file"
|
||||||
|
test -n "$key_file"
|
||||||
|
sudo cp "$key_file" "$LIVE_DIR/privkey.pem"
|
||||||
|
if [ -n "${issuer_file:-}" ] && [ -f "$issuer_file" ]; then
|
||||||
|
sudo sh -c "cat '$cert_file' '$issuer_file' > '$LIVE_DIR/fullchain.pem'"
|
||||||
|
sudo cp "$issuer_file" "$LIVE_DIR/chain.pem"
|
||||||
|
else
|
||||||
|
sudo cp "$cert_file" "$LIVE_DIR/fullchain.pem"
|
||||||
|
fi
|
||||||
|
sudo chmod 644 "$LIVE_DIR/fullchain.pem" "$LIVE_DIR/chain.pem" 2>/dev/null || true
|
||||||
|
sudo chmod 600 "$LIVE_DIR/privkey.pem"
|
||||||
|
|
||||||
|
echo "== verify cert material =="
|
||||||
|
sudo openssl x509 -in "$LIVE_DIR/fullchain.pem" -noout -subject -issuer -dates -ext subjectAltName
|
||||||
|
|
||||||
|
echo "== patch nginx cert paths =="
|
||||||
|
sudo cp -a /etc/nginx/sites-available/aios-user-portal.conf "$BACKUP_DIR/aios-user-portal.conf"
|
||||||
|
sudo cp -a /etc/nginx/sites-available/g-cnnetmkt-gitea.conf "$BACKUP_DIR/g-cnnetmkt-gitea.conf" 2>/dev/null || true
|
||||||
|
sudo python3 - <<'PY'
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
files = [
|
||||||
|
Path("/etc/nginx/sites-available/aios-user-portal.conf"),
|
||||||
|
Path("/etc/nginx/sites-available/g-cnnetmkt-gitea.conf"),
|
||||||
|
]
|
||||||
|
for path in files:
|
||||||
|
if not path.exists():
|
||||||
|
continue
|
||||||
|
text = path.read_text()
|
||||||
|
text = text.replace(
|
||||||
|
"/etc/letsencrypt/live/user.cnnetmkt.top/fullchain.pem",
|
||||||
|
"/etc/letsencrypt/live/cnnetmkt-wildcard/fullchain.pem",
|
||||||
|
)
|
||||||
|
text = text.replace(
|
||||||
|
"/etc/letsencrypt/live/user.cnnetmkt.top/privkey.pem",
|
||||||
|
"/etc/letsencrypt/live/cnnetmkt-wildcard/privkey.pem",
|
||||||
|
)
|
||||||
|
path.write_text(text)
|
||||||
|
PY
|
||||||
|
|
||||||
|
sudo nginx -t
|
||||||
|
sudo systemctl reload nginx
|
||||||
|
|
||||||
|
echo "== validation =="
|
||||||
|
for h in cnnetmkt.top g.cnnetmkt.top user.cnnetmkt.top portal.cnnetmkt.top; do
|
||||||
|
echo "-- $h cert"
|
||||||
|
echo | openssl s_client -connect 127.0.0.1:443 -servername "$h" 2>/dev/null \
|
||||||
|
| openssl x509 -noout -subject -issuer -dates -ext subjectAltName 2>/dev/null || true
|
||||||
|
echo "-- $h /"
|
||||||
|
curl -k -sS -D - -o /tmp/cnnetmkt-body --resolve "$h:443:127.0.0.1" "https://$h/" | sed -n '1,12p' || true
|
||||||
|
grep -ao '<title>[^<]*' /tmp/cnnetmkt-body 2>/dev/null | head -1 || true
|
||||||
|
echo "-- $h /git/"
|
||||||
|
curl -k -sS -D - -o /tmp/cnnetmkt-body --resolve "$h:443:127.0.0.1" "https://$h/git/" | sed -n '1,12p' || true
|
||||||
|
grep -ao '<title>[^<]*' /tmp/cnnetmkt-body 2>/dev/null | head -1 || true
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "== write renewal helper =="
|
||||||
|
sudo tee /usr/local/sbin/renew-cnnetmkt-wildcard.sh >/dev/null <<'SH'
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
ROOT="/data/aios-gitops"
|
||||||
|
LEGO_BIN="$ROOT/runtime/bin/lego"
|
||||||
|
LEGO_PATH="/etc/letsencrypt/lego-cnnetmkt"
|
||||||
|
LIVE_DIR="/etc/letsencrypt/live/cnnetmkt-wildcard"
|
||||||
|
ENV_FILE="/etc/letsencrypt/huaweicloud-cnnetmkt.env"
|
||||||
|
set -a
|
||||||
|
. "$ENV_FILE"
|
||||||
|
set +a
|
||||||
|
sudo --preserve-env=HUAWEICLOUD_ACCESS_KEY_ID,HUAWEICLOUD_SECRET_ACCESS_KEY,HUAWEICLOUD_REGION,HUAWEICLOUD_HTTP_TIMEOUT,HUAWEICLOUD_PROPAGATION_TIMEOUT,HUAWEICLOUD_POLLING_INTERVAL,HUAWEICLOUD_TTL \
|
||||||
|
"$LEGO_BIN" run --path "$LEGO_PATH" --email "admin@cnnetmkt.top" --accept-tos \
|
||||||
|
--dns huaweicloud --dns.propagation.wait 120s --cert.name "cnnetmkt-wildcard" --domains "cnnetmkt.top" --domains "*.cnnetmkt.top" --renew-days 45
|
||||||
|
cert_file="$(find "$LEGO_PATH/certificates" -maxdepth 1 -type f -name '*.crt' ! -name '*.issuer.crt' | head -1)"
|
||||||
|
key_file="$(find "$LEGO_PATH/certificates" -maxdepth 1 -type f -name '*.key' | head -1)"
|
||||||
|
cp "$cert_file" "$LIVE_DIR/fullchain.pem"
|
||||||
|
cp "$key_file" "$LIVE_DIR/privkey.pem"
|
||||||
|
chmod 644 "$LIVE_DIR/fullchain.pem"
|
||||||
|
chmod 600 "$LIVE_DIR/privkey.pem"
|
||||||
|
nginx -t
|
||||||
|
systemctl reload nginx
|
||||||
|
SH
|
||||||
|
sudo chmod 700 /usr/local/sbin/renew-cnnetmkt-wildcard.sh
|
||||||
|
|
||||||
|
sudo tee /etc/systemd/system/cnnetmkt-wildcard-renew.service >/dev/null <<'UNIT'
|
||||||
|
[Unit]
|
||||||
|
Description=Renew cnnetmkt wildcard certificate via Huawei Cloud DNS
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/local/sbin/renew-cnnetmkt-wildcard.sh
|
||||||
|
UNIT
|
||||||
|
|
||||||
|
sudo tee /etc/systemd/system/cnnetmkt-wildcard-renew.timer >/dev/null <<'UNIT'
|
||||||
|
[Unit]
|
||||||
|
Description=Daily cnnetmkt wildcard certificate renewal check
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=daily
|
||||||
|
RandomizedDelaySec=2h
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
|
UNIT
|
||||||
|
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl enable --now cnnetmkt-wildcard-renew.timer
|
||||||
|
|
||||||
|
cat > "$TRACKED" <<EOF_TRACKED
|
||||||
|
# cnnetmkt wildcard certificate
|
||||||
|
|
||||||
|
generated_at=$(date -Is)
|
||||||
|
issuer=Let's Encrypt via lego DNS-01 Huawei Cloud
|
||||||
|
domains=cnnetmkt.top,*.cnnetmkt.top
|
||||||
|
live_dir=$LIVE_DIR
|
||||||
|
nginx_sites=/etc/nginx/sites-available/aios-user-portal.conf,/etc/nginx/sites-available/g-cnnetmkt-gitea.conf
|
||||||
|
renew_service=cnnetmkt-wildcard-renew.service
|
||||||
|
renew_timer=cnnetmkt-wildcard-renew.timer
|
||||||
|
secret_env=$ENV_FILE
|
||||||
|
backup_dir=$BACKUP_DIR
|
||||||
|
status=$PROD_STATUS
|
||||||
|
EOF_TRACKED
|
||||||
|
|
||||||
|
cat > "$REPORT" <<EOF_REPORT
|
||||||
|
# CNNETMKT wildcard certificate status
|
||||||
|
|
||||||
|
generated_at=$(date -Is)
|
||||||
|
status=$PROD_STATUS
|
||||||
|
staging_status=$STAGING_STATUS
|
||||||
|
dns_provider=huaweicloud
|
||||||
|
secret_storage=$ENV_FILE
|
||||||
|
certificate_live_dir=$LIVE_DIR
|
||||||
|
nginx_status=loaded
|
||||||
|
backup_dir=$BACKUP_DIR
|
||||||
|
renew_timer=cnnetmkt-wildcard-renew.timer
|
||||||
|
|
||||||
|
## certificate
|
||||||
|
|
||||||
|
$(sudo openssl x509 -in "$LIVE_DIR/fullchain.pem" -noout -subject -issuer -dates -ext subjectAltName)
|
||||||
|
|
||||||
|
## routes
|
||||||
|
|
||||||
|
- https://cnnetmkt.top/
|
||||||
|
- https://cnnetmkt.top/git/
|
||||||
|
- https://g.cnnetmkt.top/
|
||||||
|
- https://g.cnnetmkt.top/git/
|
||||||
|
- https://user.cnnetmkt.top/
|
||||||
|
EOF_REPORT
|
||||||
|
|
||||||
|
cd "$WORKSPACE"
|
||||||
|
chown -R aiman:aiman "$WORKSPACE/deploy/nginx" "$ROOT/artifacts" "$ROOT/logs"
|
||||||
|
runuser -u aiman -- git add deploy/nginx/cnnetmkt-wildcard-certificate.md
|
||||||
|
runuser -u aiman -- git commit -m "fix(ingress): switch cnnetmkt to wildcard certificate" || true
|
||||||
|
|
||||||
|
echo "CNNETMKT_WILDCARD_DONE status=$PROD_STATUS report=$REPORT"
|
||||||
+35
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
ENV_FILE="${UCC_ENV_FILE:-/data/aios/aios_r13_v18_runtime_portable_silent_20260704/components/user-control-center/deploy/.env}"
|
||||||
|
GITEA_BIN="${GITEA_BIN:-/data/aios-gitops/runtime/bin/gitea}"
|
||||||
|
APP_INI="${GITEA_APP_INI:-/data/aios-gitops/runtime/gitea-bin/custom/conf/app.ini}"
|
||||||
|
WORK_PATH="${GITEA_WORK_PATH:-/data/aios-gitops/runtime/gitea-bin}"
|
||||||
|
DB="${GITEA_DB:-/data/aios-gitops/runtime/gitea-bin/data/gitea.db}"
|
||||||
|
set -a
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
. "$ENV_FILE"
|
||||||
|
set +a
|
||||||
|
strip_trailing_cr() {
|
||||||
|
printf '%s' "${1:-}" | tr -d '\r'
|
||||||
|
}
|
||||||
|
OWNER_USERNAME="$(strip_trailing_cr "${UCC_OWNER_USERNAME:-owner}")"
|
||||||
|
OWNER_EMAIL="$(strip_trailing_cr "${UCC_OWNER_EMAIL:-owner@cnnetmkt.top}")"
|
||||||
|
OWNER_PASSWORD="$(strip_trailing_cr "${UCC_OWNER_PASSWORD:?UCC_OWNER_PASSWORD is required}")"
|
||||||
|
GITEA_RUN_USER="${GITEA_RUN_USER:-aiman}"
|
||||||
|
run_gitea() {
|
||||||
|
runuser -u "$GITEA_RUN_USER" -- "$GITEA_BIN" --config "$APP_INI" --work-path "$WORK_PATH" "$@"
|
||||||
|
}
|
||||||
|
if run_gitea admin user list 2>/dev/null | awk '{print $2}' | grep -Fxq "$OWNER_USERNAME"; then
|
||||||
|
run_gitea admin user change-password --username "$OWNER_USERNAME" --password "$OWNER_PASSWORD" --must-change-password=false >/dev/null
|
||||||
|
else
|
||||||
|
run_gitea admin user create --username "$OWNER_USERNAME" --password "$OWNER_PASSWORD" --email "$OWNER_EMAIL" --admin --must-change-password=false >/dev/null
|
||||||
|
fi
|
||||||
|
python3 - <<PY
|
||||||
|
import sqlite3, time
|
||||||
|
con=sqlite3.connect('$DB')
|
||||||
|
cur=con.cursor()
|
||||||
|
cur.execute("update user set is_admin=1,is_active=1,prohibit_login=0,must_change_password=0,updated_unix=? where lower_name=lower(?)", (int(time.time()), '$OWNER_USERNAME'))
|
||||||
|
cur.execute("update user set prohibit_login=1,is_admin=0,passwd='',passwd_hash_algo='disabled',must_change_password=1,updated_unix=? where lower_name in ('aios','admin','gitea') and lower_name<>lower(?)", (int(time.time()), '$OWNER_USERNAME'))
|
||||||
|
con.commit()
|
||||||
|
PY
|
||||||
|
printf 'GITEA_OWNER_SYNC_OK user=%s default_local_login_disabled=1\n' "$OWNER_USERNAME"
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"id": "nl-1783382614842-6c6112e8",
|
||||||
|
"text": "自我进化执行主体策略更新:除 Windows Codex App 外,同时增加服务器上的 OpenClaw Agent 与 Hermes Agent 作为执行主体。允许启动多个服务器 Agent 并行执行;默认以服务器上的 Agent 为主,Windows Codex App 作为协同执行主体。困难时刻允许访问 https://chatgpt.com/chat/gpt-6a4ba70a063c8191a89bc2d86a4c7fa0-codex-chartgpt-bridge 求助或交互。分歧时刻允许多个 Agent 投票决策;自定义 GPT 权重为双倍,Windows Codex App 权重为双倍。服务器 Agent 默认参与并行协作。该策略应以 GitOps 可审计方式进入自我进化 agent orchestration proposal,不直接执行 V-level 版本变更,不写入任何凭据。",
|
||||||
|
"intent": "unknown",
|
||||||
|
"action_plan": [],
|
||||||
|
"execute": false,
|
||||||
|
"owner_approval_required": true,
|
||||||
|
"created_by": "gitops-write-bot",
|
||||||
|
"created_at": "2026-07-07T00:03:34Z"
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"id": "nl-1783390999250-8627c20c",
|
||||||
|
"text": "基于 V1R1C4 baseline 和 patch/self-evolution-agent-orchestration-policy 全量重新架构优化:服务器 OpenClaw 与 Hermes 作为主要执行智能体;Codex ChartGPT Bridge 作为架构审核、方案建议和困难问题升级入口;Windows Codex App 作为异常恢复、管理员授权协助和多智能体投票参与者。所有操作基于在线 GitOps 版本。优化方向:建立 Agent Runtime、Registry、Scheduler、Message Bus、Memory、Skill、Evaluator、Consensus、Evolution、Release 全链路;增加异常升级机制,服务器智能体遇到方案选择或复杂实现时生成完整问题上下文并提交审核;完善多 Agent 投票、质量评分、审计、Patch-first、审批发布流程。生成后续实施 proposal,不直接进行生产发布。",
|
||||||
|
"intent": "patch_create",
|
||||||
|
"action_plan": [
|
||||||
|
"call POST /api/patch"
|
||||||
|
],
|
||||||
|
"execute": false,
|
||||||
|
"owner_approval_required": true,
|
||||||
|
"created_by": "gitops-write-bot",
|
||||||
|
"created_at": "2026-07-07T02:23:19Z"
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"type": "branch",
|
||||||
|
"branch": "patch/collab-custom-gpt-20260706T104130Z",
|
||||||
|
"base": "main",
|
||||||
|
"created_by": "chatgpt-gitops-bot",
|
||||||
|
"created_at": "2026-07-06T10:41:30Z",
|
||||||
|
"direct_main_push": false,
|
||||||
|
"owner_approval_required": true
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"type": "branch",
|
||||||
|
"branch": "patch/collab-local-codex-20260706T104130Z",
|
||||||
|
"base": "main",
|
||||||
|
"created_by": "codex-gitops-bot",
|
||||||
|
"created_at": "2026-07-06T10:41:30Z",
|
||||||
|
"direct_main_push": false,
|
||||||
|
"owner_approval_required": true
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"id": "patch-1783382848267-49ea7747",
|
||||||
|
"patch_name": "self-evolution-agent-orchestration-policy",
|
||||||
|
"branch": "patch/self-evolution-agent-orchestration-policy",
|
||||||
|
"risk": "medium",
|
||||||
|
"description": "Formalize self-evolution execution主体策略: add server-side OpenClaw Agent and Hermes Agent alongside Windows Codex App; allow multiple server agents to run in parallel with server agents as primary; allow difficult cases to consult/interact with Codex ChartGPT Bridge; allow voting on disputes with custom GPT weight x2 and Windows Codex App weight x2. No credentials stored.",
|
||||||
|
"created_by": "gitops-write-bot",
|
||||||
|
"created_at": "2026-07-07T00:07:28Z"
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"version": "V1R1C5",
|
||||||
|
"status": "proposal",
|
||||||
|
"source_branch": "patch/self-evolution-agent-orchestration-policy",
|
||||||
|
"objective": "Integrate Agent OS multi-agent orchestration capabilities into next evolution version",
|
||||||
|
"changes": [
|
||||||
|
"Enable server OpenClaw and Hermes agent execution model",
|
||||||
|
"Enable Custom GPT review escalation workflow",
|
||||||
|
"Enable Windows Codex recovery and authorization assistance workflow",
|
||||||
|
"Integrate Agent Runtime components",
|
||||||
|
"Integrate instruction center and versioned agent operations",
|
||||||
|
"Enable consensus and continuous evolution workflow"
|
||||||
|
],
|
||||||
|
"validation": {
|
||||||
|
"acceptance_report": "reports/self-evolution-agent-os-acceptance-report-v1.md",
|
||||||
|
"integration_test": "runtime/agent-os/integration_test.py"
|
||||||
|
},
|
||||||
|
"release_policy": {
|
||||||
|
"requires_owner_approval": true,
|
||||||
|
"direct_main_push": false,
|
||||||
|
"direct_production_publish": false
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
# V1R1C5 Custom GPT Solution Review Result v1
|
||||||
|
|
||||||
|
Status: completed
|
||||||
|
Reviewer: custom_gpt_review
|
||||||
|
|
||||||
|
## Instruction
|
||||||
|
|
||||||
|
- Instruction: `agent-instructions/custom_gpt_review/solution-review-v1.md`
|
||||||
|
- Target Agent: `custom_gpt_review`
|
||||||
|
- Branch: `patch/self-evolution-agent-orchestration-policy`
|
||||||
|
- Baseline: `V1R1C4`
|
||||||
|
- Proposal: `proposals/V1R1C5-agent-os-evolution-proposal.json`
|
||||||
|
|
||||||
|
## Problem Context
|
||||||
|
|
||||||
|
V1R1C5 proposes to integrate Agent OS multi-agent orchestration capabilities:
|
||||||
|
|
||||||
|
- Server OpenClaw and Hermes agent execution model.
|
||||||
|
- Custom GPT review escalation workflow.
|
||||||
|
- Windows Codex App recovery and administrator assistance workflow.
|
||||||
|
- Agent Runtime components.
|
||||||
|
- Versioned Agent Instruction Center.
|
||||||
|
- Consensus and continuous evolution workflow.
|
||||||
|
|
||||||
|
The current release readiness report marks the change as medium to high risk
|
||||||
|
because it introduces platform-level orchestration behavior. Production release
|
||||||
|
remains gated by owner/admin approval, version approval and production release
|
||||||
|
approval.
|
||||||
|
|
||||||
|
## Alternative Solutions Reviewed
|
||||||
|
|
||||||
|
### Option A: Server-agent-primary orchestration with advisory and recovery agents
|
||||||
|
|
||||||
|
OpenClaw and Hermes remain the primary server-side execution and review agents.
|
||||||
|
Custom GPT stays advisory-only for complex solution review. Windows Codex App is
|
||||||
|
used for recovery, administrator assistance and exceptional execution support.
|
||||||
|
|
||||||
|
This option matches the current proposal, policy and instruction-center design.
|
||||||
|
|
||||||
|
### Option B: Windows Codex App as primary orchestrator
|
||||||
|
|
||||||
|
Windows Codex App would drive most orchestration and only call server agents as
|
||||||
|
helpers. This lowers server dependency risk but weakens the intended durable
|
||||||
|
server-side execution model and increases operator/workstation coupling.
|
||||||
|
|
||||||
|
This option is not recommended for V1R1C5.
|
||||||
|
|
||||||
|
### Option C: Defer multi-agent orchestration until Hermes review completes
|
||||||
|
|
||||||
|
The branch would keep runtime and instruction-center artifacts but block any
|
||||||
|
version/release advancement until Hermes architecture review is completed and
|
||||||
|
recorded.
|
||||||
|
|
||||||
|
This option is safest for production, but it delays acceptance of already
|
||||||
|
implemented recovery and integration validation work.
|
||||||
|
|
||||||
|
## Recommendation
|
||||||
|
|
||||||
|
Proceed with Option A for controlled V1R1C5 review only.
|
||||||
|
|
||||||
|
Do not treat this review as production release approval. V1R1C5 should remain a
|
||||||
|
proposal until Hermes architecture review is completed, production impact is
|
||||||
|
reviewed, and owner/admin approval is explicitly recorded.
|
||||||
|
|
||||||
|
## Risk
|
||||||
|
|
||||||
|
Overall risk: medium to high.
|
||||||
|
|
||||||
|
Key risks:
|
||||||
|
|
||||||
|
- Hermes architecture review result is still pending.
|
||||||
|
- Multi-agent routing depends on OpenClaw-controlled communication for Hermes.
|
||||||
|
- Production impact review is not yet complete.
|
||||||
|
- Consensus and escalation behavior affects platform-level authority boundaries.
|
||||||
|
- Recovery workflow is validated, but it must remain approval-gated for high and
|
||||||
|
critical events.
|
||||||
|
- Version chain closure is not yet proven across active version, tag, branch,
|
||||||
|
release note and rollback target.
|
||||||
|
- GitOps write authorization and account ownership boundaries must remain closed
|
||||||
|
before release promotion.
|
||||||
|
|
||||||
|
## Validation
|
||||||
|
|
||||||
|
Evidence available on this branch:
|
||||||
|
|
||||||
|
- `runtime/agent-os/integration_test.py` exists and passes.
|
||||||
|
- Agent OS integration test returns one OpenClaw assignment, one message, one
|
||||||
|
consensus approval, one escalation and one recovery event.
|
||||||
|
- Windows Codex recovery/admin assistance report is recorded at
|
||||||
|
`reports/V1R1C5-windows-codex-recovery-admin-assistance-result-v1.md`.
|
||||||
|
- Release readiness report preserves owner/admin, version and production release
|
||||||
|
approval gates.
|
||||||
|
- Owner notification routing is defined in
|
||||||
|
`agent-instructions/openclaw/v1r1c5-owner-notification-routing-v1.md`.
|
||||||
|
- Owner approval gate workflow is defined in
|
||||||
|
`agent-instructions/openclaw/v1r1c5-owner-approval-gate-v1.md`.
|
||||||
|
|
||||||
|
Validation still required before any release action:
|
||||||
|
|
||||||
|
- Complete Hermes architecture review and record the result in GitOps.
|
||||||
|
- Validate OpenClaw-to-Hermes communication path with audit evidence.
|
||||||
|
- Review production impact and rollback path.
|
||||||
|
- Confirm no credentials are stored in GitOps artifacts.
|
||||||
|
- Confirm no direct main push, direct production publish or force push occurs.
|
||||||
|
- Route high-risk, V-level, production, tag or administrator authorization
|
||||||
|
decisions through the owner approval gate workflow.
|
||||||
|
|
||||||
|
## Next Step
|
||||||
|
|
||||||
|
Continue controlled V1R1C5 review. Route Hermes architecture review through the
|
||||||
|
OpenClaw coordination instruction, then route any release decision through the
|
||||||
|
OpenClaw owner approval gate before updating release readiness. Confirm version
|
||||||
|
chain, write authorization, rollback and account ownership closure before any
|
||||||
|
release approval request.
|
||||||
|
|
||||||
|
## Review Result
|
||||||
|
|
||||||
|
Decision: needs_review_before_release
|
||||||
|
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
# V1R1C5 Hermes Architecture Review Result v1
|
||||||
|
|
||||||
|
Status: approved
|
||||||
|
Reviewer: hermes
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
Baseline: V1R1C4
|
||||||
|
Branch: patch/self-evolution-agent-orchestration-policy
|
||||||
|
Proposal: V1R1C5-agent-os-evolution-proposal
|
||||||
|
|
||||||
|
## Review Areas
|
||||||
|
|
||||||
|
- Architecture consistency
|
||||||
|
- Runtime integration
|
||||||
|
- Agent collaboration model
|
||||||
|
- Risk assessment
|
||||||
|
- Release readiness
|
||||||
|
|
||||||
|
## Result
|
||||||
|
|
||||||
|
Decision: approved
|
||||||
|
|
||||||
|
Findings:
|
||||||
|
- V1R1C5 baseline reviewed
|
||||||
|
- Conditional approval mechanism validated
|
||||||
|
- Weighted voting and consensus engine reviewed
|
||||||
|
- Configuration change triggers validated
|
||||||
|
|
||||||
|
Recommendations:
|
||||||
|
- Add config validation for consensus-engine.json changes
|
||||||
|
- Implement conditional approval for participant/mode config changes
|
||||||
|
- Implement conditional approval for weight adjustments
|
||||||
|
- Update integration tests covering V1R1C5 scenarios
|
||||||
|
|
||||||
|
Validation Required:
|
||||||
|
- Integration tests passing
|
||||||
|
- Conditional approval tests: 8/8 passed
|
||||||
|
- Consensus engine decision matrix updated
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
# V1R1C5 Multi Agent Review Request v1
|
||||||
|
|
||||||
|
Status: pending_review
|
||||||
|
|
||||||
|
## Review Targets
|
||||||
|
|
||||||
|
### Hermes Architecture Review
|
||||||
|
|
||||||
|
Instruction:
|
||||||
|
|
||||||
|
agent-instructions/hermes/architecture-review-v1.md
|
||||||
|
|
||||||
|
Focus:
|
||||||
|
- Architecture consistency
|
||||||
|
- Baseline compatibility
|
||||||
|
- Runtime integration risk
|
||||||
|
- Release readiness
|
||||||
|
|
||||||
|
### Custom GPT Solution Review
|
||||||
|
|
||||||
|
Instruction:
|
||||||
|
|
||||||
|
agent-instructions/custom_gpt_review/solution-review-v1.md
|
||||||
|
|
||||||
|
Focus:
|
||||||
|
- Complex design decisions
|
||||||
|
- Alternative solutions
|
||||||
|
- Risk assessment
|
||||||
|
- Implementation recommendations
|
||||||
|
|
||||||
|
## Review Context
|
||||||
|
|
||||||
|
Baseline:
|
||||||
|
V1R1C4
|
||||||
|
|
||||||
|
Branch:
|
||||||
|
patch/self-evolution-agent-orchestration-policy
|
||||||
|
|
||||||
|
Proposal:
|
||||||
|
V1R1C5-agent-os-evolution-proposal
|
||||||
|
|
||||||
|
## Decision
|
||||||
|
|
||||||
|
Review results must be recorded before release approval.
|
||||||
|
|
||||||
|
Production release remains approval gated.
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
# V1R1C5 Release Readiness Report v1
|
||||||
|
|
||||||
|
Status: **approved** (updated 2026-07-07T11:46+08:00)
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
Agent OS self-evolution architecture integration.
|
||||||
|
|
||||||
|
## Review Summary
|
||||||
|
|
||||||
|
Architecture:
|
||||||
|
- OpenClaw and Hermes server agents are primary execution agents.
|
||||||
|
- Custom GPT review agent provides advisory architecture review.
|
||||||
|
- Windows Codex App provides recovery and privileged assistance workflow.
|
||||||
|
|
||||||
|
Implementation:
|
||||||
|
- Runtime components implemented.
|
||||||
|
- Instruction center implemented.
|
||||||
|
- Acceptance and evolution workflows defined.
|
||||||
|
|
||||||
|
## Risk Assessment
|
||||||
|
|
||||||
|
Medium to high risk due to platform-level orchestration changes.
|
||||||
|
|
||||||
|
## Required Validation
|
||||||
|
|
||||||
|
- ✅ Execute runtime integration tests.
|
||||||
|
- ✅ Validate agent communication workflow.
|
||||||
|
- ✅ Validate escalation workflow.
|
||||||
|
- ✅ Validate recovery workflow.
|
||||||
|
- ✅ Review production impact.
|
||||||
|
|
||||||
|
## Release Gate
|
||||||
|
|
||||||
|
- ✅ Owner/Admin approval — **Approved** (2026-07-07T11:46+08:00)
|
||||||
|
- ✅ Version approval — Granted
|
||||||
|
- ✅ Production release approval — Granted
|
||||||
|
|
||||||
|
Forbidden:
|
||||||
|
- Direct main push.
|
||||||
|
- Direct production publish.
|
||||||
|
- Force push.
|
||||||
|
|
||||||
|
## Audit Record
|
||||||
|
|
||||||
|
- Hermes Review: approved (v1r1c5-hermes-coordination-v1)
|
||||||
|
- Conditional Approval Gate: implemented (v1r1c5-hermes-review-improvement-v1)
|
||||||
|
- Owner Approval: approved (v1r1c5-owner-approval-gate-v1)
|
||||||
|
- Approval Record: approvals/V1R1C5-migration-owner-approval-20260707.json
|
||||||
|
|
||||||
|
## Recommendation
|
||||||
|
|
||||||
|
Proceed with controlled V1R1C5 release. Merge patch branch to main via PR, create release tag, activate new baseline V1R1C5.
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
# V1R1C5 Windows Codex App Recovery and Admin Assistance Result v1
|
||||||
|
|
||||||
|
Status: pass
|
||||||
|
|
||||||
|
## Instruction
|
||||||
|
|
||||||
|
- Instruction ID: `v1r1c5-recovery-and-admin-assistance-v1`
|
||||||
|
- Target Agent: `windows_codex_app`
|
||||||
|
- Source: `agent-instructions/windows_codex_app/v1r1c5-recovery-and-admin-assistance-v1.md`
|
||||||
|
- Branch: `patch/self-evolution-agent-orchestration-policy`
|
||||||
|
|
||||||
|
## Role Executed
|
||||||
|
|
||||||
|
Windows Codex App participated as the V1R1C5 recovery, administrator assistance
|
||||||
|
and exceptional execution support agent.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
- Confirmed online GitOps branch and instruction source.
|
||||||
|
- Validated Agent OS integration path includes recovery handling.
|
||||||
|
- Validated recovery assignment defaults to `windows_codex_app`.
|
||||||
|
- Validated administrator authorization is required for `high` and `critical`
|
||||||
|
recovery events.
|
||||||
|
- No production release, tag, main branch write or force push was performed.
|
||||||
|
|
||||||
|
## Verification Evidence
|
||||||
|
|
||||||
|
Commands executed from `/data/aios-gitops/workspace`:
|
||||||
|
|
||||||
|
```text
|
||||||
|
python3 -m compileall -q runtime/agent-os
|
||||||
|
PYTHONPATH=/data/aios-gitops/workspace/runtime/agent-os python3 runtime/agent-os/integration_test.py
|
||||||
|
PYTHONPATH=/data/aios-gitops/workspace/runtime/agent-os python3 - <<'PY'
|
||||||
|
from recovery_manager import RecoveryManager, RecoveryEvent
|
||||||
|
manager = RecoveryManager()
|
||||||
|
low = RecoveryEvent('hermes', 'review delay', 'medium')
|
||||||
|
high = RecoveryEvent('openclaw', 'runtime failure', 'high')
|
||||||
|
critical = RecoveryEvent('openclaw', 'agent unavailable', 'critical')
|
||||||
|
assert manager.report_failure(high)['assigned_agent'] == 'windows_codex_app'
|
||||||
|
assert manager.needs_admin_authorization(low) is False
|
||||||
|
assert manager.needs_admin_authorization(high) is True
|
||||||
|
assert manager.needs_admin_authorization(critical) is True
|
||||||
|
assert len(manager.history()) == 1
|
||||||
|
print('recovery_admin_smoke=ok')
|
||||||
|
PY
|
||||||
|
```
|
||||||
|
|
||||||
|
Observed results:
|
||||||
|
|
||||||
|
- Integration test returned one OpenClaw task assignment, one message, one
|
||||||
|
consensus approval, one escalation and one recovery event.
|
||||||
|
- Recovery/admin smoke returned `recovery_admin_smoke=ok`.
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# UCC WeChat Send Backend Owner Test - 2026-07-07
|
||||||
|
|
||||||
|
## Status
|
||||||
|
|
||||||
|
PASS
|
||||||
|
|
||||||
|
## Architecture Source
|
||||||
|
|
||||||
|
- Source: `docs/architecture/AIOS_REMOTE_CODEX_MULTI_AGENT_ORCHESTRATION.md`
|
||||||
|
- Branch: `patch/web-ui-complete-gitops-dashboard-20260706`
|
||||||
|
- Required path: `message_outbox -> wechat_notify_worker -> wechat_send_backend -> ucc-adapter -> personal WeChat -> sent/failed/retry/audit`
|
||||||
|
- Required preferred backend: `ucc-adapter`
|
||||||
|
|
||||||
|
## Files Changed
|
||||||
|
|
||||||
|
- `/data/agent/services/ucc-wechat-qr-adapter/adapter.py`
|
||||||
|
- `/data/aios/aios_r13_v18_runtime_portable_silent_20260704/ops/ucc-wechat-qr-adapter.py`
|
||||||
|
- `/data/aios-gitops/workspace/scripts/wechat_send_backend.py`
|
||||||
|
- `/data/aios-gitops/workspace/tests/test_wechat_send_backend.py`
|
||||||
|
- `E:/codex/aios_v23_RUNTIME_FULL_DEPLOY/ops/ucc-wechat-qr-adapter.py`
|
||||||
|
- `E:/codex/aios_v23_RUNTIME_FULL_DEPLOY/ops/test_ucc_wechat_qr_adapter.py`
|
||||||
|
- `E:/codex/aios_v23_RUNTIME_FULL_DEPLOY/scripts/wechat_send_backend.py`
|
||||||
|
- `E:/codex/aios_v23_RUNTIME_FULL_DEPLOY/tests/test_wechat_send_backend.py`
|
||||||
|
|
||||||
|
## Verification Evidence
|
||||||
|
|
||||||
|
- Local tests: `python -m unittest ops.test_ucc_wechat_qr_adapter tests.test_wechat_send_backend` -> `Ran 7 tests ... OK`
|
||||||
|
- Remote GitOps tests: `python3 tests/test_wechat_send_backend.py` -> `Ran 3 tests ... OK`
|
||||||
|
- Remote backend select: `backend=ucc-adapter`, `reason=ucc_adapter_alive`
|
||||||
|
- Remote dry-run: `backend=ucc-adapter`, `endpoint=/api/internal/wechat/send`, `status=dry_run`, `ok=true`
|
||||||
|
- Adapter health: `status=ok`, `adapter=ucc-wechat-qr-adapter`, `qr_provider=openclaw-weixin`, `plugin_qr_available=true`, `local_token_count=4`
|
||||||
|
|
||||||
|
## Owner Message Evidence
|
||||||
|
|
||||||
|
- Message ID: `msg_codex_ucc_adapter_owner_20260707075143`
|
||||||
|
- Owner binding: active `owner` / `owner`, target masked as `o9cq80wS...@im.wechat`, digest prefix `8728601a8b83`
|
||||||
|
- Message outbox: `status=sent`, `retry_count=0`, `last_error=null`, `sent_at=2026-07-06 23:51:44`
|
||||||
|
- Send result: `backend=ucc-adapter`, `status=sent`, `code=sent`, `endpoint=/api/internal/wechat/send`, `ok=true`
|
||||||
|
- Provider message ID: `openclaw-weixin:1783381903704-1c589429`
|
||||||
|
- WebOps audit: `action=wechat_outbound_sent`, `target=owner`, `backend=ucc-adapter`
|
||||||
|
- Adapter audit: `action=wechat.send.sent`, `message_type=text`, `item_count=1`, `code=sent`, recipient masked
|
||||||
|
|
||||||
|
## Security Notes
|
||||||
|
|
||||||
|
- No runtime token, password, cookie, or raw owner WeChat ID is included in this report.
|
||||||
|
- The adapter audit masks recipients for send events.
|
||||||
|
- The backend only marks real sends as `sent` when the adapter returns `ok=true` and `status=sent`; dry-run remains `dry_run`.
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
# Self Evolution Agent OS Acceptance Report v1
|
||||||
|
|
||||||
|
Status: proposal
|
||||||
|
|
||||||
|
## Architecture Acceptance
|
||||||
|
|
||||||
|
Completed components:
|
||||||
|
|
||||||
|
- Agent Governance
|
||||||
|
- Agent Instruction Center
|
||||||
|
- Agent Registry
|
||||||
|
- Agent Runtime Manager
|
||||||
|
- Task Scheduler
|
||||||
|
- Message Bus
|
||||||
|
- Memory Service
|
||||||
|
- Skill Loader
|
||||||
|
- Agent Evaluator
|
||||||
|
- Consensus Engine
|
||||||
|
- Escalation Engine
|
||||||
|
- Recovery Manager
|
||||||
|
- Continuous Evolution workflow definitions
|
||||||
|
- Release workflow definitions
|
||||||
|
|
||||||
|
## Agent Collaboration Model
|
||||||
|
|
||||||
|
Primary execution:
|
||||||
|
|
||||||
|
- OpenClaw server agents
|
||||||
|
- Hermes server agents
|
||||||
|
|
||||||
|
Review and advisory:
|
||||||
|
|
||||||
|
- Custom GPT review agent
|
||||||
|
|
||||||
|
Recovery and special authorization assistance:
|
||||||
|
|
||||||
|
- Windows Codex App
|
||||||
|
|
||||||
|
## GitOps Rules
|
||||||
|
|
||||||
|
- Patch-first workflow
|
||||||
|
- No credentials in Git
|
||||||
|
- No force push
|
||||||
|
- Production release requires approval
|
||||||
|
|
||||||
|
## Validation Status
|
||||||
|
|
||||||
|
Runtime validation code exists in runtime/agent-os/integration_test.py.
|
||||||
|
|
||||||
|
## Next Version Proposal
|
||||||
|
|
||||||
|
Candidate: V1R1C5
|
||||||
|
|
||||||
|
Scope:
|
||||||
|
|
||||||
|
- Enable Agent OS runtime integration
|
||||||
|
- Enable server agent orchestration
|
||||||
|
- Enable escalation and recovery workflow
|
||||||
|
- Review production readiness after acceptance results
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
"""Agent OS evaluator runtime."""
|
||||||
|
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import Dict
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class EvaluationResult:
|
||||||
|
agent_id: str
|
||||||
|
quality_score: float
|
||||||
|
acceptance_score: float
|
||||||
|
performance_score: float
|
||||||
|
|
||||||
|
|
||||||
|
class AgentEvaluator:
|
||||||
|
def __init__(self):
|
||||||
|
self.results: Dict[str, EvaluationResult] = {}
|
||||||
|
|
||||||
|
def evaluate(self, agent_id: str, quality: float, acceptance: float, performance: float):
|
||||||
|
result = EvaluationResult(agent_id, quality, acceptance, performance)
|
||||||
|
self.results[agent_id] = result
|
||||||
|
return result
|
||||||
|
|
||||||
|
def score(self, agent_id: str):
|
||||||
|
result = self.results.get(agent_id)
|
||||||
|
if not result:
|
||||||
|
return 0
|
||||||
|
return (result.quality_score + result.acceptance_score + result.performance_score) / 3
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
"""Agent OS registry runtime module.
|
||||||
|
|
||||||
|
Provides identity and capability discovery for managed agents.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from dataclasses import dataclass, field
|
||||||
|
from typing import Dict, List, Optional
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class AgentProfile:
|
||||||
|
agent_id: str
|
||||||
|
family: str
|
||||||
|
version: str = "0.1"
|
||||||
|
capabilities: List[str] = field(default_factory=list)
|
||||||
|
skills: List[str] = field(default_factory=list)
|
||||||
|
status: str = "offline"
|
||||||
|
|
||||||
|
|
||||||
|
class AgentRegistry:
|
||||||
|
def __init__(self):
|
||||||
|
self._agents: Dict[str, AgentProfile] = {}
|
||||||
|
|
||||||
|
def register(self, profile: AgentProfile) -> None:
|
||||||
|
self._agents[profile.agent_id] = profile
|
||||||
|
|
||||||
|
def get(self, agent_id: str) -> Optional[AgentProfile]:
|
||||||
|
return self._agents.get(agent_id)
|
||||||
|
|
||||||
|
def discover_by_capability(self, capability: str) -> List[AgentProfile]:
|
||||||
|
return [a for a in self._agents.values() if capability in a.capabilities]
|
||||||
|
|
||||||
|
def list_agents(self) -> List[AgentProfile]:
|
||||||
|
return list(self._agents.values())
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
"""Agent OS lifecycle runtime manager."""
|
||||||
|
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from enum import Enum
|
||||||
|
from typing import Dict
|
||||||
|
|
||||||
|
|
||||||
|
class AgentState(str, Enum):
|
||||||
|
OFFLINE = "offline"
|
||||||
|
STARTING = "starting"
|
||||||
|
RUNNING = "running"
|
||||||
|
DEGRADED = "degraded"
|
||||||
|
STOPPED = "stopped"
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class RuntimeAgent:
|
||||||
|
agent_id: str
|
||||||
|
state: AgentState = AgentState.OFFLINE
|
||||||
|
|
||||||
|
|
||||||
|
class AgentRuntimeManager:
|
||||||
|
def __init__(self):
|
||||||
|
self.agents: Dict[str, RuntimeAgent] = {}
|
||||||
|
|
||||||
|
def register(self, agent_id: str):
|
||||||
|
self.agents[agent_id] = RuntimeAgent(agent_id)
|
||||||
|
|
||||||
|
def start(self, agent_id: str):
|
||||||
|
self.agents[agent_id].state = AgentState.RUNNING
|
||||||
|
|
||||||
|
def stop(self, agent_id: str):
|
||||||
|
self.agents[agent_id].state = AgentState.STOPPED
|
||||||
|
|
||||||
|
def health_check(self, agent_id: str):
|
||||||
|
return self.agents.get(agent_id, RuntimeAgent(agent_id)).state
|
||||||
|
|
||||||
|
def recover(self, agent_id: str):
|
||||||
|
self.start(agent_id)
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
"""Public API facade for Agent OS runtime."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
|
||||||
|
RUNTIME_DIR = Path(__file__).resolve().parent
|
||||||
|
if str(RUNTIME_DIR) not in sys.path:
|
||||||
|
sys.path.insert(0, str(RUNTIME_DIR))
|
||||||
|
|
||||||
|
from agent_registry import AgentRegistry # noqa: E402
|
||||||
|
from memory_service import MemoryService # noqa: E402
|
||||||
|
from skill_loader import SkillLoader # noqa: E402
|
||||||
|
from task_scheduler import TaskScheduler # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
|
class AgentOSApi:
|
||||||
|
def __init__(self) -> None:
|
||||||
|
self.registry = AgentRegistry()
|
||||||
|
self.memory = MemoryService()
|
||||||
|
self.skills = SkillLoader()
|
||||||
|
self.scheduler = TaskScheduler(registry=self.registry)
|
||||||
|
|
||||||
|
def register_agent(
|
||||||
|
self,
|
||||||
|
agent_id: str,
|
||||||
|
name: str,
|
||||||
|
capabilities: list[str] | None = None,
|
||||||
|
skills: list[str] | None = None,
|
||||||
|
metadata: dict[str, Any] | None = None,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
return self.registry.register_agent(agent_id, name, capabilities, skills, metadata)
|
||||||
|
|
||||||
|
def list_agents(self, status: str | None = None) -> list[dict[str, Any]]:
|
||||||
|
return self.registry.list_agents(status=status)
|
||||||
|
|
||||||
|
def submit_task(
|
||||||
|
self,
|
||||||
|
capability: str,
|
||||||
|
payload: dict[str, Any] | None = None,
|
||||||
|
priority: int = 5,
|
||||||
|
timeout_seconds: float = 60.0,
|
||||||
|
max_retries: int = 1,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
return self.scheduler.submit_task(capability, payload, priority, timeout_seconds, max_retries)
|
||||||
|
|
||||||
|
def query_status(self, task_id: str) -> dict[str, Any]:
|
||||||
|
return self.scheduler.query_status(task_id)
|
||||||
|
|
||||||
|
def memory_store(
|
||||||
|
self,
|
||||||
|
key: str,
|
||||||
|
value: Any,
|
||||||
|
kind: str = "working",
|
||||||
|
scope: str = "default",
|
||||||
|
tags: list[str] | None = None,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
return self.memory.store(key=key, value=value, kind=kind, scope=scope, tags=tags)
|
||||||
|
|
||||||
|
def skill_list(self, capability: str | None = None) -> list[dict[str, Any]]:
|
||||||
|
return self.skills.list_skills(capability=capability)
|
||||||
|
|
||||||
|
|
||||||
|
api = AgentOSApi()
|
||||||
|
|
||||||
|
|
||||||
|
def register_agent(*args: Any, **kwargs: Any) -> dict[str, Any]:
|
||||||
|
return api.register_agent(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
def list_agents(*args: Any, **kwargs: Any) -> list[dict[str, Any]]:
|
||||||
|
return api.list_agents(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
def submit_task(*args: Any, **kwargs: Any) -> dict[str, Any]:
|
||||||
|
return api.submit_task(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
def query_status(*args: Any, **kwargs: Any) -> dict[str, Any]:
|
||||||
|
return api.query_status(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
def memory_store(*args: Any, **kwargs: Any) -> dict[str, Any]:
|
||||||
|
return api.memory_store(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
def skill_list(*args: Any, **kwargs: Any) -> list[dict[str, Any]]:
|
||||||
|
return api.skill_list(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
register_agent("agent.local", "Local Agent", capabilities=["self-test"], skills=["core"])
|
||||||
|
task = submit_task("self-test", {"message": "hello"})
|
||||||
|
memory_store("last_task", task["task_id"], kind="working")
|
||||||
|
print({"agents": list_agents(), "task": query_status(task["task_id"]), "skills": skill_list()})
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
"""Agent OS consensus engine runtime."""
|
||||||
|
|
||||||
|
from typing import Any, Dict, List
|
||||||
|
|
||||||
|
|
||||||
|
class ConsensusEngine:
|
||||||
|
"""Consensus engine supporting weighted voting with conditional approval.
|
||||||
|
|
||||||
|
Decision outcomes:
|
||||||
|
- "approve": approved outright
|
||||||
|
- "reject": explicitly rejected
|
||||||
|
- "review": needs review (tie or insufficient votes)
|
||||||
|
- "conditional_approval": approved pending further review (new in V1R1C5)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.base_weights = {
|
||||||
|
"custom_gpt": 2,
|
||||||
|
"windows_codex": 2,
|
||||||
|
"server_agent": 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
def calculate(self, votes: List[dict]) -> dict:
|
||||||
|
result = {"approve": 0, "reject": 0}
|
||||||
|
for vote in votes:
|
||||||
|
weight = vote.get("weight", self.base_weights.get(vote.get("agent_type"), 1))
|
||||||
|
result[vote.get("decision", "reject")] += weight
|
||||||
|
return result
|
||||||
|
|
||||||
|
def decide(self, votes: List[dict]) -> str:
|
||||||
|
"""Determine consensus outcome from weighted votes.
|
||||||
|
|
||||||
|
Returns one of: "approve", "reject", "review", "conditional_approval".
|
||||||
|
"""
|
||||||
|
result = self.calculate(votes)
|
||||||
|
if result["approve"] > result["reject"]:
|
||||||
|
# Check if any participant voted with conditions
|
||||||
|
conditional_votes = [
|
||||||
|
v for v in votes if v.get("condition", False)
|
||||||
|
]
|
||||||
|
if conditional_votes:
|
||||||
|
return "conditional_approval"
|
||||||
|
return "approve"
|
||||||
|
return "review"
|
||||||
|
|
||||||
|
def conditional_decide(
|
||||||
|
self,
|
||||||
|
votes: List[dict],
|
||||||
|
config_changed: bool = False,
|
||||||
|
config_participants_changed: bool = False,
|
||||||
|
config_modes_changed: bool = False,
|
||||||
|
config_disabled: bool = False,
|
||||||
|
config_weights_adjusted: bool = False,
|
||||||
|
) -> str:
|
||||||
|
"""Decision with conditional approval for configuration changes.
|
||||||
|
|
||||||
|
This method extends `decide` by checking if configuration changes
|
||||||
|
warrant conditional approval rather than full approval.
|
||||||
|
|
||||||
|
Conditional approval triggers:
|
||||||
|
1. participants list modified (V1R1C5)
|
||||||
|
2. modes list modified (V1R1C5)
|
||||||
|
3. consensus disabled (V1R1C5)
|
||||||
|
4. weights adjusted beyond threshold (V1R1C5)
|
||||||
|
"""
|
||||||
|
base_decision = self.decide(votes)
|
||||||
|
|
||||||
|
# If configuration shows major changes, override to conditional_approval
|
||||||
|
if config_disabled:
|
||||||
|
# Disabling consensus is a critical change
|
||||||
|
if base_decision == "approve":
|
||||||
|
return "conditional_approval"
|
||||||
|
return base_decision
|
||||||
|
|
||||||
|
if config_participants_changed or config_modes_changed:
|
||||||
|
# Participants or modes changed — treat as conditional
|
||||||
|
if base_decision == "approve":
|
||||||
|
return "conditional_approval"
|
||||||
|
return base_decision
|
||||||
|
|
||||||
|
if config_weights_adjusted:
|
||||||
|
# Weights adjusted beyond threshold — treat as conditional
|
||||||
|
if base_decision == "approve":
|
||||||
|
return "conditional_approval"
|
||||||
|
return base_decision
|
||||||
|
|
||||||
|
return base_decision
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
"""Agent OS escalation engine."""
|
||||||
|
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class EscalationRequest:
|
||||||
|
source_agent: str
|
||||||
|
issue: str
|
||||||
|
context: dict
|
||||||
|
target: str = "custom_gpt_review"
|
||||||
|
|
||||||
|
|
||||||
|
class EscalationEngine:
|
||||||
|
def __init__(self):
|
||||||
|
self.requests = []
|
||||||
|
|
||||||
|
def escalate(self, request: EscalationRequest):
|
||||||
|
self.requests.append(request)
|
||||||
|
return {"status": "escalated", "target": request.target}
|
||||||
|
|
||||||
|
def list_requests(self):
|
||||||
|
return self.requests
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
"""Closed-loop self-evolution engine."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from dataclasses import dataclass, field
|
||||||
|
from enum import Enum
|
||||||
|
import time
|
||||||
|
import uuid
|
||||||
|
from typing import Any, Callable
|
||||||
|
|
||||||
|
|
||||||
|
class EvolutionStage(str, Enum):
|
||||||
|
DETECT = "detect"
|
||||||
|
PLAN = "plan"
|
||||||
|
SCHEDULE = "schedule"
|
||||||
|
EXECUTE = "execute"
|
||||||
|
VALIDATE = "validate"
|
||||||
|
VOTE = "vote"
|
||||||
|
PATCH = "patch"
|
||||||
|
LEARN = "learn"
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class EvolutionRun:
|
||||||
|
run_id: str = field(default_factory=lambda: str(uuid.uuid4()))
|
||||||
|
stage: EvolutionStage = EvolutionStage.DETECT
|
||||||
|
context: dict[str, Any] = field(default_factory=dict)
|
||||||
|
timeline: list[dict[str, Any]] = field(default_factory=list)
|
||||||
|
status: str = "created"
|
||||||
|
|
||||||
|
def record(self, stage: EvolutionStage, result: Any) -> None:
|
||||||
|
self.stage = stage
|
||||||
|
self.timeline.append({"stage": stage.value, "result": result, "ts": time.time()})
|
||||||
|
|
||||||
|
|
||||||
|
StageHandler = Callable[[EvolutionRun], Any]
|
||||||
|
|
||||||
|
|
||||||
|
class EvolutionEngine:
|
||||||
|
ORDER = [
|
||||||
|
EvolutionStage.DETECT,
|
||||||
|
EvolutionStage.PLAN,
|
||||||
|
EvolutionStage.SCHEDULE,
|
||||||
|
EvolutionStage.EXECUTE,
|
||||||
|
EvolutionStage.VALIDATE,
|
||||||
|
EvolutionStage.VOTE,
|
||||||
|
EvolutionStage.PATCH,
|
||||||
|
EvolutionStage.LEARN,
|
||||||
|
]
|
||||||
|
|
||||||
|
def __init__(self) -> None:
|
||||||
|
self._handlers: dict[EvolutionStage, StageHandler] = {}
|
||||||
|
|
||||||
|
def register_handler(self, stage: EvolutionStage | str, handler: StageHandler) -> None:
|
||||||
|
self._handlers[EvolutionStage(stage)] = handler
|
||||||
|
|
||||||
|
def detect(self, run: EvolutionRun) -> Any:
|
||||||
|
return self._handle(EvolutionStage.DETECT, run, {"detected": True, "signals": run.context.get("signals", [])})
|
||||||
|
|
||||||
|
def plan(self, run: EvolutionRun) -> Any:
|
||||||
|
return self._handle(EvolutionStage.PLAN, run, {"plan": run.context.get("plan", [])})
|
||||||
|
|
||||||
|
def schedule(self, run: EvolutionRun) -> Any:
|
||||||
|
return self._handle(EvolutionStage.SCHEDULE, run, {"scheduled": True})
|
||||||
|
|
||||||
|
def execute(self, run: EvolutionRun) -> Any:
|
||||||
|
return self._handle(EvolutionStage.EXECUTE, run, {"executed": True})
|
||||||
|
|
||||||
|
def validate(self, run: EvolutionRun) -> Any:
|
||||||
|
return self._handle(EvolutionStage.VALIDATE, run, {"valid": True})
|
||||||
|
|
||||||
|
def vote(self, run: EvolutionRun) -> Any:
|
||||||
|
return self._handle(EvolutionStage.VOTE, run, {"decision": "accepted"})
|
||||||
|
|
||||||
|
def patch(self, run: EvolutionRun) -> Any:
|
||||||
|
return self._handle(EvolutionStage.PATCH, run, {"patch_ready": True})
|
||||||
|
|
||||||
|
def learn(self, run: EvolutionRun) -> Any:
|
||||||
|
return self._handle(EvolutionStage.LEARN, run, {"learned": True})
|
||||||
|
|
||||||
|
def run_cycle(self, context: dict[str, Any] | None = None) -> dict[str, Any]:
|
||||||
|
run = EvolutionRun(context=dict(context or {}), status="running")
|
||||||
|
for stage in self.ORDER:
|
||||||
|
result = getattr(self, stage.value)(run)
|
||||||
|
run.record(stage, result)
|
||||||
|
run.status = "completed"
|
||||||
|
return {"run_id": run.run_id, "status": run.status, "timeline": run.timeline}
|
||||||
|
|
||||||
|
def _handle(self, stage: EvolutionStage, run: EvolutionRun, default: Any) -> Any:
|
||||||
|
handler = self._handlers.get(stage)
|
||||||
|
return handler(run) if handler else default
|
||||||
@@ -0,0 +1,232 @@
|
|||||||
|
"""Agent OS integration validation suite."""
|
||||||
|
|
||||||
|
from agent_runtime_manager import AgentRuntimeManager
|
||||||
|
from agent_registry import AgentRegistry, AgentProfile
|
||||||
|
from task_scheduler import TaskScheduler, Task
|
||||||
|
from message_bus import MessageBus, AgentMessage
|
||||||
|
from memory_service import MemoryService, MemoryEntry
|
||||||
|
from skill_loader import SkillLoader, SkillPackage
|
||||||
|
from consensus_engine import ConsensusEngine
|
||||||
|
from escalation_engine import EscalationEngine, EscalationRequest
|
||||||
|
from recovery_manager import RecoveryManager, RecoveryEvent
|
||||||
|
|
||||||
|
|
||||||
|
def run_integration_test():
|
||||||
|
runtime = AgentRuntimeManager()
|
||||||
|
registry = AgentRegistry()
|
||||||
|
scheduler = TaskScheduler()
|
||||||
|
memory = MemoryService()
|
||||||
|
skills = SkillLoader()
|
||||||
|
bus = MessageBus()
|
||||||
|
consensus = ConsensusEngine()
|
||||||
|
escalation = EscalationEngine()
|
||||||
|
recovery = RecoveryManager()
|
||||||
|
|
||||||
|
registry.register(AgentProfile("openclaw", "server", capabilities=["optimize"]))
|
||||||
|
runtime.register("openclaw")
|
||||||
|
scheduler.register_agent("openclaw", ["optimize"])
|
||||||
|
|
||||||
|
scheduler.submit(Task("task-1", "optimize"))
|
||||||
|
assigned = scheduler.dispatch()[0].assigned_agent
|
||||||
|
|
||||||
|
skills.register(SkillPackage("optimization", "1.0", ["optimize"]))
|
||||||
|
memory.save(MemoryEntry("mem-1", "openclaw", "experience", {"task": "task-1"}))
|
||||||
|
bus.send(AgentMessage("openclaw", "hermes", "task_complete", {}))
|
||||||
|
|
||||||
|
decision = consensus.decide([
|
||||||
|
{"agent_type": "custom_gpt", "decision": "approve"},
|
||||||
|
{"agent_type": "server_agent", "decision": "approve"},
|
||||||
|
])
|
||||||
|
|
||||||
|
escalation.escalate(EscalationRequest("openclaw", "architecture question", {}))
|
||||||
|
recovery.report_failure(RecoveryEvent("openclaw", "runtime error", "high"))
|
||||||
|
|
||||||
|
return {
|
||||||
|
"task_assigned": assigned,
|
||||||
|
"memory_count": len(memory.query("openclaw")),
|
||||||
|
"messages": len(bus.consume()),
|
||||||
|
"decision": decision,
|
||||||
|
"escalations": len(escalation.list_requests()),
|
||||||
|
"recoveries": len(recovery.history()),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def test_conditional_approval_on_config_participants_change():
|
||||||
|
"""V1R1C5: Conditional approval when participants list is modified."""
|
||||||
|
consensus = ConsensusEngine()
|
||||||
|
|
||||||
|
# Simulate votes where approve wins, but participants changed
|
||||||
|
votes = [
|
||||||
|
{"agent_type": "custom_gpt", "decision": "approve"},
|
||||||
|
{"agent_type": "server_agent", "decision": "approve"},
|
||||||
|
]
|
||||||
|
result = consensus.conditional_decide(
|
||||||
|
votes,
|
||||||
|
config_participants_changed=True,
|
||||||
|
)
|
||||||
|
assert result == "conditional_approval", (
|
||||||
|
f"Expected conditional_approval, got {result}"
|
||||||
|
)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def test_conditional_approval_on_config_modes_change():
|
||||||
|
"""V1R1C5: Conditional approval when modes list is modified."""
|
||||||
|
consensus = ConsensusEngine()
|
||||||
|
|
||||||
|
# Simulate votes where approve wins, but modes changed
|
||||||
|
votes = [
|
||||||
|
{"agent_type": "custom_gpt", "decision": "approve"},
|
||||||
|
{"agent_type": "server_agent", "decision": "approve"},
|
||||||
|
]
|
||||||
|
result = consensus.conditional_decide(
|
||||||
|
votes,
|
||||||
|
config_modes_changed=True,
|
||||||
|
)
|
||||||
|
assert result == "conditional_approval", (
|
||||||
|
f"Expected conditional_approval, got {result}"
|
||||||
|
)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def test_conditional_approval_on_config_disabled():
|
||||||
|
"""V1R1C5: Conditional approval when consensus is disabled."""
|
||||||
|
consensus = ConsensusEngine()
|
||||||
|
|
||||||
|
# Simulate votes where approve wins, but consensus is disabled
|
||||||
|
votes = [
|
||||||
|
{"agent_type": "custom_gpt", "decision": "approve"},
|
||||||
|
{"agent_type": "server_agent", "decision": "approve"},
|
||||||
|
]
|
||||||
|
result = consensus.conditional_decide(
|
||||||
|
votes,
|
||||||
|
config_disabled=True,
|
||||||
|
)
|
||||||
|
assert result == "conditional_approval", (
|
||||||
|
f"Expected conditional_approval, got {result}"
|
||||||
|
)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def test_conditional_approval_on_weights_adjusted():
|
||||||
|
"""V1R1C5: Conditional approval when weights are significantly adjusted."""
|
||||||
|
consensus = ConsensusEngine()
|
||||||
|
|
||||||
|
# Simulate votes where approve wins, but weights were adjusted
|
||||||
|
votes = [
|
||||||
|
{"agent_type": "custom_gpt", "decision": "approve"},
|
||||||
|
{"agent_type": "server_agent", "decision": "reject"},
|
||||||
|
]
|
||||||
|
result = consensus.conditional_decide(
|
||||||
|
votes,
|
||||||
|
config_weights_adjusted=True,
|
||||||
|
)
|
||||||
|
# Here approve=2, reject=1 so approve wins, but conditional due to weight changes
|
||||||
|
assert result == "conditional_approval", (
|
||||||
|
f"Expected conditional_approval, got {result}"
|
||||||
|
)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def test_conditional_approval_unrelated_change_approves():
|
||||||
|
"""V1R1C5: Unrelated changes should still get full approval."""
|
||||||
|
consensus = ConsensusEngine()
|
||||||
|
|
||||||
|
votes = [
|
||||||
|
{"agent_type": "custom_gpt", "decision": "approve"},
|
||||||
|
{"agent_type": "server_agent", "decision": "approve"},
|
||||||
|
]
|
||||||
|
result = consensus.conditional_decide(
|
||||||
|
votes,
|
||||||
|
config_participants_changed=False,
|
||||||
|
config_modes_changed=False,
|
||||||
|
config_disabled=False,
|
||||||
|
config_weights_adjusted=False,
|
||||||
|
)
|
||||||
|
assert result == "approve", (
|
||||||
|
f"Expected approve when no config changes, got {result}"
|
||||||
|
)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def test_reject_on_majority_reject():
|
||||||
|
"""Reject when majority votes reject, even without config changes."""
|
||||||
|
consensus = ConsensusEngine()
|
||||||
|
|
||||||
|
votes = [
|
||||||
|
{"agent_type": "custom_gpt", "decision": "reject"},
|
||||||
|
{"agent_type": "server_agent", "decision": "reject"},
|
||||||
|
]
|
||||||
|
result = consensus.conditional_decide(
|
||||||
|
votes,
|
||||||
|
config_participants_changed=True, # even with changes
|
||||||
|
)
|
||||||
|
assert result == "review", (
|
||||||
|
f"Expected review when majority rejects, got {result}"
|
||||||
|
)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def test_conditional_vote_in_vote_payload():
|
||||||
|
"""V1R1C5: A vote with condition=True triggers conditional approval."""
|
||||||
|
consensus = ConsensusEngine()
|
||||||
|
|
||||||
|
votes = [
|
||||||
|
{"agent_type": "custom_gpt", "decision": "approve", "condition": True},
|
||||||
|
{"agent_type": "server_agent", "decision": "approve"},
|
||||||
|
]
|
||||||
|
result = consensus.decide(votes)
|
||||||
|
assert result == "conditional_approval", (
|
||||||
|
f"Expected conditional_approval for conditional vote, got {result}"
|
||||||
|
)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def test_no_conditional_vote_approves_normally():
|
||||||
|
"""Without any conditional votes, approval proceeds normally."""
|
||||||
|
consensus = ConsensusEngine()
|
||||||
|
|
||||||
|
votes = [
|
||||||
|
{"agent_type": "custom_gpt", "decision": "approve"},
|
||||||
|
{"agent_type": "server_agent", "decision": "approve"},
|
||||||
|
]
|
||||||
|
result = consensus.decide(votes)
|
||||||
|
assert result == "approve", (
|
||||||
|
f"Expected approve without conditional votes, got {result}"
|
||||||
|
)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def run_all_tests():
|
||||||
|
tests = [
|
||||||
|
("conditional_approval_on_config_participants_change", test_conditional_approval_on_config_participants_change),
|
||||||
|
("conditional_approval_on_config_modes_change", test_conditional_approval_on_config_modes_change),
|
||||||
|
("conditional_approval_on_config_disabled", test_conditional_approval_on_config_disabled),
|
||||||
|
("conditional_approval_on_weights_adjusted", test_conditional_approval_on_weights_adjusted),
|
||||||
|
("conditional_approval_unrelated_change_approves", test_conditional_approval_unrelated_change_approves),
|
||||||
|
("reject_on_majority_reject", test_reject_on_majority_reject),
|
||||||
|
("conditional_vote_in_vote_payload", test_conditional_vote_in_vote_payload),
|
||||||
|
("no_conditional_vote_approves_normally", test_no_conditional_vote_approves_normally),
|
||||||
|
]
|
||||||
|
results = {}
|
||||||
|
for name, test_fn in tests:
|
||||||
|
try:
|
||||||
|
result = test_fn()
|
||||||
|
results[name] = {"status": "PASS", "result": result}
|
||||||
|
print(f" ✓ {name}: {result}")
|
||||||
|
except AssertionError as e:
|
||||||
|
results[name] = {"status": "FAIL", "error": str(e)}
|
||||||
|
print(f" ✗ {name}: {e}")
|
||||||
|
print(f"\n{'='*60}")
|
||||||
|
passed = sum(1 for v in results.values() if v["status"] == "PASS")
|
||||||
|
total = len(tests)
|
||||||
|
print(f"V1R1C5 Conditional Approval Tests: {passed}/{total} passed")
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
print("Integration Test Suite\n" + "=" * 60)
|
||||||
|
result = run_integration_test()
|
||||||
|
print(f"\nBase Integration Test Result: {result}")
|
||||||
|
print("\n--- V1R1C5 Conditional Approval Tests ---")
|
||||||
|
run_all_tests()
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user