- INTENT.md: three-layer model (blueprint/instance/harness), single shared runtime, never-become boundaries - ADR-001 (accepted): DEC-2026-002 resolution — one harness repo for all projects; instances are declarative state in consuming repos - docs/architecture.md: components, contracts (manifest, tool profiles, completion events, credential lanes), deployment shape - agent_harness/: executor-worker prototype adopted and renamed (6/6 tests green); HARNESS-WP-0001 initial workplan (7 tasks) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
54 lines
1.2 KiB
Python
54 lines
1.2 KiB
Python
"""Custodian State Hub reporting (REST, no MCP).
|
|
|
|
STATE_HUB_URL defaults to the workstation-local hub; on Railiance the
|
|
ops-bridge tunnel exposes it at http://127.0.0.1:18000.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
from typing import Any
|
|
|
|
import httpx
|
|
|
|
_DEFAULT_URL = "http://127.0.0.1:8000"
|
|
_TIMEOUT = 10.0
|
|
|
|
|
|
def _base_url() -> str:
|
|
return os.environ.get("STATE_HUB_URL", _DEFAULT_URL).rstrip("/")
|
|
|
|
|
|
def post_progress_event(
|
|
summary: str,
|
|
event_type: str,
|
|
detail: dict[str, Any],
|
|
task_id: str | None = None,
|
|
) -> bool:
|
|
payload: dict[str, Any] = {
|
|
"summary": summary,
|
|
"event_type": event_type,
|
|
"detail": detail,
|
|
"author": "agt-executor-worker",
|
|
}
|
|
if task_id:
|
|
payload["task_id"] = task_id
|
|
try:
|
|
resp = httpx.post(f"{_base_url()}/progress/", json=payload, timeout=_TIMEOUT)
|
|
resp.raise_for_status()
|
|
return True
|
|
except httpx.HTTPError:
|
|
return False
|
|
|
|
|
|
def close_task(task_id: str) -> bool:
|
|
try:
|
|
resp = httpx.patch(
|
|
f"{_base_url()}/tasks/{task_id}",
|
|
json={"status": "done"},
|
|
timeout=_TIMEOUT,
|
|
)
|
|
resp.raise_for_status()
|
|
return True
|
|
except httpx.HTTPError:
|
|
return False
|