The core no longer draws the committed / pushed / merged / deployed /
notified / completed row in a conversation's Details: the `lifecycle`
plugin's `conv-checks` slot does, reading it through a new hub bridge.
- `GET /proxy/tools/plugins/{pid}/hub/conversations/{cid}/checks` behind the
new `conversations.checks` capability (plugins/hubchecks.py): the stamps
as the conversation's card has them (cards._conv_meta — the sidecar's,
else lifecycleAuto) and its resolved state (a subagent's own), by
conversation or session id; the owner any, a guest theirs and those
shared with them, 404 otherwise. Not an operator capability.
- DETAIL_CARD_RENAMES: `checks` → `plugin:lifecycle:conv-checks`, so a saved
arrangement keeps its slot. LifecycleChecks is gone; StatusChecks stays
for the list cards and the project / service pages.
- docs/plugins.md (capability table, bridges, the retired-widgets table),
CLAUDE.md, the unused French string.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
99 lines
3.6 KiB
Python
99 lines
3.6 KiB
Python
"""``conversations.checks`` — one conversation's lifecycle checks (since
|
|
2026-11-27, when the Details drawer's *Lifecycle checks* card left the core
|
|
for the ``lifecycle`` plugin).
|
|
|
|
``GET …/plugins/{pid}/hub/conversations/{cid}/checks`` →
|
|
``{sessionId, conversationId, state, committed, pushed, merged, deployed,
|
|
notified}``: the stamps as the conversation's card has them
|
|
(``cards._conv_meta`` — what the skills stamped in the sidecar, else what the
|
|
transcript shows: ``lifecycleAuto``) and the state it resolves to (a
|
|
subagent's own, as the conversation page has it). A stamp is an ISO time, or
|
|
null while it hasn't happened; ``state`` is ``finished`` once the run got to
|
|
the end — the row's *Completed*.
|
|
|
|
``cid`` is a conversation id (what ``/conversation/<id>`` takes) or a session
|
|
id (its newest transcript). The caller's own conversations only: the owner
|
|
any, a guest those they started or that are shared with them — 404 for the
|
|
rest, so a guest can't probe which exist. Read-only, no operator approval.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pathlib
|
|
import re
|
|
|
|
from fastapi import APIRouter, Request
|
|
from starlette.concurrency import run_in_threadpool
|
|
|
|
from plugins.proxyroutes import _active_plugin, _error, _who
|
|
|
|
router = APIRouter(include_in_schema=False)
|
|
|
|
CAP = "conversations.checks"
|
|
STAMPS = ("committed", "pushed", "merged", "deployed", "notified")
|
|
_ID_RE = re.compile(r"^[A-Za-z0-9-]{8,64}$")
|
|
|
|
|
|
def locate(deps, raw: str) -> tuple[str, str, dict] | None:
|
|
"""(conversation id, transcript path, summary) of what ``raw`` names — a
|
|
conversation id, else a session id's newest transcript; None when the hub
|
|
hasn't indexed it."""
|
|
if not _ID_RE.match(raw or ""):
|
|
return None
|
|
from conversations import ids
|
|
from conversations.catalog import _conv_ids_by_session
|
|
|
|
def at(cid: str | None):
|
|
path = ids.path_of(cid) if cid else None
|
|
s = deps.store.get_summary(path) if path else None
|
|
return (cid, path, s) if s and s.get("sessionId") else None
|
|
|
|
return at(raw) or at(_conv_ids_by_session(deps).get(raw))
|
|
|
|
|
|
def visible_to(who, meta: dict) -> bool:
|
|
"""The owner sees every conversation; a guest theirs and those shared with
|
|
them (``users/access.meta_visible``)."""
|
|
if who.is_owner:
|
|
return True
|
|
return meta.get("owner") == who.uid or who.uid in (meta.get("participants") or ())
|
|
|
|
|
|
def checks(deps, cid: str, path: str, summary: dict) -> dict:
|
|
from conversations.cards import _conv_meta
|
|
from conversations.tree import _sidechain_state
|
|
m = _conv_meta(deps, summary, slim=True)
|
|
return {
|
|
"sessionId": summary["sessionId"],
|
|
"conversationId": cid,
|
|
"state": _sidechain_state(deps, pathlib.Path(path)) or m.get("state"),
|
|
**{k: m.get(k) or None for k in STAMPS},
|
|
}
|
|
|
|
|
|
@router.get("/proxy/tools/plugins/{pid}/hub/conversations/{cid}/checks")
|
|
async def plugin_hub_conv_checks(pid: str, cid: str, request: Request):
|
|
who, err = _who(request, pid)
|
|
if err:
|
|
return err
|
|
deps = request.app.state.ai
|
|
_, rec, _, _, err = _active_plugin(deps, who, pid)
|
|
if err:
|
|
return err
|
|
if CAP not in (rec["manifest"].get("capabilities") or []):
|
|
return _error(403, f"plugin lacks {CAP} capability", "capability")
|
|
|
|
def _read():
|
|
hit = locate(deps, cid)
|
|
if hit is None:
|
|
return None
|
|
real, path, s = hit
|
|
if not visible_to(who, deps.meta_store.peek(s["sessionId"]) or {}):
|
|
return None
|
|
return checks(deps, real, path, s)
|
|
|
|
out = await run_in_threadpool(_read)
|
|
if out is None:
|
|
return _error(404, "conversation not found", "not_found")
|
|
return out
|