nullius-eval 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. _nullius_app/.env.example +55 -0
  2. _nullius_app/app.py +96 -0
  3. _nullius_app/requirements.txt +1 -0
  4. _nullius_app/static/brand/README.md +20 -0
  5. _nullius_app/static/brand/docker.svg +1 -0
  6. _nullius_app/static/brand/favicon.svg +1 -0
  7. _nullius_app/static/brand/huggingface.svg +37 -0
  8. _nullius_app/static/brand/mark-dark.svg +1 -0
  9. _nullius_app/static/brand/marks.svg +34 -0
  10. _nullius_app/static/brand/tokens.json +51 -0
  11. _nullius_app/static/brand/typesafe.png +0 -0
  12. _nullius_app/static/brand/wordmark-dark.svg +1 -0
  13. _nullius_app/static/builder/command-builder-core.js +763 -0
  14. _nullius_app/static/builder/command-builder.css +248 -0
  15. _nullius_app/static/builder/command-builder.js +997 -0
  16. _nullius_app/static/builder/model-picker.js +113 -0
  17. _nullius_app/static/catalogue/add.js +46 -0
  18. _nullius_app/static/catalogue/agents/README.md +19 -0
  19. _nullius_app/static/catalogue/agents/goose.svg +1 -0
  20. _nullius_app/static/catalogue/agents/jiuwenswarm.svg +33 -0
  21. _nullius_app/static/catalogue/agents/marks.json +8 -0
  22. _nullius_app/static/catalogue/agents/mini-swe-agent.svg +7 -0
  23. _nullius_app/static/catalogue/agents/opencode.svg +7 -0
  24. _nullius_app/static/catalogue/catalogue.css +436 -0
  25. _nullius_app/static/catalogue/catalogue.js +87 -0
  26. _nullius_app/static/catalogue/marks.svg +29 -0
  27. _nullius_app/static/catalogue/new.js +78 -0
  28. _nullius_app/static/catalogue/versions.js +27 -0
  29. _nullius_app/static/compare/comparison.css +117 -0
  30. _nullius_app/static/controls.js +117 -0
  31. _nullius_app/static/disclosures.js +70 -0
  32. _nullius_app/static/fonts/0569c822cab6c510.ttf +0 -0
  33. _nullius_app/static/fonts/DMSans-Medium.woff2 +0 -0
  34. _nullius_app/static/fonts/DMSans-Regular.woff2 +0 -0
  35. _nullius_app/static/fonts/IBMPlexMono-Medium.woff2 +0 -0
  36. _nullius_app/static/fonts/IBMPlexMono-Regular.woff2 +0 -0
  37. _nullius_app/static/fonts/InstrumentSerif-Italic.woff2 +0 -0
  38. _nullius_app/static/fonts/InstrumentSerif-Regular.woff2 +0 -0
  39. _nullius_app/static/fonts/README.md +11 -0
  40. _nullius_app/static/fonts/c1e7453ea26a1d1e.ttf +0 -0
  41. _nullius_app/static/fonts/dmsans-OFL.txt +93 -0
  42. _nullius_app/static/fonts/ibmplexmono-OFL.txt +93 -0
  43. _nullius_app/static/fonts/instrumentserif-OFL.txt +93 -0
  44. _nullius_app/static/fonts.css +49 -0
  45. _nullius_app/static/notifications.js +49 -0
  46. _nullius_app/static/onboarding.css +78 -0
  47. _nullius_app/static/onboarding.js +158 -0
  48. _nullius_app/static/runs/board.css +358 -0
  49. _nullius_app/static/runs/board.js +127 -0
  50. _nullius_app/static/runs/launches.css +88 -0
  51. _nullius_app/static/runs/live-board.css +186 -0
  52. _nullius_app/static/runs/live-board.js +394 -0
  53. _nullius_app/static/runs/path-suggestions.js +119 -0
  54. _nullius_app/static/runs/start.css +38 -0
  55. _nullius_app/static/settings/autosave.js +162 -0
  56. _nullius_app/static/settings/custom-keys.js +100 -0
  57. _nullius_app/static/settings/data-providers.js +88 -0
  58. _nullius_app/static/settings/judges.js +61 -0
  59. _nullius_app/static/settings/modal.css +32 -0
  60. _nullius_app/static/settings/modal.js +91 -0
  61. _nullius_app/static/settings/navigation.js +55 -0
  62. _nullius_app/static/settings/prices.js +68 -0
  63. _nullius_app/static/settings/providers.js +134 -0
  64. _nullius_app/static/settings/sandbox.js +20 -0
  65. _nullius_app/static/settings/settings.css +288 -0
  66. _nullius_app/static/style.css +1752 -0
  67. _nullius_app/static/traces/conversation.css +49 -0
  68. _nullius_app/static/traces/conversation.js +215 -0
  69. _nullius_app/templates/agents/entry.html +145 -0
  70. _nullius_app/templates/agents/kits.html +55 -0
  71. _nullius_app/templates/agents/standard.html +58 -0
  72. _nullius_app/templates/base.html +479 -0
  73. _nullius_app/templates/builder/new_run.html +55 -0
  74. _nullius_app/templates/catalogue/add_dialog.html +32 -0
  75. _nullius_app/templates/catalogue/benchmark.html +270 -0
  76. _nullius_app/templates/catalogue/benchmarks.html +91 -0
  77. _nullius_app/templates/catalogue/new.html +141 -0
  78. _nullius_app/templates/catalogue/use_bundle.html +11 -0
  79. _nullius_app/templates/compare/_detail.html +37 -0
  80. _nullius_app/templates/compare/compare.html +298 -0
  81. _nullius_app/templates/compare/compare_picker.html +51 -0
  82. _nullius_app/templates/compare/compare_task.html +329 -0
  83. _nullius_app/templates/runs/_execution.html +131 -0
  84. _nullius_app/templates/runs/_runtime.html +5 -0
  85. _nullius_app/templates/runs/ascii-mark.html +485 -0
  86. _nullius_app/templates/runs/feasibility.html +127 -0
  87. _nullius_app/templates/runs/index.html +609 -0
  88. _nullius_app/templates/runs/job.html +460 -0
  89. _nullius_app/templates/runs/preparing.html +14 -0
  90. _nullius_app/templates/runs/reconcile.html +124 -0
  91. _nullius_app/templates/runs/setup.html +272 -0
  92. _nullius_app/templates/runs/start.html +51 -0
  93. _nullius_app/templates/settings/custom_keys.html +82 -0
  94. _nullius_app/templates/settings/data_providers.html +27 -0
  95. _nullius_app/templates/settings/settings.html +564 -0
  96. _nullius_app/templates/traces/_charts.html +165 -0
  97. _nullius_app/templates/traces/_conversation.html +37 -0
  98. _nullius_app/templates/traces/_judgement.html +72 -0
  99. _nullius_app/templates/traces/artifact.html +15 -0
  100. _nullius_app/templates/traces/trial.html +838 -0
  101. _nullius_app/templates/workspaces/workspaces.html +54 -0
  102. _nullius_app/web/__init__.py +1 -0
  103. _nullius_app/web/agents.py +230 -0
  104. _nullius_app/web/builder.py +406 -0
  105. _nullius_app/web/catalogue.py +370 -0
  106. _nullius_app/web/compare.py +489 -0
  107. _nullius_app/web/core.py +17 -0
  108. _nullius_app/web/execute.py +223 -0
  109. _nullius_app/web/feasibility.py +60 -0
  110. _nullius_app/web/filters.py +231 -0
  111. _nullius_app/web/judge.py +623 -0
  112. _nullius_app/web/judge_tasks.py +33 -0
  113. _nullius_app/web/onboarding.py +20 -0
  114. _nullius_app/web/reconcile.py +47 -0
  115. _nullius_app/web/runs.py +464 -0
  116. _nullius_app/web/settings.py +324 -0
  117. _nullius_app/web/shared.py +507 -0
  118. _nullius_app/web/traces.py +306 -0
  119. _nullius_app/web/workspaces.py +84 -0
  120. nullius/__init__.py +32 -0
  121. nullius/__main__.py +5 -0
  122. nullius/catalogue/__init__.py +0 -0
  123. nullius/catalogue/agents/codex/agent.json +222 -0
  124. nullius/catalogue/agents/codex/config.toml +25 -0
  125. nullius/catalogue/agents/goose/agent.json +131 -0
  126. nullius/catalogue/agents/goose/config.yaml +20 -0
  127. nullius/catalogue/agents/jiuwenswarm/agent.json +197 -0
  128. nullius/catalogue/agents/jiuwenswarm/agent.py +355 -0
  129. nullius/catalogue/agents/mini-swe-agent/agent.json +68 -0
  130. nullius/catalogue/agents/mini-swe-agent/run.py +37 -0
  131. nullius/catalogue/agents/opencode/agent.json +135 -0
  132. nullius/catalogue/agents/opencode/opencode.json +32 -0
  133. nullius/catalogue/agents/reference/agent.json +89 -0
  134. nullius/catalogue/agents/reference/agent.py +209 -0
  135. nullius/catalogue/agents/terminus-2/agent.json +64 -0
  136. nullius/catalogue/agents/terminus-2/run.py +139 -0
  137. nullius/catalogue/benchmarks/gaia/benchmark.json +72 -0
  138. nullius/catalogue/benchmarks/gaia/data-source.json +29 -0
  139. nullius/catalogue/benchmarks/gaia/driver.py +188 -0
  140. nullius/catalogue/benchmarks/gaia/env/data.Dockerfile +1 -0
  141. nullius/catalogue/benchmarks/gaia/standard.json +278 -0
  142. nullius/catalogue/benchmarks/gaia/upstream-settings.json +275 -0
  143. nullius/catalogue/benchmarks/gsm8k/benchmark.json +34 -0
  144. nullius/catalogue/benchmarks/gsm8k/driver.py +101 -0
  145. nullius/catalogue/benchmarks/gsm8k/standard.json +124 -0
  146. nullius/catalogue/benchmarks/gsm8k/upstream-settings.json +86 -0
  147. nullius/catalogue/benchmarks/humaneval/benchmark.json +36 -0
  148. nullius/catalogue/benchmarks/humaneval/driver.py +243 -0
  149. nullius/catalogue/benchmarks/humaneval/standard.json +115 -0
  150. nullius/catalogue/benchmarks/humaneval/upstream-settings.json +72 -0
  151. nullius/catalogue/benchmarks/locomo/benchmark.json +43 -0
  152. nullius/catalogue/benchmarks/locomo/driver.py +270 -0
  153. nullius/catalogue/benchmarks/locomo/standard.json +265 -0
  154. nullius/catalogue/benchmarks/locomo/upstream-settings.json +112 -0
  155. nullius/catalogue/benchmarks/longmemeval/benchmark.json +65 -0
  156. nullius/catalogue/benchmarks/longmemeval/driver.py +379 -0
  157. nullius/catalogue/benchmarks/longmemeval/standard.json +733 -0
  158. nullius/catalogue/benchmarks/longmemeval/upstream-settings.json +76 -0
  159. nullius/catalogue/benchmarks/swe-bench-verified/benchmark.json +87 -0
  160. nullius/catalogue/benchmarks/swe-bench-verified/driver.py +116 -0
  161. nullius/catalogue/benchmarks/swe-bench-verified/images.json +502 -0
  162. nullius/catalogue/benchmarks/swe-bench-verified/standard.json +108 -0
  163. nullius/catalogue/benchmarks/swe-bench-verified/upstream-settings.json +32 -0
  164. nullius/catalogue/benchmarks/tau3-bench/benchmark.json +49 -0
  165. nullius/catalogue/benchmarks/tau3-bench/driver.py +608 -0
  166. nullius/catalogue/benchmarks/tau3-bench/mcp_server.py +114 -0
  167. nullius/catalogue/benchmarks/tau3-bench/search_relay.py +19 -0
  168. nullius/catalogue/benchmarks/tau3-bench/standard.json +547 -0
  169. nullius/catalogue/benchmarks/tau3-bench/upstream-settings.json +639 -0
  170. nullius/catalogue/benchmarks/terminal-bench/benchmark.json +69 -0
  171. nullius/catalogue/benchmarks/terminal-bench/driver.py +267 -0
  172. nullius/catalogue/benchmarks/terminal-bench/standard.json +166 -0
  173. nullius/catalogue/benchmarks/terminal-bench/upstream-settings.json +36 -0
  174. nullius/catalogue/capabilities/keyword-memory/capability.json +33 -0
  175. nullius/catalogue/capabilities/keyword-memory/capability.py +55 -0
  176. nullius/catalogue/capabilities/mem0/capability.json +135 -0
  177. nullius/catalogue/capabilities/mem0/capability.py +173 -0
  178. nullius/catalogue/catalog.py +426 -0
  179. nullius/catalogue/citation.py +116 -0
  180. nullius/catalogue/harbor_entry.py +367 -0
  181. nullius/catalogue/sources.py +107 -0
  182. nullius/catalogue/storage.py +125 -0
  183. nullius/cli.py +85 -0
  184. nullius/compare/__init__.py +0 -0
  185. nullius/compare/cli.py +265 -0
  186. nullius/compare/comparison.py +184 -0
  187. nullius/execution.py +1653 -0
  188. nullius/gitrefs.py +128 -0
  189. nullius/harbor/__init__.py +0 -0
  190. nullius/harbor/feed.py +228 -0
  191. nullius/harbor/source.py +582 -0
  192. nullius/hosts.py +368 -0
  193. nullius/importers/__init__.py +140 -0
  194. nullius/importers/atif.py +387 -0
  195. nullius/importers/cli.py +135 -0
  196. nullius/importers/otel.py +274 -0
  197. nullius/judge/__init__.py +14 -0
  198. nullius/judge/batch.py +122 -0
  199. nullius/judge/client.py +433 -0
  200. nullius/judge/floors.json +86 -0
  201. nullius/judge/lanes.py +89 -0
  202. nullius/judge/questions.py +309 -0
  203. nullius/judge/reconcile.py +176 -0
  204. nullius/judge/state.py +224 -0
  205. nullius/judge/store.py +167 -0
  206. nullius/migrate.py +268 -0
  207. nullius/onboarding.py +116 -0
  208. nullius/paths.py +89 -0
  209. nullius/prerequisites.py +129 -0
  210. nullius/prices.py +283 -0
  211. nullius/progress.py +294 -0
  212. nullius/providers.py +335 -0
  213. nullius/recipes/__init__.py +0 -0
  214. nullius/recipes/launch.py +78 -0
  215. nullius/redact.py +72 -0
  216. nullius/runs/__init__.py +0 -0
  217. nullius/runs/artifacts.py +67 -0
  218. nullius/runs/classify.py +216 -0
  219. nullius/runs/cli.py +316 -0
  220. nullius/runs/feasibility.py +442 -0
  221. nullius/runs/launches.py +149 -0
  222. nullius/runs/live.py +715 -0
  223. nullius/runs/parse.py +1016 -0
  224. nullius/runs/verifier.py +241 -0
  225. nullius/sandbox.py +109 -0
  226. nullius/secrets.py +218 -0
  227. nullius/settings.py +544 -0
  228. nullius/standard/__init__.py +15 -0
  229. nullius/standard/acp.py +305 -0
  230. nullius/standard/cancellation.py +19 -0
  231. nullius/standard/cli.py +703 -0
  232. nullius/standard/conform.py +149 -0
  233. nullius/standard/container.py +1870 -0
  234. nullius/standard/definitions.py +1651 -0
  235. nullius/standard/egress.py +192 -0
  236. nullius/standard/fidelity.py +256 -0
  237. nullius/standard/forward.py +139 -0
  238. nullius/standard/hostreq.py +105 -0
  239. nullius/standard/howto.py +220 -0
  240. nullius/standard/install.py +428 -0
  241. nullius/standard/job.py +551 -0
  242. nullius/standard/jsonl.py +129 -0
  243. nullius/standard/kits/agent-conversation-v1/driver.py +27 -0
  244. nullius/standard/kits/agent-conversation-v1/standard.json +26 -0
  245. nullius/standard/kits/agent-search-v1/driver.py +171 -0
  246. nullius/standard/kits/agent-search-v1/standard.json +99 -0
  247. nullius/standard/kits/agent-task-v1/driver.py +25 -0
  248. nullius/standard/kits/agent-task-v1/standard.json +100 -0
  249. nullius/standard/kits/agent-tools-v1/driver.py +206 -0
  250. nullius/standard/kits/agent-tools-v1/mcp_kit.py +209 -0
  251. nullius/standard/kits/agent-tools-v1/standard.json +119 -0
  252. nullius/standard/kits/agent-workspace-v1/driver.py +65 -0
  253. nullius/standard/kits/agent-workspace-v1/standard.json +95 -0
  254. nullius/standard/kits/cap-memory-v1/driver.py +39 -0
  255. nullius/standard/kits/cap-memory-v1/standard.json +91 -0
  256. nullius/standard/ledger.py +326 -0
  257. nullius/standard/match.py +66 -0
  258. nullius/standard/mcp_bridge.py +62 -0
  259. nullius/standard/mcp_machine.py +193 -0
  260. nullius/standard/merge.py +239 -0
  261. nullius/standard/names.py +37 -0
  262. nullius/standard/network_requirements.py +44 -0
  263. nullius/standard/pace.py +53 -0
  264. nullius/standard/payload.py +278 -0
  265. nullius/standard/pins.py +130 -0
  266. nullius/standard/ports.py +70 -0
  267. nullius/standard/prove.py +373 -0
  268. nullius/standard/recipe.py +746 -0
  269. nullius/standard/relay.py +785 -0
  270. nullius/standard/run.py +1781 -0
  271. nullius/standard/setup_container.py +208 -0
  272. nullius/standard/shard.py +71 -0
  273. nullius/standard/web_services.py +30 -0
  274. nullius/traces/__init__.py +0 -0
  275. nullius/traces/behavior.py +131 -0
  276. nullius/traces/charts.py +898 -0
  277. nullius/traces/conversation.py +159 -0
  278. nullius/traces/otel.py +608 -0
  279. nullius/traces/trace.py +1477 -0
  280. nullius/traces/trajectory.py +586 -0
  281. nullius/workspace.py +417 -0
  282. nullius/workspace_cli.py +119 -0
  283. nullius_eval-0.1.0.dist-info/METADATA +93 -0
  284. nullius_eval-0.1.0.dist-info/RECORD +291 -0
  285. nullius_eval-0.1.0.dist-info/WHEEL +5 -0
  286. nullius_eval-0.1.0.dist-info/entry_points.txt +2 -0
  287. nullius_eval-0.1.0.dist-info/licenses/LICENSE +202 -0
  288. nullius_eval-0.1.0.dist-info/licenses/app/static/fonts/dmsans-OFL.txt +93 -0
  289. nullius_eval-0.1.0.dist-info/licenses/app/static/fonts/ibmplexmono-OFL.txt +93 -0
  290. nullius_eval-0.1.0.dist-info/licenses/app/static/fonts/instrumentserif-OFL.txt +93 -0
  291. nullius_eval-0.1.0.dist-info/top_level.txt +2 -0
