feat(capability-requests): add cross-domain capability catalog and request routing
Introduces a capability catalog (CUST-WP-0022) so domains can advertise what
they provide and agents can request capabilities from other domains with
auto-routing, lifecycle tracking, and task-unblocking on completion.
- New models: CapabilityCatalog, CapabilityRequest with full lifecycle
(requested → accepted → in_progress → ready_for_review → completed/rejected/withdrawn)
- Migration i6d7e8f9a0b1: capability_catalog + capability_requests tables
- Router /capability-catalog and /capability-requests with accept/status endpoints
- 7 new MCP tools: register_capability, list_capabilities, request_capability,
accept_capability_request, update_capability_request_status,
list_capability_requests, get_capability_request
- StateSummary gains open_capability_requests count
- Dashboard: capability-requests.md page + docs/capabilities.md + docs/scope.md
- SCOPE.md: three seed capabilities documented (MCP registration, state tracking, SBOM)
- scope.template: Provided Capabilities section with example block
- scripts/ingest_capabilities.py + make ingest-capabilities[/-all] targets
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 21:07:50 +01:00
|
|
|
import uuid
|
|
|
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
# Capability Catalog schemas
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class CatalogCreate(BaseModel):
|
|
|
|
|
domain: str # slug, resolved to domain_id in router
|
|
|
|
|
capability_type: str
|
|
|
|
|
title: str
|
|
|
|
|
description: str | None = None
|
|
|
|
|
keywords: list[str] = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CatalogRead(BaseModel):
|
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
|
|
|
|
id: uuid.UUID
|
|
|
|
|
domain_slug: str
|
|
|
|
|
capability_type: str
|
|
|
|
|
title: str
|
|
|
|
|
description: str | None = None
|
|
|
|
|
keywords: list[str] = []
|
|
|
|
|
status: str
|
|
|
|
|
created_at: datetime
|
|
|
|
|
updated_at: datetime
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
# Capability Request schemas
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class CapabilityRequestCreate(BaseModel):
|
|
|
|
|
title: str
|
|
|
|
|
description: str | None = None
|
|
|
|
|
capability_type: str
|
|
|
|
|
priority: str = "medium"
|
|
|
|
|
requesting_domain: str # slug, resolved to domain_id in router
|
|
|
|
|
requesting_agent: str
|
|
|
|
|
requesting_workstream_id: uuid.UUID | None = None
|
|
|
|
|
blocking_task_id: uuid.UUID | None = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CapabilityRequestAccept(BaseModel):
|
|
|
|
|
fulfilling_agent: str
|
|
|
|
|
fulfilling_workstream_id: uuid.UUID | None = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CapabilityRequestStatusPatch(BaseModel):
|
|
|
|
|
status: str # in_progress | ready_for_review | completed | rejected | withdrawn
|
|
|
|
|
note: str | None = None
|
|
|
|
|
|
|
|
|
|
|
feat(capability-requests): add routing_note, PATCH endpoint, word-boundary fix, and ops-bridge tunnel targets
- Add `routing_note` column (migration l9g0h1i2j3k4) to persist why a request was routed to a given domain
- Fix substring-match bug in `_route_capability`: use `\b` word-boundary regex so 'postgres' no longer matches inside 'postgresql'
- Include `title` in keyword scoring for better routing accuracy
- Return `routing_note` string from `_route_capability` and store it on the request
- Add `PATCH /capability-requests/{id}` endpoint + `CapabilityRequestPatch` schema to correct mutable metadata (catalog_entry_id, priority, blocking_task_id, fulfilling_workstream_id)
- Add `patch_capability_request` MCP tool wrapping the new endpoint
- Add 105 lines of routing tests (word-boundary, title-match, multi-entry scoring, broadcast fallback)
- Add `tunnels-up`, `tunnels-status`, `tunnels-check` Makefile targets for ops-bridge managed tunnels
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 03:47:54 +01:00
|
|
|
class CapabilityRequestPatch(BaseModel):
|
|
|
|
|
catalog_entry_id: uuid.UUID | None = None
|
|
|
|
|
priority: str | None = None
|
|
|
|
|
blocking_task_id: uuid.UUID | None = None
|
|
|
|
|
fulfilling_workstream_id: uuid.UUID | None = None
|
|
|
|
|
|
|
|
|
|
|
2026-03-21 23:58:52 +01:00
|
|
|
class CapabilityRequestDispute(BaseModel):
|
|
|
|
|
reason: str
|
|
|
|
|
disputed_by: str
|
|
|
|
|
suggested_domain: str | None = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CapabilityRequestReroute(BaseModel):
|
|
|
|
|
note: str
|
|
|
|
|
rerouted_by: str
|
|
|
|
|
domain: str | None = None # slug — used if catalog_entry_id not given
|
|
|
|
|
catalog_entry_id: uuid.UUID | None = None # preferred: re-derives domain
|
|
|
|
|
|
|
|
|
|
|
feat(capability-requests): add cross-domain capability catalog and request routing
Introduces a capability catalog (CUST-WP-0022) so domains can advertise what
they provide and agents can request capabilities from other domains with
auto-routing, lifecycle tracking, and task-unblocking on completion.
- New models: CapabilityCatalog, CapabilityRequest with full lifecycle
(requested → accepted → in_progress → ready_for_review → completed/rejected/withdrawn)
- Migration i6d7e8f9a0b1: capability_catalog + capability_requests tables
- Router /capability-catalog and /capability-requests with accept/status endpoints
- 7 new MCP tools: register_capability, list_capabilities, request_capability,
accept_capability_request, update_capability_request_status,
list_capability_requests, get_capability_request
- StateSummary gains open_capability_requests count
- Dashboard: capability-requests.md page + docs/capabilities.md + docs/scope.md
- SCOPE.md: three seed capabilities documented (MCP registration, state tracking, SBOM)
- scope.template: Provided Capabilities section with example block
- scripts/ingest_capabilities.py + make ingest-capabilities[/-all] targets
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 21:07:50 +01:00
|
|
|
class CapabilityRequestRead(BaseModel):
|
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
|
|
|
|
|
id: uuid.UUID
|
|
|
|
|
title: str
|
|
|
|
|
description: str | None = None
|
|
|
|
|
capability_type: str
|
|
|
|
|
priority: str
|
|
|
|
|
status: str
|
|
|
|
|
requesting_domain_slug: str
|
|
|
|
|
requesting_agent: str
|
|
|
|
|
requesting_workstream_id: uuid.UUID | None = None
|
|
|
|
|
fulfilling_domain_slug: str | None = None
|
|
|
|
|
fulfilling_agent: str | None = None
|
|
|
|
|
fulfilling_workstream_id: uuid.UUID | None = None
|
|
|
|
|
blocking_task_id: uuid.UUID | None = None
|
|
|
|
|
catalog_entry_id: uuid.UUID | None = None
|
|
|
|
|
resolution_note: str | None = None
|
feat(capability-requests): add routing_note, PATCH endpoint, word-boundary fix, and ops-bridge tunnel targets
- Add `routing_note` column (migration l9g0h1i2j3k4) to persist why a request was routed to a given domain
- Fix substring-match bug in `_route_capability`: use `\b` word-boundary regex so 'postgres' no longer matches inside 'postgresql'
- Include `title` in keyword scoring for better routing accuracy
- Return `routing_note` string from `_route_capability` and store it on the request
- Add `PATCH /capability-requests/{id}` endpoint + `CapabilityRequestPatch` schema to correct mutable metadata (catalog_entry_id, priority, blocking_task_id, fulfilling_workstream_id)
- Add `patch_capability_request` MCP tool wrapping the new endpoint
- Add 105 lines of routing tests (word-boundary, title-match, multi-entry scoring, broadcast fallback)
- Add `tunnels-up`, `tunnels-status`, `tunnels-check` Makefile targets for ops-bridge managed tunnels
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 03:47:54 +01:00
|
|
|
routing_note: str | None = None
|
2026-03-21 23:58:52 +01:00
|
|
|
dispute_reason: str | None = None
|
|
|
|
|
disputed_by: str | None = None
|
|
|
|
|
dispute_suggested_domain: str | None = None
|
|
|
|
|
disputed_at: datetime | None = None
|
feat(capability-requests): add cross-domain capability catalog and request routing
Introduces a capability catalog (CUST-WP-0022) so domains can advertise what
they provide and agents can request capabilities from other domains with
auto-routing, lifecycle tracking, and task-unblocking on completion.
- New models: CapabilityCatalog, CapabilityRequest with full lifecycle
(requested → accepted → in_progress → ready_for_review → completed/rejected/withdrawn)
- Migration i6d7e8f9a0b1: capability_catalog + capability_requests tables
- Router /capability-catalog and /capability-requests with accept/status endpoints
- 7 new MCP tools: register_capability, list_capabilities, request_capability,
accept_capability_request, update_capability_request_status,
list_capability_requests, get_capability_request
- StateSummary gains open_capability_requests count
- Dashboard: capability-requests.md page + docs/capabilities.md + docs/scope.md
- SCOPE.md: three seed capabilities documented (MCP registration, state tracking, SBOM)
- scope.template: Provided Capabilities section with example block
- scripts/ingest_capabilities.py + make ingest-capabilities[/-all] targets
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 21:07:50 +01:00
|
|
|
accepted_at: datetime | None = None
|
|
|
|
|
completed_at: datetime | None = None
|
|
|
|
|
created_at: datetime
|
|
|
|
|
updated_at: datetime
|