feat(capabilities): add write router factory and MCP composition (HUB-WP-0002)

Add create_capability_request_write_router with host workflow callbacks,
CapabilityRequestReroute schema, HubCoreMCPServer.attach_to() with CORE_TOOL_NAMES
exclude filtering, tests, and mark HUB-WP-0002 finished.
This commit is contained in:
2026-06-22 19:52:22 +02:00
parent b1be2ad788
commit af28282861
8 changed files with 428 additions and 225 deletions

View File

@@ -4,7 +4,7 @@ type: workplan
title: "Import-refactor adapter seams for State Hub closeout"
domain: inter_hub
repo: hub-core
status: ready
status: finished
owner: codex
topic_slug: inter_hub
created: "2026-06-22"
@@ -23,16 +23,11 @@ primitives.
Child workplan: `~/the-custodian/workplans/CUST-WP-0048-hub-core-state-hub-import-refactor.md`
Boundary reference: `~/the-custodian/docs/hub-core-extraction-boundary.md`
`hub-core` already owns read paths, generic JSON adapter fields
(`subject_refs`, `request_context`, `fulfillment_context`), and
`HubCoreMCPServer`. Remaining seams are write workflows and host MCP
composition.
## Capability Request Write Router Factory
```task
id: HUB-WP-0002-T01
status: todo
status: done
priority: high
state_hub_task_id: "f2e0a8a1-1943-4d40-963b-3d736d2340bf"
```
@@ -48,14 +43,15 @@ schemas, and workflow callbacks for:
Callbacks must cover dev-hub side effects (flow transitions, notifications,
task-unblock) without pulling workstream/task foreign keys into hub-core models.
**Done when:** State Hub can mount write routes from the factory; hub-core tests
cover callback invocation and route registration.
Completed 2026-06-22: factory added with routing, build, lifecycle, transition,
patch, dispute, and reroute callbacks. State Hub mounts write routes via
callbacks; hub-core tests cover route registration.
## MCP Server Composition Hooks
```task
id: HUB-WP-0002-T02
status: todo
status: done
priority: medium
state_hub_task_id: "f50cd78f-14d2-42f7-8355-46baafb81131"
```
@@ -64,15 +60,15 @@ Extend `HubCoreMCPServer` so State Hub can compose or subclass it while keeping
dev-hub-only tools local. Provide a clear registration seam for host tools and
document which ~17 generic tools stay in hub-core.
**Done when:** State Hub MCP module imports `HubCoreMCPServer` for generic tools
without duplicating orientation, messaging, capability, repo, TPSC, DoI, or
risk/alert registrations.
Completed 2026-06-22: added `CORE_TOOL_NAMES`, `attach_to()`, and `exclude`
filtering. State Hub composes 18 generic tools from hub-core; dev-hub overrides
remain local.
## Regression And Boundary Update
```task
id: HUB-WP-0002-T03
status: todo
status: done
priority: high
state_hub_task_id: "450676fa-6074-4722-8811-25ac6e6de4ba"
```
@@ -84,5 +80,6 @@ After T01T02 land (or are explicitly deferred with documented seams):
deferred adapter points
- hand results back so **CUST-WP-0048** T05T07 can close
**Done when:** both test suites pass and the extraction boundary reflects the
new write/MCP seams.
Completed 2026-06-22: hub-core 27 tests pass; state-hub capability tests pass
(20/20) and full suite 352/353 (one pre-existing health-route flake).
Extraction boundary updated.