expose task control and deduplicated operations through MCP

This commit is contained in:
2026-09-29 10:26:19 +01:00
parent c1834bad1f
commit 20bbbd26bd
14 changed files with 775 additions and 12 deletions
@@ -225,6 +225,50 @@ cross-project or old task identities cannot read/cancel cached work. Neither MCP
JSON-RPC IDs nor runtime requestIds replace this identity. Restart never restores
the registry, replays an advance or recovers authorization.
### 4.1 Task Work and Correlation
`TaskTools` is the neutral service surface; MCP only validates schemas and projects
its results. The Core implementation admits work through `AutomationSession.submit`
and the existing operation executor, sharing DEV's busy state and cancellation.
Acquisition requires the prior human grant. Release reports `MANUAL` only after
managed cleanup and document refresh succeed; cleanup failures remain explicit.
Admission and request registration are atomic per project. Deduplication uses the
operation kind and effective parameters, including requested frames. It is checked
after task authority and before busy/active-runtime validation, so a repeated
accepted start still resolves its original operation after that work has ended.
Rejected starts do not reserve clientRequestIds. Distinct requests cannot silently
queue behind busy work. Other projects remain independent.
Polling returns `workerTerminated` separately from operation state. `CANCELLED`
may acknowledge interruption before the worker exits; it does not permit another
conflicting operation or manual control. Final results remain null until worker
termination. Progress contains only provider-reported counts and can be unknown.
A cooperative final capture is published to DEV before termination while the task
is still valid. A revoked task cannot publish a late frame or retrieve cached work.
Historical operation images are marked stale when they no longer match DEV's
current session/build/frame, or DEV has marked that capture stale.
Build executes the same saved-project compiler/packer preparation as manual
Shipper, under task admission rather than a manual lease. It checks cancellation
between compilation, validation and packaging phases. A successful build receives
a task-local buildId; failed builds retain typed diagnostics and do not release
control. Before rebuilding, the managed runtime must finish shutdown and detach.
Old buildIds are invalidated before overwriting artifacts, including when the new
build fails. This is artifact correlation, not source snapshots or recovery.
Headless handlers consume a neutral `HeadlessGateway` session port. Boot accepts
only a current successful task build; one runtime session may be attached at a
time. Input is normalized to a complete replacement snapshot. Advance limits come
from that session and are enforced without clamping. Shutdown detaches only after
managed cleanup finishes. Runtime process supervision and protocol mapping belong
to the application gateway delivered in step 22, not to MCP or the test doubles.
Task-local operation/build records are discarded after worker termination on
return, revocation or project closure. Cleanup failures never restore authority;
the records are still discarded after managed work stops. Neither connection
disconnect nor polling silence discards an authorized task's records.
## 5. Project Knowledge DTOs
Neutral `ProjectKnowledge.Context` contains projectRoot/projectName, languages,
@@ -357,8 +401,10 @@ or oversized input, closure, restart and old-token rejection. Provider doubles
exist only in tests. Composition starts/closes transport with Studio.
The production registry composes `studio_project_context`, `studio_reference_read`
and `studio_language_query` as of step 19; other
tools are advertised only when their functional handlers are connected.
and `studio_language_query`, plus control acquire/release, build start and operation
get/cancel as of step 20 (eight tools). Headless handlers are implemented and
tested against the neutral port, but are advertised only when a real
`HeadlessGateway` is composed in the integration phase. No fake runtime is shipped.
DEV configuration-copy stays unavailable until step 21. Passing this transport
gate is not the phase 3 or final external-agent acceptance gate. API/Core and
JavaFX MUST NOT import MCP/HTTP implementations; architecture tests enforce it.