Complete snapshot of /opt/microdao-daarion/ from NODE1 (144.76.224.179).
This represents the actual running production code that has diverged
significantly from the previous main branch.
Key changes from old main:
- Gateway (http_api.py): expanded from ~40KB to 164KB with full agent support
- Router: new /v1/agents/{id}/infer endpoint with vision + DeepSeek routing
- Behavior Policy: SOWA v2.2 (3-level: FULL/ACK/SILENT)
- Agent Registry: config/agent_registry.yml as single source of truth
- 13 agents configured (was 3)
- Memory service integration
- CrewAI teams and roles
Excluded from snapshot: venv/, .env, data/, backups, .tgz archives
Co-authored-by: Cursor <cursoragent@cursor.com>
56 lines
2.0 KiB
Python
56 lines
2.0 KiB
Python
import os
|
|
import time
|
|
from .audit import audit_tool_call
|
|
import requests
|
|
from .common import _auth_headers
|
|
|
|
FARMOS_BASE_URL = os.getenv("FARMOS_BASE_URL", "http://localhost:8080")
|
|
|
|
|
|
def get_asset(asset_id: str):
|
|
_t = time.time()
|
|
url = f"{FARMOS_BASE_URL}/jsonapi/asset/asset/{asset_id}"
|
|
r = requests.get(url, headers=_auth_headers(), timeout=20)
|
|
r.raise_for_status()
|
|
out = r.json()
|
|
audit_tool_call("tool_farmos_read.get_asset", {"asset_id": asset_id}, {"ok": True}, True, int((time.time()-_t)*1000))
|
|
return out
|
|
|
|
|
|
def search_assets(name_contains: str = "", limit: int = 10):
|
|
_t = time.time()
|
|
params = {}
|
|
if name_contains:
|
|
params["filter[name][condition][path]"] = "name"
|
|
params["filter[name][condition][operator]"] = "CONTAINS"
|
|
params["filter[name][condition][value]"] = name_contains
|
|
params["page[limit]"] = limit
|
|
url = f"{FARMOS_BASE_URL}/jsonapi/asset/asset"
|
|
r = requests.get(url, headers=_auth_headers(), params=params, timeout=20)
|
|
r.raise_for_status()
|
|
out = r.json()
|
|
audit_tool_call("tool_farmos_read.get_asset", {"asset_id": asset_id}, {"ok": True}, True, int((time.time()-_t)*1000))
|
|
return out
|
|
|
|
|
|
def read_logs(log_type: str = "observation", limit: int = 10):
|
|
_t = time.time()
|
|
url = f"{FARMOS_BASE_URL}/jsonapi/log/{log_type}"
|
|
params = {"page[limit]": limit}
|
|
r = requests.get(url, headers=_auth_headers(), params=params, timeout=20)
|
|
r.raise_for_status()
|
|
out = r.json()
|
|
audit_tool_call("tool_farmos_read.get_asset", {"asset_id": asset_id}, {"ok": True}, True, int((time.time()-_t)*1000))
|
|
return out
|
|
|
|
|
|
def read_inventory(limit: int = 10):
|
|
_t = time.time()
|
|
url = f"{FARMOS_BASE_URL}/jsonapi/log/inventory"
|
|
params = {"page[limit]": limit}
|
|
r = requests.get(url, headers=_auth_headers(), params=params, timeout=20)
|
|
r.raise_for_status()
|
|
out = r.json()
|
|
audit_tool_call("tool_farmos_read.get_asset", {"asset_id": asset_id}, {"ok": True}, True, int((time.time()-_t)*1000))
|
|
return out
|