diff --git a/app/nullius/catalogue/agents/digitalmate/agent.json b/app/nullius/catalogue/agents/digitalmate/agent.json
index 717fec07..26870e9a 100644
--- a/app/nullius/catalogue/agents/digitalmate/agent.json
+++ b/app/nullius/catalogue/agents/digitalmate/agent.json
@@ -2,14 +2,14 @@
"schema": "nullius.agent/v1",
"key": "digitalmate",
"label": "DigitalMate",
- "summary": "DigitalMate's Personal Agent service with its owned WorkSwarm runtime.",
+ "summary": "DigitalMate's Personal Agent service, run as Hive Home with its owned WorkSwarm runtimes.",
"upstream": {
"repository": "https://github.com/openJiuwen-ai/DigitalMate",
- "tested": "709f4d39d613cf191d0dbb8bf1e4bec8e8695edf",
+ "tested": "7dbfc6729963ea9173c50f30c38385a8980a4b11",
"license": "Apache-2.0",
- "tag": "v0.1.12",
+ "tag": "v0.1.13",
"core": "Bundled WorkSwarm 0d6857507236d1299276caf0f6fe09e5baaa4c23 and agent-core 8f9f112698d5580b749158b21b1a89a54e16a8f9, verified and installed by the release installer",
- "version": "0.1.12"
+ "version": "0.1.13"
},
"install": {
"python": "3.13",
@@ -20,25 +20,53 @@
"commands": [
[
"uv",
- "pip",
- "install",
+ "venv",
"--quiet",
+ "--seed",
"--python",
"{install}/.venv/bin/python",
- "{install}/src/harness/personal-agent/services/agent_bridge[geo]"
+ "{install}/runtime"
+ ],
+ [
+ "{install}/runtime/bin/python",
+ "{install}/src/harness/personal-agent/deploy/install_runtime.py",
+ "--wheel-dir",
+ "{install}/wheels"
+ ],
+ [
+ "{install}/runtime/bin/python",
+ "-m",
+ "pip",
+ "install",
+ "--quiet",
+ "{install}/src/temp/history-context-recovery",
+ "{install}/src",
+ "{install}/src/harness/personal-agent/services/agent_bridge"
+ ],
+ [
+ "{install}/runtime/bin/python",
+ "-m",
+ "pip",
+ "check"
],
[
"uv",
- "venv",
+ "pip",
+ "install",
"--quiet",
- "--seed",
"--python",
"{install}/.venv/bin/python",
- "{install}/runtime"
+ "{install}/src/plugins",
+ "{install}/src/temp/history-context-recovery",
+ "{install}/wheels/openjiuwen-0.1.19-py3-none-any.whl",
+ "{install}/src/harness/personal-agent/services/agent_bridge[geo,agent]"
],
[
- "{install}/runtime/bin/python",
- "{install}/src/harness/personal-agent/deploy/install_runtime.py"
+ "uv",
+ "pip",
+ "check",
+ "--python",
+ "{install}/.venv/bin/python"
]
]
},
@@ -63,18 +91,25 @@
}
},
"offers": [
- "agent.task/v1"
+ "agent.task/v1",
+ "agent.search/v1"
],
"proven": {
"agent.task/v1": {
"passed": "3/3",
- "on": "2026-11-20",
"model": "meta/muse-spark-1.3-contributor",
"provider": "openrouter",
- "version": "0.1.12",
+ "version": "0.1.13",
+ "kit_version": 1,
+ "backend": "container"
+ },
+ "agent.search/v1": {
+ "passed": "3/3",
+ "model": "meta/muse-spark-1.3-contributor",
+ "provider": "openrouter",
+ "version": "0.1.13",
"kit_version": 1,
- "backend": "container",
- "job": "2026-11-20__15-16-06__kit__agent-task-v1__digitalmate"
+ "backend": "container"
}
}
}
diff --git a/app/nullius/catalogue/agents/digitalmate/gateway.py b/app/nullius/catalogue/agents/digitalmate/gateway.py
index 5af1efb3..9a5e937d 100644
--- a/app/nullius/catalogue/agents/digitalmate/gateway.py
+++ b/app/nullius/catalogue/agents/digitalmate/gateway.py
@@ -1,8 +1,7 @@
-"""Submit a task through DigitalMate's native Gateway and return its final answer."""
+"""Submit a task to DigitalMate's Hive Home through its Gateway and return the final answer."""
from __future__ import annotations
import json
-from pathlib import Path
import time
import uuid
@@ -12,26 +11,32 @@
class Gateway:
def __init__(self, socket, deadline: float):
- self.socket = socket
- self.deadline = deadline
+ self.socket, self.deadline = socket, deadline
self.sequence = 0
+ self.events: list[dict] = []
- def request(self, **params) -> dict:
+ def receive(self, end: float) -> dict:
+ remaining = end - time.monotonic()
+ if remaining <= 0:
+ raise TimeoutError("DigitalMate task deadline exceeded")
+ frame = json.loads(self.socket.recv(timeout=remaining))
+ if not isinstance(frame, dict):
+ raise RuntimeError("DigitalMate Gateway returned an invalid frame")
+ if frame.get("final") is True and frame.get("event") in {
+ "digitalmate.task.text", "hive.beebou.reply",
+ }:
+ self.events.append(frame)
+ return frame
+
+ def rpc(self, method: str, **params) -> dict:
self.sequence += 1
request_id = f"nullius-{self.sequence}"
- end = min(self.deadline, time.monotonic() + 120)
- if time.monotonic() >= end:
+ if time.monotonic() >= self.deadline:
raise TimeoutError("DigitalMate task deadline exceeded")
- self.socket.send(json.dumps({
- "id": request_id, "method": "digitalmate.request", "params": params,
- }, ensure_ascii=False))
+ self.socket.send(json.dumps({"id": request_id, "method": method, "params": params}, ensure_ascii=False))
while True:
- remaining = end - time.monotonic()
- if remaining <= 0:
- raise TimeoutError("DigitalMate request timed out: " + params["action"])
- reply = json.loads(self.socket.recv(timeout=remaining))
- # Ignore streamed events; only task snapshots contain the final result.
- if not isinstance(reply, dict) or reply.get("id") != request_id:
+ reply = self.receive(self.deadline)
+ if reply.get("id") != request_id:
continue
if reply.get("ok") is not True:
error = reply.get("error") or {}
@@ -42,58 +47,146 @@ def request(self, **params) -> dict:
return result
-def find_task(snapshot: dict, room_id: str, submission_id: str) -> dict | None:
- root = snapshot.get("snapshot", snapshot)
- if not isinstance(root, dict) or not isinstance(root.get("tasks", []), list):
- raise RuntimeError("DigitalMate Gateway returned an invalid snapshot")
- for task in root.get("tasks", []):
- if isinstance(task, dict) and task.get("room_id") == room_id and task.get("submission_id") == submission_id:
- return task
- return None
+def text_answer(value) -> str:
+ if not isinstance(value, str) or not value.strip():
+ raise RuntimeError("DigitalMate completed without a final answer")
+ return value
-def final_answer(task: dict) -> str:
- if task.get("status") != "completed":
- raise RuntimeError("DigitalMate task did not complete: " + str(task.get("status")))
- answer = task.get("result")
- if not isinstance(answer, str) or not answer.strip():
- raise RuntimeError("DigitalMate completed without a final answer")
- return answer
+def task_refs(value) -> set[str]:
+ if not isinstance(value, list) or any(not isinstance(ref, str) or not ref for ref in value):
+ raise RuntimeError("DigitalMate returned an invalid Hive task receipt")
+ return set(value)
+
+
+class Completion:
+ """A user turn and the complete dispatch lineage of its committed Bee reports."""
+
+ def __init__(self, message_id: str):
+ self.message_id = message_id
+ self.initial = False
+ self.tasks: set[str] = set()
+ self.terminals: set[str] = set()
+ self.reports: set[str] = set()
+ self.answer = None
+ self.answer_seq = -1
+ self.seen: set[str] = set()
+
+ def response(self, reply: dict) -> None:
+ if reply.get("message_id") != self.message_id:
+ raise RuntimeError("DigitalMate returned a different submission receipt")
+ status = reply.get("status")
+ if status in {"committed", "COMPLETED"}:
+ self.tasks.update(task_refs(reply.get("task_refs")))
+ self.answer = text_answer(reply.get("answer"))
+ self.initial = True
+ elif status not in {"accepted", "pending"}:
+ raise RuntimeError("DigitalMate Hive turn did not complete: " + str(status))
+
+ def collect(self, events: list[dict]) -> None:
+ # A child may finish before its parent's report arrives. Retain unmatched
+ # events and revisit after the report adds that child's task_ref.
+ changed = True
+ while changed:
+ changed = False
+ for event in events:
+ identity = event.get("event_id")
+ if not isinstance(identity, str) or not identity or identity in self.seen:
+ continue
+ if event["event"] == "digitalmate.task.text":
+ ref = event.get("task_id")
+ if ref not in self.tasks:
+ continue
+ if event.get("state") not in (None, "completed"):
+ raise RuntimeError("DigitalMate Bee task ended: " + str(event["state"]))
+ text_answer(event.get("text"))
+ self.terminals.add(ref)
+ else:
+ trigger, ref = event.get("trigger"), event.get("task_ref")
+ if trigger == "user":
+ if event.get("source_message_id") != self.message_id:
+ continue
+ elif trigger != "bee_done" or ref not in self.tasks:
+ continue
+ if event.get("outcome") != "committed":
+ raise RuntimeError("DigitalMate Beebou reply did not commit")
+ self.tasks.update(task_refs(event.get("task_refs")))
+ if trigger == "user":
+ self.initial = True
+ else:
+ self.reports.add(ref)
+ sequence = event.get("source_seq")
+ if not isinstance(sequence, int):
+ raise RuntimeError("DigitalMate returned an invalid Hive reply sequence")
+ answer = text_answer(event.get("text"))
+ if sequence > self.answer_seq:
+ self.answer, self.answer_seq = answer, sequence
+ self.seen.add(identity)
+ changed = True
+
+ @property
+ def done(self) -> bool:
+ return self.initial and self.tasks <= self.terminals and self.tasks <= self.reports
+
+
+def await_answer(gateway: Gateway, completion: Completion) -> str:
+ """The turn's final answer once every Bee it dispatched has reported."""
+ while True:
+ completion.collect(gateway.events)
+ if completion.done:
+ return text_answer(completion.answer)
+ for ref in sorted(completion.tasks - completion.terminals):
+ result = gateway.rpc("hive.result.get", task_ref=ref)
+ if result.get("status") == "waiting_user":
+ # A one-task run has nobody to answer a Bee's question.
+ raise RuntimeError("DigitalMate Bee task requires user input")
+ if result.get("status") not in {"pending", "available"}:
+ raise RuntimeError("DigitalMate returned an invalid Hive result status")
+ completion.collect(gateway.events)
+ if completion.done:
+ return text_answer(completion.answer)
+ pause(gateway)
+
+
+def pause(gateway: Gateway) -> None:
+ # Receive live replies between polls; an idle socket is not a failed task.
+ end = min(gateway.deadline, time.monotonic() + 1)
+ try:
+ gateway.receive(end)
+ except TimeoutError:
+ if time.monotonic() >= gateway.deadline:
+ raise TimeoutError("DigitalMate task deadline exceeded") from None
+
+
+def stop_tasks(gateway: Gateway, completion: Completion) -> None:
+ # Best effort through the public owner. run.py also stops the entire isolated
+ # process group, including a turn that never returned a dispatch receipt.
+ gateway.deadline = time.monotonic() + 5
+ for ref in sorted(completion.tasks - completion.terminals):
+ try:
+ gateway.rpc("hive.bee.stop", operation_id=str(uuid.uuid4()), task_ref=ref)
+ except (OSError, RuntimeError, ValueError, WebSocketException):
+ break
-def submit_task(prompt: str, project_path: Path, token: str, *, timeout: float = 600,
+def submit_task(prompt: str, token: str, *, timeout: float = 600,
url: str = "ws://127.0.0.1:18092/digitalmate/ws") -> str:
- """Use the isolated local service; forward the prompt and workspace unchanged."""
+ """Send the prompt unchanged as one Hive user turn; the answer is Beebou's last committed reply."""
deadline = time.monotonic() + timeout
+ completion = Completion(str(uuid.uuid4()))
try:
- with connect(url,
- additional_headers={"Authorization": "Bearer " + token},
+ with connect(url, additional_headers={"Authorization": "Bearer " + token},
open_timeout=min(30, timeout), close_timeout=5,
max_size=32 * 1024 * 1024, proxy=None) as socket:
gateway = Gateway(socket, deadline)
- created = gateway.request(action="room.create", title="Nullius task", agent_id="digitalmate")
- room_id = created.get("room_id")
- if not isinstance(room_id, str) or not room_id:
- raise RuntimeError("DigitalMate room.create returned no room_id")
- submission_id = str(uuid.uuid4())
- snapshot = gateway.request(
- action="room.message", room_id=room_id, submission_id=submission_id,
- agent_id="digitalmate", text=prompt, project_path=str(project_path),
- client={"language": "en", "device": "mobile"},
- )
- task = find_task(snapshot, room_id, submission_id)
- if task is None and not snapshot.get("task_id"):
- raise RuntimeError("DigitalMate room.message returned no task receipt")
- while True:
- if task is not None:
- status = task.get("status")
- if status not in {"pending", "queued", "running"}:
- return final_answer(task)
- remaining = deadline - time.monotonic()
- if remaining <= 0:
- raise TimeoutError("DigitalMate task deadline exceeded")
- time.sleep(min(1, remaining))
- task = find_task(gateway.request(action="snapshot"), room_id, submission_id)
+ try:
+ completion.response(gateway.rpc("hive.message.send", message_id=completion.message_id, text=prompt))
+ return await_answer(gateway, completion)
+ except BaseException:
+ stop_tasks(gateway, completion)
+ raise
except WebSocketException as error:
# Keep authentication headers and connection internals out of stderr.
- raise RuntimeError("DigitalMate Gateway connection failed") from error
+ close = getattr(error, "rcvd", None) or getattr(error, "sent", None)
+ code = f" {close.code}" if close is not None else ""
+ raise RuntimeError(f"DigitalMate Gateway connection failed: {type(error).__name__}{code}") from error
diff --git a/app/nullius/catalogue/agents/digitalmate/run.py b/app/nullius/catalogue/agents/digitalmate/run.py
index 0feaf65d..160c3fcc 100644
--- a/app/nullius/catalogue/agents/digitalmate/run.py
+++ b/app/nullius/catalogue/agents/digitalmate/run.py
@@ -58,7 +58,8 @@ def run(install: Path, prompt: str) -> str:
token = uuid.uuid4().hex
env.update(
DIGITALMATE_ACCESS_TOKEN=token,
- DIGITALMATE_WORKSWARM_COMMAND=json.dumps([str(runtime), str(launcher)]),
+ DIGITALMATE_CLIENT_AUTH="instance",
+ DIGITALMATE_WORKSWARM_COMMAND=json.dumps([str(runtime), "-m", "server_engine.workswarm_launcher"]),
DIGITALMATE_SEARCH_PYTHON=sys.executable,
DIGITALMATE_WORKSWARM_TOOL_PYTHON=str(runtime),
)
@@ -67,11 +68,13 @@ def run(install: Path, prompt: str) -> str:
env.setdefault("DIGITALMATE_MEMORY_BACKEND", "sqlite-offline")
env.setdefault("DIGITALMATE_SCHEDULE_SCAN_ENABLED", "0")
# These values must not redirect this trial to a deployed service.
- for key in ("DIGITALMATE_WORKSWARM_WS", "DIGITALMATE_CONFIG_FILE", "DIGITALMATE_CLIENT_AUTH"):
+ for key in ("DIGITALMATE_WORKSWARM_WS", "DIGITALMATE_CONFIG_FILE", "DIGITALMATE_HIVE_CONFIG"):
env.pop(key, None)
service = subprocess.Popen(
[sys.executable, "-m", "server_engine.engine_cli", "serve", "--workspace", str(state),
- "--host", "127.0.0.1", "--port", "18092"],
+ "--host", "127.0.0.1", "--port", "18092",
+ # The release serves only as Hive Home: Beebou takes the turn, Bees run what it dispatches.
+ "--hive-results", "--hive-turns", "--hive-bees", "--hive-beebou-id", "beebou"],
env=env, stdin=subprocess.DEVNULL, stdout=sys.stderr, stderr=sys.stderr,
start_new_session=True,
)
@@ -94,17 +97,18 @@ def interrupted(signum, _frame):
if time.monotonic() >= deadline:
raise RuntimeError("DigitalMate service did not become ready in 180 seconds")
time.sleep(0.5)
- return submit_task(prompt, Path.cwd(), token)
+ return submit_task(prompt, token)
finally:
stop(service)
- # Preserve WorkSwarm's separate log before deleting trial state.
- runtime_log = state / "workswarm/process.log"
- if runtime_log.is_file():
- from server_engine.engine_config import redact_credentials
- with runtime_log.open("rb") as handle:
- handle.seek(max(0, runtime_log.stat().st_size - 32768))
- tail = handle.read().decode("utf-8", errors="replace")
- print(redact_credentials(tail, env), file=sys.stderr)
+ # Preserve both WorkSwarm runtimes' logs before deleting trial state.
+ for name in ("workswarm", "bee-workswarm"):
+ runtime_log = state / name / "process.log"
+ if runtime_log.is_file():
+ from server_engine.engine_config import redact_credentials
+ with runtime_log.open("rb") as handle:
+ handle.seek(max(0, runtime_log.stat().st_size - 32768))
+ tail = handle.read().decode("utf-8", errors="replace")
+ print(redact_credentials(tail, env), file=sys.stderr)
for signum, handler in previous.items():
signal.signal(signum, handler)
diff --git a/app/tests/test_digitalmate_gateway.py b/app/tests/test_digitalmate_gateway.py
index fe34adf7..72da9ef6 100644
--- a/app/tests/test_digitalmate_gateway.py
+++ b/app/tests/test_digitalmate_gateway.py
@@ -1,4 +1,4 @@
-"""Exercise the adapter against native Gateway frames, without a model or service."""
+"""Exercise the adapter against Hive Home's Gateway frames, without a model or service."""
from collections import deque
import json
from pathlib import Path
@@ -27,155 +27,200 @@ def stub_websockets():
import gateway # noqa: E402
+def terminal(ref, *, state=None):
+ result = {"event": "digitalmate.task.text", "task_id": ref, "execution_id": "run-" + ref,
+ "event_id": "result-" + ref, "committed_message_id": "result-" + ref,
+ "version": 1, "final": True, "text": "Worker text, not the product's final answer"}
+ if state:
+ result.update(state=state, text="")
+ return result
+
+
+def report(ref, *, seq=2, children=(), text=" FINAL ANSWER: São Paulo\n"):
+ return {"event": "hive.beebou.reply", "event_id": "report-" + ref, "final": True,
+ "trigger": "bee_done", "task_ref": ref, "source_seq": seq, "outcome": "committed",
+ "task_refs": list(children), "text": text}
+
+
class Socket:
- """A service that advances a task across snapshots and interleaves events."""
- def __init__(self, statuses=("pending", "running", "completed"), *, answer=" FINAL ANSWER: São Paulo\n",
- nested=True, receipt_only=False, error=None):
- self.statuses = iter(statuses)
- self.answer = answer
- self.nested = nested
- self.receipt_only = receipt_only
- self.error = error
- self.frames = []
- self.inbox = deque()
- self.submission = ""
-
- def snapshot(self):
- task = {"id": "task-1", "room_id": "room-1", "submission_id": self.submission,
- "status": next(self.statuses), "result": self.answer}
- root = {"tasks": [
- dict(task, room_id="other-room", result="Wrong room"),
- dict(task, submission_id="other-submission", result="Wrong submission"),
- task,
- ]}
- return {"snapshot": root} if self.nested else root
-
- def send(self, message):
- frame = json.loads(message)
+ """A scripted product protocol peer, including pushes interleaved with RPCs."""
+ def __init__(self, *, tasks=(), status="committed", answer="FINAL ANSWER: 42", before=(), polls=None,
+ initial_error=None, waiting=(), receipt=True):
+ self.tasks, self.status, self.answer = list(tasks), status, answer
+ self.before, self.polls = list(before), polls or {}
+ self.initial_error, self.waiting = initial_error, set(waiting)
+ self.receipt = receipt
+ self.frames, self.inbox = [], deque()
+ self.now = 0.0
+
+ def send(self, text):
+ frame = json.loads(text)
self.frames.append(frame)
- params = frame["params"]
- action = params["action"]
- reply = {"id": frame["id"], "ok": True}
- if action == "room.create":
- reply["result"] = {"room_id": "room-1"}
- elif action == "room.message":
- self.submission = params["submission_id"]
- if self.error:
- reply.update(ok=False, error=self.error)
+ method, params = frame["method"], frame["params"]
+ response = {"id": frame["id"], "ok": True}
+ events = []
+ if method == "hive.message.send":
+ response["result"] = {"status": self.status, "message_id": params["message_id"],
+ "answer": self.answer, "task_refs": self.tasks}
+ if not self.receipt:
+ response["result"] = {}
+ if self.initial_error:
+ response.update(ok=False, error=self.initial_error)
+ events = self.before
+ for event in events:
+ if event.get("trigger") == "user":
+ event["source_message_id"] = params["message_id"]
+ elif method == "hive.result.get":
+ ref = params["task_ref"]
+ if ref in self.waiting:
+ response["result"] = {"status": "waiting_user", "task_ref": ref,
+ "interaction": {"interaction_id": "q", "questions": [{"question": "Sure?"}]}}
else:
- reply["result"] = {"task_id": "task-1"} if self.receipt_only else self.snapshot()
- elif action == "snapshot":
- reply["result"] = self.snapshot()
+ pending = self.polls.get(ref, deque())
+ events = pending.popleft() if pending else []
+ response["result"] = {"status": "available" if any(
+ e.get("event") == "digitalmate.task.text" for e in events) else "pending", "task_ref": ref}
+ elif method == "hive.bee.stop":
+ response["result"] = {"status": "stopped"}
else:
- raise AssertionError("Unexpected action: " + action)
- self.inbox.extend([
- json.dumps({"event": "digitalmate.stream", "final": True, "text": "Not the task result"}),
- json.dumps({"id": "unrelated-request", "ok": True, "result": {"text": "Wrong reply"}}),
- json.dumps(reply),
- ])
+ raise AssertionError("Unexpected method: " + method)
+ self.inbox.extend(json.dumps(e) for e in events)
+ self.inbox.append(json.dumps({"event": "digitalmate.stream", "final": True, "text": "Ignore stream"}))
+ self.inbox.append(json.dumps(response))
def recv(self, *, timeout):
assert timeout > 0
- return self.inbox.popleft()
+ if self.inbox:
+ return self.inbox.popleft()
+ self.now += timeout
+ raise TimeoutError()
class GatewayTests(unittest.TestCase):
prompt = ' Read the file.\nReturn {"answer": "its content"}.\n'
- workspace = Path("/trial/workspace with spaces")
- def submit(self, socket):
+ def submit(self, socket, timeout=3):
connection = MagicMock()
connection.__enter__.return_value = socket
with patch.object(gateway, "connect", return_value=connection) as connect, \
- patch.object(gateway.time, "sleep"):
- answer = gateway.submit_task(self.prompt, self.workspace, "local-test-token")
+ patch.object(gateway.time, "monotonic", side_effect=lambda: socket.now):
+ answer = gateway.submit_task(self.prompt, "local-test-token", timeout=timeout)
self.assertEqual(connect.call_args.args, ("ws://127.0.0.1:18092/digitalmate/ws",))
self.assertEqual(connect.call_args.kwargs["additional_headers"],
{"Authorization": "Bearer local-test-token"})
connection.__exit__.assert_called_once()
return answer
- def test_native_protocol_preserves_prompt_workspace_and_final_result(self):
- for nested in (True, False):
- with self.subTest(nested=nested):
- socket = Socket(nested=nested)
- self.assertEqual(self.submit(socket), socket.answer)
- params = [f["params"] for f in socket.frames]
- self.assertEqual([p["action"] for p in params],
- ["room.create", "room.message", "snapshot", "snapshot"])
- self.assertEqual(params[1]["text"], self.prompt)
- self.assertEqual(params[1]["project_path"], str(self.workspace))
- self.assertEqual(params[1]["client"], {"language": "en", "device": "mobile"})
- self.assertTrue(all(f["method"] == "digitalmate.request" for f in socket.frames))
- self.assertEqual(len({f["id"] for f in socket.frames}), len(socket.frames))
-
- def test_receipt_only_submission_is_resolved_from_snapshot(self):
- socket = Socket(statuses=("completed",), receipt_only=True)
- self.assertEqual(self.submit(socket), socket.answer)
- self.assertEqual(len(socket.frames), 3)
-
- def test_immediate_completion_needs_no_polling(self):
- socket = Socket(statuses=("completed",))
+ def test_nondelegated_turn_preserves_prompt_and_product_answer(self):
+ socket = Socket()
self.assertEqual(self.submit(socket), socket.answer)
- self.assertEqual(len(socket.frames), 2)
+ self.assertEqual(len(socket.frames), 1)
+ frame = socket.frames[0]
+ self.assertEqual(frame["method"], "hive.message.send")
+ self.assertEqual(frame["params"]["text"], self.prompt)
+ self.assertEqual(set(frame["params"]), {"message_id", "text"})
+
+ def test_all_delegated_tasks_and_beebou_reports_are_required(self):
+ socket = Socket(tasks=("a", "b"), answer="I dispatched your task.", polls={
+ "a": deque([[terminal("a"), report("a", text="First part")]]),
+ "b": deque([[], [terminal("b"), report("b", seq=3)]]),
+ })
+ self.assertEqual(self.submit(socket), " FINAL ANSWER: São Paulo\n")
+ polls = [f["params"]["task_ref"] for f in socket.frames if f["method"] == "hive.result.get"]
+ self.assertEqual(polls, ["a", "b", "b"])
+
+ def test_pushes_before_ack_and_out_of_order_child_completion_are_retained(self):
+ socket = Socket(tasks=("parent",), answer="Acknowledgement", before=[
+ terminal("unrelated"), report("unrelated", seq=100, text="Wrong task"),
+ terminal("child"), report("child", seq=3),
+ terminal("parent"), report("parent", children=("child",), text="Follow-up dispatched"),
+ ])
+ self.assertEqual(self.submit(socket), " FINAL ANSWER: São Paulo\n")
+ self.assertEqual(len(socket.frames), 1)
- def test_noncompleted_task_never_returns_plausible_partial_text(self):
- for status in ("failed", "waiting", "cancelled", "stale", "blocked", None):
- with self.subTest(status=status), self.assertRaisesRegex(RuntimeError, "did not complete"):
- self.submit(Socket(statuses=(status,)))
+ def test_pending_initial_turn_waits_for_its_committed_reply(self):
+ initial = report("unused", seq=1, text="FINAL ANSWER: delayed")
+ initial.update(trigger="user", task_ref=None)
+ socket = Socket(status="pending", answer=None, before=[initial])
+ self.assertEqual(self.submit(socket), "FINAL ANSWER: delayed")
- def test_completed_task_requires_a_nonempty_text_result(self):
+ def test_raw_worker_result_without_beebou_report_is_not_final(self):
+ socket = Socket(tasks=("a",), polls={"a": deque([[terminal("a")]])})
+ with self.assertRaisesRegex(TimeoutError, "deadline exceeded"):
+ self.submit(socket)
+ self.assertEqual(sum(f["method"] == "hive.message.send" for f in socket.frames), 1)
+
+ def test_failure_stopped_and_unavailable_do_not_return_partial_text(self):
+ for state in ("failed", "stopped", "unavailable"):
+ with self.subTest(state=state):
+ socket = Socket(tasks=("a",), polls={"a": deque([[terminal("a", state=state)]])})
+ with self.assertRaisesRegex(RuntimeError, "Bee task ended: " + state):
+ self.submit(socket)
+
+ def test_a_bee_question_fails_the_task_and_requests_stop_once(self):
+ socket = Socket(tasks=("a",), waiting=("a",))
+ with self.assertRaisesRegex(RuntimeError, "requires user input"):
+ self.submit(socket)
+ stops = [f for f in socket.frames if f["method"] == "hive.bee.stop"]
+ self.assertEqual(len(stops), 1)
+ self.assertEqual(stops[0]["params"]["task_ref"], "a")
+ self.assertTrue(stops[0]["params"]["operation_id"])
+
+ def test_failed_beebou_report_is_not_a_final_answer(self):
+ failed = report("a")
+ failed.update(outcome="failed", text="Failure notice")
+ with self.assertRaisesRegex(RuntimeError, "reply did not commit"):
+ self.submit(Socket(tasks=("a",), before=[terminal("a"), failed]))
+
+ def test_empty_or_malformed_answer_is_rejected(self):
for answer in (None, "", " \n", 42, ["42"]):
with self.subTest(answer=answer), self.assertRaisesRegex(RuntimeError, "without a final answer"):
- self.submit(Socket(statuses=("completed",), answer=answer))
+ self.submit(Socket(answer=answer))
- def test_rejected_submission_is_not_retried(self):
- socket = Socket(error={"code": "BAD_PARAMS", "message": "private details"})
- with self.assertRaisesRegex(RuntimeError, "request rejected: BAD_PARAMS") as raised:
+ def test_a_reply_without_its_submission_receipt_is_refused(self):
+ with self.assertRaisesRegex(RuntimeError, "different submission receipt"):
+ self.submit(Socket(receipt=False))
+
+ def test_rejected_submission_is_not_retried_and_does_not_expose_details(self):
+ socket = Socket(initial_error={"code": "BAD_PARAMS", "message": "private details"})
+ with self.assertRaisesRegex(RuntimeError, "request rejected: BAD_PARAMS") as error:
+ self.submit(socket)
+ self.assertNotIn("private details", str(error.exception))
+ self.assertEqual(len(socket.frames), 1)
+
+ def test_deadline_does_not_resubmit_and_cleans_up_known_tasks(self):
+ socket = Socket(tasks=("a",))
+ with self.assertRaisesRegex(TimeoutError, "deadline exceeded"):
self.submit(socket)
- self.assertNotIn("private details", str(raised.exception))
- self.assertEqual(len(socket.frames), 2)
+ self.assertEqual(socket.now, 3)
+ self.assertEqual(socket.frames[-1]["method"], "hive.bee.stop")
+ self.assertEqual(sum(f["method"] == "hive.message.send" for f in socket.frames), 1)
- def test_expired_deadline_prevents_further_requests(self):
+ def test_expired_deadline_prevents_a_request(self):
socket = MagicMock()
with self.assertRaises(TimeoutError):
- gateway.Gateway(socket, gateway.time.monotonic() - 1).request(action="snapshot")
+ gateway.Gateway(socket, gateway.time.monotonic() - 1).rpc("hive.result.get", task_ref="a")
socket.send.assert_not_called()
- def test_receive_timeout_fails_without_resubmitting(self):
- socket = Socket()
- with patch.object(socket, "recv", side_effect=TimeoutError), self.assertRaises(TimeoutError):
- self.submit(socket)
- self.assertEqual(len(socket.frames), 1)
-
- def test_running_snapshots_cannot_extend_the_overall_deadline(self):
- socket = Socket(statuses=("running", "running", "running"))
- connection = MagicMock()
- connection.__enter__.return_value = socket
- clock = [0.0]
- def sleep(seconds):
- clock[0] += seconds
- with patch.object(gateway, "connect", return_value=connection), \
- patch.object(gateway.time, "monotonic", side_effect=lambda: clock[0]), \
- patch.object(gateway.time, "sleep", side_effect=sleep):
- with self.assertRaisesRegex(TimeoutError, "deadline exceeded"):
- gateway.submit_task(self.prompt, self.workspace, "local-test-token", timeout=2)
- self.assertEqual(clock[0], 2)
- self.assertEqual([f["params"]["action"] for f in socket.frames],
- ["room.create", "room.message", "snapshot"])
- connection.__exit__.assert_called_once()
-
def test_connection_failure_is_reported_without_credentials(self):
with patch.object(gateway, "connect", side_effect=gateway.WebSocketException("private header")):
- with self.assertRaisesRegex(RuntimeError, "Gateway connection failed") as raised:
- gateway.submit_task(self.prompt, self.workspace, "local-test-token")
- self.assertNotIn("private header", str(raised.exception))
+ with self.assertRaisesRegex(RuntimeError, "Gateway connection failed") as error:
+ gateway.submit_task(self.prompt, "local-test-token")
+ self.assertNotIn("private header", str(error.exception))
+
+ def test_a_dropped_connection_names_its_close_code_only(self):
+ dropped = gateway.WebSocketException("private reason")
+ dropped.rcvd = MagicMock(code=1011, reason="private reason")
+ with patch.object(gateway, "connect", side_effect=dropped):
+ with self.assertRaisesRegex(RuntimeError, "connection failed: WebSocketException 1011$") as error:
+ gateway.submit_task(self.prompt, "local-test-token")
+ self.assertNotIn("private", str(error.exception))
def test_malformed_matching_response_is_rejected(self):
socket = MagicMock()
- socket.recv.return_value = json.dumps({"id": "nullius-1", "ok": True, "result": "not a snapshot"})
+ socket.recv.return_value = json.dumps({"id": "nullius-1", "ok": True, "result": "not a result"})
with self.assertRaisesRegex(RuntimeError, "invalid response"):
- gateway.Gateway(socket, gateway.time.monotonic() + 10).request(action="snapshot")
+ gateway.Gateway(socket, gateway.time.monotonic() + 10).rpc("hive.result.get", task_ref="a")
if __name__ == "__main__":
diff --git a/app/tests/test_digitalmate_run.py b/app/tests/test_digitalmate_run.py
index 6ce38e63..3d69a66c 100644
--- a/app/tests/test_digitalmate_run.py
+++ b/app/tests/test_digitalmate_run.py
@@ -6,6 +6,7 @@
import importlib.util
from pathlib import Path
+import json
import signal
import subprocess
import sys
@@ -90,8 +91,15 @@ def test_client_failure_still_stops_owned_service(self):
adapter.run(self.install, "Keep this prompt unchanged.")
stop.assert_called_once_with(service)
self.assertTrue(launch.call_args.kwargs["start_new_session"])
- self.assertEqual(submit.call_args.args[:2], ("Keep this prompt unchanged.", Path.cwd()))
- self.assertEqual(submit.call_args.args[2], launch.call_args.kwargs["env"]["DIGITALMATE_ACCESS_TOKEN"])
+ env = launch.call_args.kwargs["env"]
+ self.assertEqual(submit.call_args.args, ("Keep this prompt unchanged.", env["DIGITALMATE_ACCESS_TOKEN"]))
+ # The release serves only as Hive Home, under direct instance authentication.
+ self.assertEqual(env["DIGITALMATE_CLIENT_AUTH"], "instance")
+ self.assertEqual(json.loads(env["DIGITALMATE_WORKSWARM_COMMAND"])[1:], ["-m", "server_engine.workswarm_launcher"])
+ argv = launch.call_args.args[0]
+ for flag in ("--hive-results", "--hive-turns", "--hive-bees"):
+ self.assertIn(flag, argv)
+ self.assertEqual(argv[argv.index("--hive-beebou-id") + 1], "beebou")
def test_local_backend_is_refused(self):
with patch.object(adapter.Path, "exists", return_value=False):
diff --git a/app/ui_tests/test_agents.py b/app/ui_tests/test_agents.py
index 253c1647..a5a83f36 100644
--- a/app/ui_tests/test_agents.py
+++ b/app/ui_tests/test_agents.py
@@ -75,16 +75,16 @@ def test_capability_source_retains_pin_and_install_details(self):
self.assertNotIn('is a promise a benchmark relies on', html)
self.assertNotIn("once, in the standard's home", html)
- def test_digitalmate_is_in_the_normal_catalogue_with_its_proven_task_port(self):
+ def test_digitalmate_is_in_the_normal_catalogue_with_its_proven_ports(self):
with patch.object(definitions, "load", _LOAD):
listing = self.get("/agents").get_data(as_text=True)
detail = self.get("/agents/digitalmate").get_data(as_text=True)
self.assertIn('/agents/digitalmate', listing)
self.assertIn('DigitalMate', detail)
- self.assertIn('709f4d39d613c', detail)
+ self.assertIn('7dbfc6729963e', detail)
agent = _GET("agent", "digitalmate")
- self.assertEqual(agent["upstream"]["tag"], "v0.1.12")
- self.assertEqual(agent["offers"], ["agent.task/v1"])
+ self.assertEqual(agent["upstream"]["tag"], "v0.1.13")
+ self.assertEqual(agent["offers"], ["agent.task/v1", "agent.search/v1"])
proof = agent["proven"]["agent.task/v1"]
self.assertEqual(proof["passed"], "3/3")
self.assertEqual(proof["version"], agent["upstream"]["version"])
diff --git a/docs/agents/supported/README.md b/docs/agents/supported/README.md
index d3d37997..7ee197b3 100644
--- a/docs/agents/supported/README.md
+++ b/docs/agents/supported/README.md
@@ -9,7 +9,7 @@ Every agent in the catalogue, the ports each version has proven, and the benchma
| Agent | Versions (bare key: the default) | What it is | Driven over | From | Licence |
|---|---|---|---|---|---|
| [Codex](codex.md) | `codex@2.2.2`, `codex@0.16.0` | OpenAI's coding agent. | ACP via `codex-acp` | npm | Apache-2.0 |
-| [DigitalMate](digitalmate.md) | `digitalmate` | DigitalMate's Personal Agent service with its owned WorkSwarm runtime. | a command | repository | Apache-2.0 |
+| [DigitalMate](digitalmate.md) | `digitalmate` | DigitalMate's Personal Agent service, run as Hive Home with its owned WorkSwarm runtimes. | a command | repository | Apache-2.0 |
| [Goose](goose.md) | `goose` | The AAIF's open-source agent, formerly Block's. | ACP | npm | Apache-2.0 |
| [JiuwenSwarm](jiuwenswarm.md) | `jiuwenswarm@0.2.7`, `jiuwenswarm@0.2.8` | openJiuwen's agent. | ACP | PyPI | Apache-2.0 |
| [mini-swe-agent](mini-swe-agent.md) | `mini-swe-agent` | Princeton's 100-line agent, bash only. | a command | PyPI | MIT |
@@ -37,7 +37,7 @@ Every agent in the catalogue, the ports each version has proven, and the benchma
codex@2.2.2 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
codex@0.16.0 | ✓ | ✓ | ✓ | ✓ | ✓ | – | ✓ | ✓ | ✓ |
-digitalmate | ✓ | – | – | – | – | – | – | – | – |
+digitalmate | ✓ | – | – | – | ✓ | – | – | – | – |
goose | ✓ | ✓ | ✓ | ✓ | ✓ | – | ✓ | ✓ | ✓ |
jiuwenswarm@0.2.7 | ✓ | ✓ | ✓ | ✓ | – | – | ✓ | ✓ | ✓ |
jiuwenswarm@0.2.8 | ✓ | ✓ | ✓ | ✓ | ✓ | – | ✓ | ✓ | ✓ |
@@ -57,7 +57,7 @@ Every agent in the catalogue, the ports each version has proven, and the benchma
codex@2.2.2 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
codex@0.16.0 | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ | ✓ | ✓ | ✓ |
-digitalmate | ✗ | ✓ | ✗ | ✓ | ✗ | ✗ | ✗ | ✗ | ✗ |
+digitalmate | ✗ | ✓ | ✗ | ✓ | ✗ | ✗ | ✗ | ✗ | ✗ |
goose | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ | ✓ | ✓ | ✓ |
jiuwenswarm@0.2.7 | ✗ | ✓ | ✓ | ✓ | ✗ | ✗ | ✓ | ✓ | ✓ |
jiuwenswarm@0.2.8 | ✓ | ✓ | ✓ | ✓ | ✗ | ✗ | ✓ | ✓ | ✓ |
diff --git a/docs/agents/supported/digitalmate.md b/docs/agents/supported/digitalmate.md
index 5045c4d7..ab2cf020 100644
--- a/docs/agents/supported/digitalmate.md
+++ b/docs/agents/supported/digitalmate.md
@@ -2,14 +2,14 @@
# DigitalMate
-DigitalMate's Personal Agent service with its owned WorkSwarm runtime.
+DigitalMate's Personal Agent service, run as Hive Home with its owned WorkSwarm runtimes.
| Key | digitalmate |
| Driven over | a command |
| From | repository |
-| Installed | github.com/openJiuwen-ai/DigitalMate at 709f4d39d613; websockets==15.0.1 |
+| Installed | github.com/openJiuwen-ai/DigitalMate at 7dbfc6729963; websockets==15.0.1 |
| Licence | Apache-2.0 |
| Core | Bundled WorkSwarm 0d6857507236d1299276caf0f6fe09e5baaa4c23 and agent-core 8f9f112698d5580b749158b21b1a89a54e16a8f9, verified and installed by the release installer |
@@ -19,7 +19,7 @@ DigitalMate's Personal Agent service with its owned WorkSwarm runtime.
| Version | Upstream | Ports | Tools |
|---|
| One task | Workspace files | MCP tools | Conversation | Search | Computer use | decoys | chain | retry |
-digitalmate | 0.1.12 | ✓ | – | – | – | – | – | – | – | – |
+digitalmate | 0.1.13 | ✓ | – | – | – | ✓ | – | – | – | – |
## Options
@@ -31,7 +31,7 @@ None declared.
- ✗: the missing port, on hover.