omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / seed / agent / bench / nb_minimal.py
| 1 | """TEST-ONLY launcher: nanobot's own CLI, reduced to omagent's four tools for the equal-work benchmark. |
| 2 | |
| 3 | nanobot 0.3.5 has no config switch for every extra tool (message, spawn, cron, session and goal |
| 4 | tools stay registered; see the feature matrix), so this wrapper drops every tool except |
| 5 | read_file, write_file, exec and web_fetch at registration. Everything else is unmodified nanobot. |
| 6 | If NB_MODULES is set, the files of all loaded modules are written there at exit (footprint run only). |
| 7 | """ |
| 8 | import atexit, os, sys |
| 9 | |
| 10 | from nanobot.agent.tools.registry import ToolRegistry |
| 11 | |
| 12 | KEEP = {"read_file", "write_file", "exec", "web_fetch"} |
| 13 | _register = ToolRegistry.register |
| 14 | |
| 15 | |
| 16 | def register(self, tool): |
| 17 | if tool.name in KEEP: |
| 18 | _register(self, tool) |
| 19 | |
| 20 | |
| 21 | ToolRegistry.register = register |
| 22 | |
| 23 | if os.environ.get("NB_MODULES"): |
| 24 | def dump(): |
| 25 | with open(os.environ["NB_MODULES"], "w") as fh: |
| 26 | for m in list(sys.modules.values()): |
| 27 | f = getattr(m, "__cached__", None) or getattr(m, "__file__", None) |
| 28 | if f and not os.path.exists(f): |
| 29 | f = getattr(m, "__file__", None) |
| 30 | if f: |
| 31 | fh.write(f + "\n") |
| 32 | atexit.register(dump) |
| 33 | |
| 34 | from nanobot.cli.entry import main # noqa: E402 |
| 35 | |
| 36 | sys.argv[0] = "nanobot" |
| 37 | sys.exit(main()) |