Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions backend/templates/BOARD_TOOLS.md.j2
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
{% set is_main = (is_main_agent | default(false) | string | lower) in ["true", "1", "yes"] %}
{% set is_lead = (is_board_lead | default(false) | string | lower) in ["true", "1", "yes"] %}
# TOOLS.md

- `BASE_URL={{ base_url }}`
- `AUTH_TOKEN={{ auth_token }}`
- `AGENT_NAME={{ agent_name }}`
- `AGENT_ID={{ agent_id }}`
{% if board_id is defined %}
- `BOARD_ID={{ board_id }}`
{% endif %}
- `WORKSPACE_ROOT={{ workspace_root }}`
{% if workspace_path is defined %}
- `WORKSPACE_PATH={{ workspace_path }}`
{% endif %}
- Required tools: `curl`, `jq`

{% if is_main %}
{% set role_tag = "agent-main" %}
{% elif is_lead %}
{% set role_tag = "agent-lead" %}
{% else %}
{% set role_tag = "agent-worker" %}
{% endif %}
# TOOLS.md

## Agent Identity (Mission Control)

BASE_URL={{ base_url }}
AUTH_TOKEN={{ auth_token }}
AGENT_NAME={{ agent_name }}
AGENT_ID={{ agent_id }}
{% if board_id is defined %}
BOARD_ID={{ board_id }}
{% endif %}
WORKSPACE_ROOT={{ workspace_root }}
{% if workspace_path is defined %}
WORKSPACE_PATH={{ workspace_path }}
{% endif %}

## Notes

- Required tools: `curl`, `jq`

## OpenAPI refresh (run before API-heavy work)

Expand Down
30 changes: 30 additions & 0 deletions backend/tests/test_board_tools_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from __future__ import annotations

from jinja2 import Environment, FileSystemLoader, StrictUndefined, select_autoescape

from app.services.openclaw.provisioning_db import _parse_tools_md


def test_board_tools_template_parses_identity_fields() -> None:
env = Environment(
loader=FileSystemLoader("backend/templates"),
autoescape=select_autoescape(),
undefined=StrictUndefined,
)
template = env.get_template("BOARD_TOOLS.md.j2")
rendered = template.render(
base_url="https://mission-control.example",
auth_token="secret-token",
agent_name="Thoth",
agent_id="agent-123",
board_id="board-456",
workspace_root="/tmp/openclaw",
workspace_path="/tmp/openclaw/workspace-thoth",
is_main_agent=False,
is_board_lead=True,
)

parsed = _parse_tools_md(rendered)
assert parsed["AUTH_TOKEN"] == "secret-token"
assert parsed["BASE_URL"] == "https://mission-control.example"
assert parsed["AGENT_ID"] == "agent-123"
Loading