@@ -0,0 +1,355 @@
1
+ """JiuwenSwarm as an ACP agent for Nullius: one unit, one JiuwenSwarm.
2
+
3
+ JiuwenSwarm's ACP entry (``jiuwenswarm-acp``) is a stdio bridge to a running
4
+ Gateway, which talks to an AgentServer. This wrapper, run with the install's
5
+ own Python, gives the unit all three:
6
+
7
+ 1. a JiuwenSwarm home of its own under ``$HOME`` (Nullius gives every unit its
8
+ own), initialised once as ``jiuwenswarm-init`` does, in English;
9
+ 2. ``config/.env`` written over with the relay as the model (an
10
+ OpenAI-compatible client: ``MODEL_PROVIDER=OpenAI``, ``API_BASE``,
11
+ ``API_KEY``, ``MODEL_NAME``) and free ports, so units run side by side;
12
+ 3. the AgentServer and Gateway (``python -m jiuwenswarm.app``) started in the
13
+ background, their output on stderr, and waited for;
14
+ 4. the ACP bridge run with this process's stdout: stdout carries only ACP.
15
+
16
+ Between Nullius and the bridge, ACP is passed through line by line with three
17
+ changes, each taken from the protocol itself:
18
+
19
+ - ``session/new``'s ``mcpServers`` are written into ``config.yaml``'s
20
+ ``mcp.servers``: JiuwenSwarm reads MCP servers from its config, not from the
21
+ session (they are loaded when the session's agent is made, after this);
22
+ - each ``session/prompt`` carries ``workspace_dir`` = the session's ``cwd``,
23
+ JiuwenSwarm's own field for scoping a prompt's working directory;
24
+ - on the way back, an ``fs/read_text_file`` or ``fs/write_text_file`` request
25
+ gets the session's id and an absolute path. On ACP, JiuwenSwarm blocks its
26
+ own file and shell tools and uses the client's, but sends its internal
27
+ session id rather than the one ``session/new`` returned, and the model's
28
+ path as written, often relative; ACP requires the session's id and an
29
+ absolute path, and the client refuses the request without them. A client
30
+ that offers no files (Nullius on docker, where this wrapper runs in the
31
+ agent's container) gets none: ``initialize`` offers them to the bridge, and
32
+ this wrapper answers each request itself, inside the session's cwd.
33
+ Requests for the unit's own JiuwenSwarm home are served by this wrapper
34
+ on both backends, so its config and todo files remain accessible.
35
+
36
+ The resident worker uses a short, private socket path. When the bridge ends,
37
+ the servers and worker are stopped.
38
+ """
39
+ import json
40
+ import os
41
+ import signal
42
+ import socket
43
+ import subprocess
44
+ import sys
45
+ import tempfile
46
+ import threading
47
+ import time
48
+
49
+ PY = sys.executable
50
+ HOME = os.environ.get("HOME") or os.path.expanduser("~")
51
+ JHOME = os.path.join(HOME, ".jiuwenswarm")
52
+ CONFIG = os.path.join(JHOME, "config")
53
+ READY_SECONDS = 240
54
+
55
+
56
+ def say(*a):
57
+ print("[nullius agent.py]", *a, file=sys.stderr, flush=True)
58
+
59
+
60
+ def free_ports(n):
61
+ socks, ports = [], []
62
+ for _ in range(n):
63
+ s = socket.socket()
64
+ s.bind(("127.0.0.1", 0))
65
+ socks.append(s)
66
+ ports.append(s.getsockname()[1])
67
+ for s in socks:
68
+ s.close()
69
+ return ports
70
+
71
+
72
+ def listening(port):
73
+ try:
74
+ with socket.create_connection(("127.0.0.1", port), timeout=1):
75
+ return True
76
+ except OSError:
77
+ return False
78
+
79
+
80
+ def write_env(ports):
81
+ agent, gateway, web, front = ports
82
+ values = {
83
+ "MODEL_PROVIDER": "OpenAI",
84
+ "MODEL_NAME": os.environ["NULLIUS_MODEL"],
85
+ "API_BASE": os.environ["NULLIUS_BASE_URL"],
86
+ "API_KEY": os.environ["NULLIUS_KEY"],
87
+ "AGENT_SERVER_PORT": str(agent),
88
+ "AGENT_PORT": str(agent),
89
+ "GATEWAY_PORT": str(gateway),
90
+ "WEB_PORT": str(web),
91
+ "FRONTEND_PORT": str(front),
92
+ "GATEWAY_HOST": "127.0.0.1",
93
+ "AGENT_SERVER_HOST": "127.0.0.1",
94
+ }
95
+ with open(os.path.join(CONFIG, ".env"), "w") as f: # loaded over the environment: it is the one source
96
+ for k, v in values.items():
97
+ f.write(f"{k}={v}\n")
98
+ os.environ.update(values)
99
+
100
+
101
+ def memory_off():
102
+ """``modes.agent.memory.enabled: false``. A unit starts with no memory, and
103
+ with it on, the direct ``write_memory``/``read_memory`` tools stand in
104
+ for the client's file tools, which JiuwenSwarm offers only behind
105
+ ``tool_search``: the model writes the answer into its memory and stops."""
106
+ import yaml
107
+ path = os.path.join(CONFIG, "config.yaml")
108
+ with open(path) as f:
109
+ data = yaml.safe_load(f) or {}
110
+ data.setdefault("modes", {}).setdefault("agent", {}).setdefault("memory", {})["enabled"] = False
111
+ with open(path + ".part", "w") as f:
112
+ yaml.safe_dump(data, f, allow_unicode=True, sort_keys=False)
113
+ os.replace(path + ".part", path)
114
+
115
+
116
+ def reasoning_level():
117
+ """The run's reasoning effort (the option reasoning_effort, NULLIUS_REASONING) as
118
+ JiuwenSwarm's own ``reasoning_level`` of its default model; default leaves it
119
+ unset, so nothing is sent, as JiuwenSwarm does on its own."""
120
+ level = os.environ.get("NULLIUS_REASONING", "default")
121
+ if level in ("", "default"):
122
+ return
123
+ import yaml
124
+ path = os.path.join(CONFIG, "config.yaml")
125
+ with open(path) as f:
126
+ data = yaml.safe_load(f) or {}
127
+ model = ((data.get("models") or {}).get("defaults") or [{}])[0]
128
+ model.setdefault("model_config_obj", {})["reasoning_level"] = level
129
+ with open(path + ".part", "w") as f:
130
+ yaml.safe_dump(data, f, allow_unicode=True, sort_keys=False)
131
+ os.replace(path + ".part", path)
132
+
133
+
134
+ def mcp_into_config(servers):
135
+ """ACP's stdio MCP servers as JiuwenSwarm's ``mcp.servers`` entries."""
136
+ import yaml
137
+ path = os.path.join(CONFIG, "config.yaml")
138
+ with open(path) as f:
139
+ data = yaml.safe_load(f) or {}
140
+ entries = []
141
+ for s in servers or []:
142
+ if not s.get("command"):
143
+ continue # stdio only: what the standard sends
144
+ env = s.get("env") or {}
145
+ if isinstance(env, list):
146
+ env = {e["name"]: e["value"] for e in env}
147
+ entries.append({"name": s["name"], "enabled": True, "transport": "stdio",
148
+ "command": s["command"], "args": list(s.get("args") or []), "env": env})
149
+ data.setdefault("mcp", {})
150
+ if not isinstance(data["mcp"], dict):
151
+ data["mcp"] = {}
152
+ data["mcp"]["servers"] = entries
153
+ with open(path + ".part", "w") as f:
154
+ yaml.safe_dump(data, f, allow_unicode=True, sort_keys=False)
155
+ os.replace(path + ".part", path)
156
+ say("mcp servers:", [e["name"] for e in entries])
157
+
158
+
159
+ class Sessions:
160
+ """Each session's cwd, from session/new and the bridge's answer to it."""
161
+
162
+ def __init__(self):
163
+ self.pending, self.cwd, self.last, self.last_id = {}, {}, None, None
164
+ self.serve_fs, self.agent_in, self.lock = False, None, threading.Lock()
165
+
166
+ def of(self, sid):
167
+ return self.cwd.get(sid) or self.last
168
+
169
+ def to_bridge(self, line):
170
+ with self.lock:
171
+ self.agent_in.write(line)
172
+ self.agent_in.flush()
173
+
174
+
175
+ def in_home(path):
176
+ home = os.path.realpath(JHOME)
177
+ path = os.path.realpath(path)
178
+ return path == home or path.startswith(home + os.sep)
179
+
180
+
181
+ def serve_fs(msg, cwd):
182
+ """Serve files in the session workspace or this unit's JiuwenSwarm home."""
183
+ params, root = msg["params"], os.path.realpath(cwd or "/nonexistent")
184
+ path = os.path.realpath(str(params.get("path") or ""))
185
+ if path != root and not path.startswith(root + os.sep) and not in_home(path):
186
+ return {"code": -32602, "message": f"{params.get('path')} is outside the session's directory"}, None
187
+ try:
188
+ if msg["method"] == "fs/write_text_file":
189
+ os.makedirs(os.path.dirname(path), exist_ok=True)
190
+ with open(path, "w") as f:
191
+ f.write(str(params.get("content") or ""))
192
+ return None, {}
193
+ with open(path, errors="replace") as f:
194
+ lines = f.read().splitlines(keepends=True)
195
+ start = max(int(params.get("line") or 1), 1) - 1
196
+ end = start + int(params["limit"]) if params.get("limit") else None
197
+ return None, {"content": "".join(lines[start:end])}
198
+ except (OSError, ValueError) as e:
199
+ return {"code": -32603, "message": str(e)}, None
200
+
201
+
202
+ def to_agent(src, dst, ses):
203
+ """Nullius's requests to the bridge: session/new's MCP servers put into
204
+ the config, each prompt scoped to its session's cwd."""
205
+ try:
206
+ for line in iter(src.readline, b""):
207
+ try:
208
+ msg = json.loads(line)
209
+ except ValueError:
210
+ msg = None
211
+ if isinstance(msg, dict) and isinstance(msg.get("params"), dict):
212
+ method, params = msg.get("method"), msg["params"]
213
+ if method == "initialize":
214
+ fs = (params.get("clientCapabilities") or {}).get("fs") or {}
215
+ if not (fs.get("readTextFile") and fs.get("writeTextFile")):
216
+ ses.serve_fs = True
217
+ params.setdefault("clientCapabilities", {})["fs"] = {"readTextFile": True, "writeTextFile": True}
218
+ line = (json.dumps(msg) + "\n").encode()
219
+ elif method == "session/new":
220
+ mcp_into_config(params.get("mcpServers"))
221
+ ses.pending[msg.get("id")] = ses.last = params.get("cwd")
222
+ elif method == "session/prompt":
223
+ cwd = ses.of(params.get("sessionId"))
224
+ if cwd:
225
+ params.setdefault("workspace_dir", cwd)
226
+ line = (json.dumps(msg) + "\n").encode()
227
+ ses.to_bridge(line)
228
+ except (BrokenPipeError, OSError):
229
+ pass
230
+ finally:
231
+ try:
232
+ dst.close()
233
+ except OSError:
234
+ pass
235
+
236
+
237
+ def to_client(src, dst, ses):
238
+ """The bridge's messages to Nullius: an fs/ request given the ACP session
239
+ id (JiuwenSwarm sends its own internal one), and a relative path made
240
+ absolute against that session's cwd (ACP paths are absolute)."""
241
+ for line in iter(src.readline, b""):
242
+ try:
243
+ msg = json.loads(line)
244
+ except ValueError:
245
+ say("not protocol, kept off stdout:", line[:200])
246
+ continue
247
+ if isinstance(msg, dict):
248
+ res = msg.get("result")
249
+ if msg.get("id") in ses.pending and isinstance(res, dict) and res.get("sessionId"):
250
+ ses.cwd[res["sessionId"]] = ses.pending.pop(msg["id"])
251
+ ses.last_id = res["sessionId"]
252
+ params = msg.get("params")
253
+ if str(msg.get("method", "")).startswith("fs/") and isinstance(params, dict):
254
+ if params.get("sessionId") not in ses.cwd and ses.last_id:
255
+ params["sessionId"] = ses.last_id # its own internal id, or none
256
+ path, cwd = params.get("path"), ses.of(params.get("sessionId"))
257
+ if isinstance(path, str) and path and not os.path.isabs(path) and cwd:
258
+ params["path"] = os.path.normpath(os.path.join(cwd, path))
259
+ own_home = isinstance(params.get("path"), str) and in_home(params["path"])
260
+ if (ses.serve_fs or own_home) and "id" in msg:
261
+ err, res = serve_fs(msg, ses.of(params.get("sessionId")))
262
+ reply = {"jsonrpc": "2.0", "id": msg["id"], **({"error": err} if err else {"result": res})}
263
+ ses.to_bridge((json.dumps(reply) + "\n").encode())
264
+ continue
265
+ line = (json.dumps(msg) + "\n").encode()
266
+ dst.write(line)
267
+ dst.flush()
268
+
269
+
270
+ def stop_worker(env):
271
+ """0.2.8's resident worker outlives the frontend; use its shutdown API."""
272
+ path = env["JIUWENSWARM_RUNTIME_SOCKET"]
273
+ if not os.path.exists(path):
274
+ return
275
+ code = ("import asyncio, os, sys\n"
276
+ "from jiuwenswarm.server.supervisor.worker_process import request_resident_worker_shutdown\n"
277
+ "async def stop():\n"
278
+ " await request_resident_worker_shutdown(sys.argv[1])\n"
279
+ " while os.path.exists(sys.argv[1]):\n"
280
+ " await asyncio.sleep(0.05)\n"
281
+ "asyncio.run(asyncio.wait_for(stop(), 25))\n")
282
+ try:
283
+ subprocess.run([PY, "-c", code, path], env=env, stdin=subprocess.DEVNULL,
284
+ stdout=sys.stderr, stderr=sys.stderr, timeout=30, check=True)
285
+ except (subprocess.SubprocessError, OSError) as e:
286
+ say("runtime worker shutdown failed:", e)
287
+
288
+
289
+ def run(runtime_socket):
290
+ os.makedirs(HOME, exist_ok=True)
291
+ if not os.path.isfile(os.path.join(CONFIG, "config.yaml")):
292
+ r = subprocess.run([PY, "-c", "from jiuwenswarm.common.utils import prepare_workspace\n"
293
+ "prepare_workspace(False, preferred_language='en')"], stdin=subprocess.DEVNULL,
294
+ stdout=sys.stderr, stderr=sys.stderr, cwd=HOME)
295
+ if r.returncode:
296
+ say("jiuwenswarm-init failed:", r.returncode)
297
+ return 1
298
+ memory_off()
299
+ reasoning_level()
300
+ ports = free_ports(4)
301
+ write_env(ports)
302
+ env = dict(os.environ, PYTHONIOENCODING="utf-8", PYTHONUNBUFFERED="1",
303
+ JIUWENSWARM_RUNTIME_SOCKET=runtime_socket)
304
+ server = subprocess.Popen([PY, "-m", "jiuwenswarm.app"], stdin=subprocess.DEVNULL,
305
+ stdout=sys.stderr, stderr=sys.stderr, cwd=HOME, env=env)
306
+ bridge = None
307
+
308
+ def stop(*_):
309
+ for p in (bridge, server):
310
+ if p is not None and p.poll() is None:
311
+ p.terminate()
312
+ deadline = time.time() + 10
313
+ for p in (bridge, server):
314
+ while p is not None and p.poll() is None and time.time() < deadline:
315
+ time.sleep(0.1)
316
+ if p is not None and p.poll() is None:
317
+ p.kill()
318
+
319
+ signal.signal(signal.SIGTERM, lambda *a: (stop(), sys.exit(143)))
320
+ try:
321
+ t0 = time.time()
322
+ while not (listening(ports[0]) and listening(ports[1])):
323
+ if server.poll() is not None:
324
+ say("JiuwenSwarm ended before it was ready:", server.returncode)
325
+ return 1
326
+ if time.time() - t0 > READY_SECONDS:
327
+ say(f"JiuwenSwarm not ready in {READY_SECONDS} s")
328
+ return 1
329
+ time.sleep(0.25)
330
+ say(f"ready in {time.time() - t0:.1f} s: agent server :{ports[0]}, gateway :{ports[1]}")
331
+ bridge = subprocess.Popen([PY, "-m", "jiuwenswarm.gateway.channel_manager.protocol.acp.acp_connect",
332
+ "--gateway-url", f"ws://127.0.0.1:{ports[1]}/acp"],
333
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=sys.stderr, env=env, bufsize=0)
334
+ ses = Sessions()
335
+ ses.agent_in = bridge.stdin
336
+ threading.Thread(target=to_agent, args=(sys.stdin.buffer, bridge.stdin, ses), daemon=True).start()
337
+ out = threading.Thread(target=to_client, args=(bridge.stdout, sys.stdout.buffer, ses), daemon=True)
338
+ out.start()
339
+ code = bridge.wait()
340
+ out.join(5)
341
+ return code
342
+ finally:
343
+ stop()
344
+ stop_worker(env)
345
+
346
+
347
+ def main():
348
+ # A long job path exceeds the Unix socket limit. Each unit owns a short,
349
+ # private directory, including on the local backend where /tmp is shared.
350
+ with tempfile.TemporaryDirectory(prefix="nj-", dir="/tmp") as runtime:
351
+ return run(os.path.join(runtime, "worker.sock"))
352
+
353
+
354
+ if __name__ == "__main__":
355
+ sys.exit(main())
@@ -0,0 +1,68 @@
1
+ {
2
+ "schema": "nullius.agent/v1",
3
+ "key": "mini-swe-agent",
4
+ "label": "mini-swe-agent",
5
+ "summary": "Princeton's 100-line agent, bash only.",
6
+ "upstream": {
7
+ "package": "mini-swe-agent",
8
+ "version": "2.4.6",
9
+ "license": "MIT"
10
+ },
11
+ "install": {
12
+ "python": "3.12",
13
+ "pip": [
14
+ "mini-swe-agent==2.4.6",
15
+ "litellm==1.105.7"
16
+ ]
17
+ },
18
+ "start": {
19
+ "command": [
20
+ "{install}/.venv/bin/python",
21
+ "{here}/run.py",
22
+ "{prompt}"
23
+ ]
24
+ },
25
+ "model": {
26
+ "apis": [
27
+ "chat"
28
+ ],
29
+ "env": {
30
+ "MSWEA_MODEL_NAME": "openai/{model}",
31
+ "OPENAI_API_BASE": "{base_url}",
32
+ "OPENAI_API_KEY": "{key}",
33
+ "MSWEA_CONFIGURED": "true",
34
+ "MSWEA_COST_TRACKING": "ignore_errors",
35
+ "MSWEA_SILENT_STARTUP": "1",
36
+ "NULLIUS_REASONING_EFFORT": "{opt_reasoning_effort}"
37
+ }
38
+ },
39
+ "options": {
40
+ "reasoning_effort": {
41
+ "summary": "How much reasoning a supported model uses before answering, with `default` leaving the choice to the provider.",
42
+ "values": [
43
+ "default",
44
+ "minimal",
45
+ "low",
46
+ "medium",
47
+ "high"
48
+ ],
49
+ "default": "default"
50
+ }
51
+ },
52
+ "only_for": ["swe-bench-verified"],
53
+ "offers": [
54
+ "agent.workspace/v1"
55
+ ],
56
+ "proven": {
57
+ "agent.workspace/v1": {
58
+ "passed": "2/2",
59
+ "on": "2026-11-02",
60
+ "model": "openai/gpt-5-mini",
61
+ "provider": "openrouter",
62
+ "version": "2.4.6",
63
+ "kit_version": 1,
64
+ "backend": "docker",
65
+ "job": "2026-11-02__14-21-58__kit__agent-workspace-v1__mini-swe-agent"
66
+ }
67
+ }
68
+ }
@@ -0,0 +1,37 @@
1
+ """mini-swe-agent as a command agent of the Nullius standard.
2
+
3
+ mini prints its whole conversation to the terminal; the answer is what it
4
+ submits at the end (its trajectory's ``info.submission``). This runs mini on
5
+ the task given as the one argument, in the current directory (the unit's
6
+ workspace), with its own output sent to stderr - the agent's log - and prints
7
+ only the submission on stdout, which Nullius reads as the answer.
8
+
9
+ run.py "<the task>"
10
+
11
+ The model, its endpoint and key come from the environment the definition
12
+ sets (MSWEA_MODEL_NAME, OPENAI_API_BASE, OPENAI_API_KEY): the relay's; the
13
+ reasoning effort from NULLIUS_REASONING_EFFORT (the option reasoning_effort).
14
+ """
15
+ import json
16
+ import os
17
+ import subprocess
18
+ import sys
19
+ import tempfile
20
+
21
+ task = sys.argv[1]
22
+ out = os.path.join(tempfile.mkdtemp(prefix="mini-"), "trajectory.json")
23
+ mini = os.path.join(os.path.dirname(sys.executable), "mini")
24
+ # the run's reasoning effort, mini's own model.model_kwargs.reasoning_effort; -c replaces mini's config list, so its
25
+ # own mini.yaml is named first (drop_params kept). default: none, as mini sends on its own.
26
+ effort = os.environ.get("NULLIUS_REASONING_EFFORT", "default")
27
+ config = ["-c", "mini.yaml", "-c", f"model.model_kwargs.reasoning_effort={effort}"] if effort not in ("", "default") else []
28
+ rc = subprocess.run([mini, "--task", task, "--yolo", "--exit-immediately", "--cost-limit", "0", "--output", out, *config],
29
+ stdin=subprocess.DEVNULL, stdout=sys.stderr, stderr=sys.stderr).returncode
30
+ try:
31
+ with open(out) as f:
32
+ traj = json.load(f)
33
+ except (OSError, ValueError):
34
+ sys.exit(rc or 1)
35
+ info = traj.get("info") or {}
36
+ print((info.get("submission") or "").strip())
37
+ sys.exit(0 if info.get("exit_status") in (None, "Submitted") else (rc or 0))
@@ -0,0 +1,135 @@
1
+ {
2
+ "schema": "nullius.agent/v1",
3
+ "key": "opencode",
4
+ "label": "OpenCode",
5
+ "summary": "The open-source terminal coding agent.",
6
+ "upstream": {
7
+ "package": "opencode-ai",
8
+ "version": "1.18.35",
9
+ "license": "MIT"
10
+ },
11
+ "install": {
12
+ "npm": [
13
+ "opencode-ai@1.18.35"
14
+ ]
15
+ },
16
+ "start": {
17
+ "acp": [
18
+ "{install}/node_modules/.bin/opencode",
19
+ "acp"
20
+ ]
21
+ },
22
+ "model": {
23
+ "apis": [
24
+ "responses"
25
+ ],
26
+ "env": {
27
+ "OPENCODE_CONFIG": "{home}/.config/opencode/opencode.json",
28
+ "XDG_CONFIG_HOME": "{home}/.config",
29
+ "XDG_DATA_HOME": "{home}/.local/share",
30
+ "XDG_CACHE_HOME": "{home}/.cache",
31
+ "XDG_STATE_HOME": "{home}/.local/state",
32
+ "NULLIUS_RELAY_KEY": "{key}",
33
+ "OPENCODE_DISABLE_AUTOUPDATE": "1",
34
+ "OPENCODE_DISABLE_SHARE": "1",
35
+ "OPENCODE_DISABLE_MODELS_FETCH": "1",
36
+ "OPENCODE_DISABLE_LSP_DOWNLOAD": "1",
37
+ "OPENCODE_DISABLE_DEFAULT_PLUGINS": "1",
38
+ "OPENCODE_DISABLE_CLAUDE_CODE": "1"
39
+ },
40
+ "files": {
41
+ "{home}/.config/opencode/opencode.json": "opencode.json"
42
+ }
43
+ },
44
+ "caches": [
45
+ "{home}/.npm",
46
+ "{home}/.config/opencode/node_modules"
47
+ ],
48
+ "options": {
49
+ "reasoning_effort": {
50
+ "summary": "How much reasoning a supported model uses before answering.",
51
+ "values": [
52
+ "none",
53
+ "minimal",
54
+ "low",
55
+ "medium",
56
+ "high",
57
+ "xhigh"
58
+ ],
59
+ "default": "medium"
60
+ }
61
+ },
62
+ "offers": [
63
+ "agent.task/v1",
64
+ "agent.workspace/v1",
65
+ "agent.tools/v1",
66
+ "agent.conversation/v1",
67
+ "agent.search/v1"
68
+ ],
69
+ "proven": {
70
+ "agent.task/v1": {
71
+ "passed": "3/3",
72
+ "on": "2026-11-02",
73
+ "model": "openai/gpt-5-mini",
74
+ "provider": "openrouter",
75
+ "version": "1.18.35",
76
+ "kit_version": 1,
77
+ "backend": "docker",
78
+ "job": "2026-11-02__14-10-35__kit__agent-task-v1__opencode"
79
+ },
80
+ "agent.workspace/v1": {
81
+ "passed": "2/2",
82
+ "on": "2026-11-02",
83
+ "model": "openai/gpt-5-mini",
84
+ "provider": "openrouter",
85
+ "version": "1.18.35",
86
+ "kit_version": 1,
87
+ "backend": "docker",
88
+ "job": "2026-11-02__14-12-08__kit__agent-workspace-v1__opencode"
89
+ },
90
+ "agent.tools/v1": {
91
+ "passed": "2/2",
92
+ "on": "2026-11-02",
93
+ "model": "openai/gpt-5-mini",
94
+ "provider": "openrouter",
95
+ "version": "1.18.35",
96
+ "kit_version": 2,
97
+ "backend": "docker",
98
+ "job": "2026-11-02__14-12-40__kit__agent-tools-v1__opencode",
99
+ "skills": {
100
+ "decoys": {
101
+ "passed": "1/1",
102
+ "ok": true
103
+ },
104
+ "chain": {
105
+ "passed": "1/1",
106
+ "ok": true
107
+ },
108
+ "retry": {
109
+ "passed": "1/1",
110
+ "ok": true
111
+ }
112
+ }
113
+ },
114
+ "agent.conversation/v1": {
115
+ "passed": "2/2",
116
+ "on": "2026-11-02",
117
+ "model": "openai/gpt-5-mini",
118
+ "provider": "openrouter",
119
+ "version": "1.18.35",
120
+ "kit_version": 1,
121
+ "backend": "docker",
122
+ "job": "2026-11-02__14-14-07__kit__agent-conversation-v1__opencode"
123
+ },
124
+ "agent.search/v1": {
125
+ "passed": "3/3",
126
+ "on": "2026-11-12",
127
+ "model": "meta/muse-spark-1.3-contributor",
128
+ "provider": "openrouter",
129
+ "version": "1.18.35",
130
+ "kit_version": 1,
131
+ "backend": "docker",
132
+ "job": "2026-11-12__11-10-20__kit__agent-search-v1__opencode"
133
+ }
134
+ }
135
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "$schema": "https://opencode.ai/config.json",
3
+ "model": "nullius/{model}",
4
+ "small_model": "nullius/{model}",
5
+ "enabled_providers": ["nullius"],
6
+ "autoupdate": false,
7
+ "share": "disabled",
8
+ "permission": {
9
+ "edit": "allow",
10
+ "bash": "allow",
11
+ "webfetch": "allow",
12
+ "external_directory": "deny"
13
+ },
14
+ "provider": {
15
+ "nullius": {
16
+ "name": "Nullius relay",
17
+ "npm": "@ai-sdk/openai",
18
+ "options": {
19
+ "baseURL": "{base_url}",
20
+ "apiKey": "{env:NULLIUS_RELAY_KEY}"
21
+ },
22
+ "models": {
23
+ "{model}": {
24
+ "name": "{model}",
25
+ "options": {
26
+ "reasoningEffort": "{opt_reasoning_effort}"
27
+ }
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }