feat(studio): coordinate integrated AI activity and internal language services
Start project-owned language and authenticated MCP services when opening a project, reusing the embedded LSP backend without a desktop TCP listener. Keep editor overlays separate from saved-file MCP queries. Reserve conflicting editing before ACP prompt delivery and retain protection through native/tool termination, runtime cleanup and document refresh. Preserve drafts on rejected admission, provide cleanup/preparation recovery, distinguish terminal outcomes and redact permission previews. Add lifecycle, language parity, activity, composition and UI regressions and update the canonical Studio contracts. Keep distribution update alignment as the separate WRK-002A follow-up. Validation: complete make -C tooling verify PASSED in 20261127T035822Z-ec5d9266 (1172 unit, 131 compiler fixture, 31 headless tests). Opt-in real-model and native AI-view qualification are outside that gate. Work: WRK-0029; decision: DEC-0001.
This commit is contained in:
@@ -15,15 +15,18 @@ existing domain ownership.
|
||||
|
||||
## Purpose
|
||||
|
||||
Allow a developer to grant control of an open project to an external coding
|
||||
agent, observe managed operations and canonical runtime images, and explicitly
|
||||
reclaim control. Studio provides specialized project services through MCP, not
|
||||
an embedded agent or a second editor.
|
||||
Coordinate the integrated AI conversation with project editing, specialized MCP
|
||||
services and managed runtime work. Opening a project starts its internal language
|
||||
workspace and authenticated MCP access. Their availability does not reserve assets.
|
||||
Studio reserves conflicting editing only for the admitted AI activity and its
|
||||
actual finalization. Legacy external DEV grant/reclaim remains an explicit,
|
||||
separate compatibility flow.
|
||||
|
||||
## Authority and Normative Inputs
|
||||
|
||||
This specification implements accepted **DEC-0060**, including D1–D7 and B1–B9.
|
||||
PLN-0139 sequences its implementation; it does not redefine this contract.
|
||||
The shared operation/runtime contracts remain applicable to both integrated AI
|
||||
and the legacy external DEV workflow. Integrated activity admission below defines
|
||||
the current desktop flow; manual grant buttons belong only to the legacy flow.
|
||||
|
||||
- [Core and Adapter Architecture](9.%20Studio%20Core%20and%20Adapter%20Architecture%20Specification.md): dependency direction, composition and shared operations.
|
||||
- [Shell and Workspace Layout](1.%20Studio%20Shell%20and%20Workspace%20Layout%20Specification.md): workspace mounting and project lifetime.
|
||||
@@ -44,8 +47,8 @@ implement a parallel permission/build/pack/execution system.
|
||||
| --- | --- |
|
||||
| Studio API | Plain-Java contracts, identities, snapshots, typed outcomes, diagnostics and ports; no toolkit, framework or concrete wire DTOs |
|
||||
| Studio Core | Project/session authority, guards, operations, build/pack/runtime coordination and ordered cleanup; testable without JavaFX or Spring |
|
||||
| JavaFX DEV | Human grant/reclaim actions, presentation, localization, canvas, subscriptions and FX-thread projection |
|
||||
| Application/infrastructure | MCP HTTP transport, process supervision, runtime JSONL translation, existing project LSP client, lifecycle and packaging |
|
||||
| JavaFX | Integrated conversation and activity projection; legacy DEV grant/reclaim; localization and subscriptions |
|
||||
| Application/infrastructure | MCP HTTP transport, process supervision, runtime JSONL translation, internal language workspace, lifecycle and packaging |
|
||||
| Runtime | Firmware/VM execution, input sampling, logical frames, ticks, rendering, watchdogs and faults |
|
||||
| External coding client | Agent/chat, model/provider credentials, native file editing, budget, iterations and simple task stopping criteria |
|
||||
|
||||
@@ -65,17 +68,19 @@ HTTP connection or UI component. The agent MUST supply a project root; Studio
|
||||
MUST validate it against an open project and use explicit project identity.
|
||||
Window focus MUST NOT implicitly select a call's target.
|
||||
|
||||
Connection authentication, human project grant and task control identity MUST
|
||||
be separate checks. At most one task MAY own a project's grant. Acquisition
|
||||
without a prior human grant MUST fail. A task identity MUST be required for
|
||||
authorized work and MUST NOT be reusable for another project or revoked task.
|
||||
Connection authentication, activity admission and task identity MUST be separate
|
||||
checks. The project-owned ACP coordinator MUST reserve the Core editing lane
|
||||
before submitting a prompt. `studio_control_acquire` returns the admitted task
|
||||
idempotently during that activity. Outside an integrated activity, external
|
||||
acquisition still requires an explicit human DEV grant. A task MUST NOT be reused
|
||||
across projects, activities or project generations.
|
||||
|
||||
| State | Admission and permitted behavior | Exit |
|
||||
| --- | --- | --- |
|
||||
| Manual control | Human editing/Debug; grant only with no active Debug or conflicting managed work, and successful document handoff | Human grant enters waiting |
|
||||
| Waiting for agent | Grant already blocks conflicting manual work; authenticated agent can acquire; human can reclaim without an agent connection | Acquisition enters working; reclaim enters returning |
|
||||
| Agent working | One acquired task uses its valid identity; developer can inspect, navigate and reclaim | Explicit task release or human revoke enters returning |
|
||||
| Returning control | Prior authority is invalid; stop managed work and refresh documents; manual conflicting actions remain blocked | Manual control only after cleanup/handoff |
|
||||
| Manual control | Editing and Play are available; AI admission refuses dirty documents, active manual work or Play, without saving/discarding/stopping them | Integrated admission enters working; legacy grant enters waiting |
|
||||
| Waiting for agent | Legacy external grant already blocks conflicting editing | Legacy acquisition enters working; reclaim enters returning |
|
||||
| Agent working | Integrated activity protects assets through prompt, permission waits and tool work; chat selection, writing drafts and cancel remain available | Coordinator finalization enters returning; integrated model release alone retains protection |
|
||||
| Returning control | Prior task is invalid; wait for workers/runtime shutdown and refresh documents | Manual control only after successful cleanup; failure retains protection and explicit retry |
|
||||
|
||||
Grant and acquisition MUST be enforced atomically with conflicting operation
|
||||
admission. Concurrent acquisition MUST NOT create two owners. Project-local
|
||||
@@ -84,7 +89,8 @@ authority MUST NOT become a global Studio lock.
|
||||
Human Debug active MUST prevent grant. From grant onward, including waiting
|
||||
and silence, Studio MUST prevent manual editing, Debug, build and other
|
||||
conflicting project mutation. Guards MUST apply at service entry points as
|
||||
well as UI bindings. Navigation, inspection and monitoring remain available.
|
||||
well as UI bindings. The integrated shell MUST stay in the AI area while activity
|
||||
is admitted/finalizing. Conversation inspection and cancellation remain available.
|
||||
|
||||
An operation finishing, failing compilation, raising a guest fault or losing
|
||||
its runtime session MUST NOT release task authority. Silence, client
|
||||
@@ -97,15 +103,18 @@ Grant MUST cover Studio-owned unsaved buffers/drafts, including dirty asset
|
||||
editing surfaces; it MUST NOT assume that source files are the only editable
|
||||
project content.
|
||||
|
||||
If such content is dirty, DEV MUST offer **Save all and grant** or **Cancel**.
|
||||
Integrated admission MUST refuse dirty content and preserve it, requiring an
|
||||
explicit save or discard in its owning editor before retrying Send. It MUST NOT
|
||||
silently save or discard it. In the legacy external flow only, DEV MUST offer
|
||||
**Save all and grant** or **Cancel**.
|
||||
Grant MUST follow successful saves; user cancellation or save failure MUST NOT
|
||||
cede control. Clean projects do not require a code snapshot, clean Git tree or
|
||||
commit. Document participants MUST use neutral handoff contracts without moving
|
||||
presentation buffers or JavaFX types into Core.
|
||||
|
||||
The agent edits the actual project folder with native external tools. Build
|
||||
MUST use saved files, and the existing project LSP client MUST synchronize
|
||||
saved content before semantic queries. Studio MUST NOT claim to save external
|
||||
MUST use saved files. MCP language queries MUST use a saved-file view distinct
|
||||
from editor overlays, while sharing the existing language engine internally. Studio MUST NOT claim to save external
|
||||
unsaved buffers or protect against concurrent external writes.
|
||||
|
||||
On authority return, Studio MUST refresh open documents from disk and MUST NOT
|
||||
@@ -121,7 +130,13 @@ engineering delivery that prepared this integration.
|
||||
|
||||
## 4. Return, Revocation and Closure
|
||||
|
||||
Explicit release and human reclaim MUST follow this order:
|
||||
Integrated normal completion MUST await the active operation's actual termination
|
||||
before return. Cancellation, transport failure and project close MUST cancel
|
||||
managed work and await termination. An ACP response, model release, completed
|
||||
response Future or cancellation acknowledgement alone MUST NOT unlock editing.
|
||||
An integrated model release acknowledges completion intent without revoking the
|
||||
coordinator-owned reservation. The coordinator's return, or legacy explicit
|
||||
release/human reclaim, MUST follow this order:
|
||||
|
||||
1. Invalidate task authority and reject new or delayed calls under the old identity.
|
||||
2. Cancel/stop managed work and shut down owned runtime processes.
|
||||
@@ -134,7 +149,7 @@ document refresh is complete. Diagnostics MUST distinguish cleanup failure from
|
||||
a successful return; operation outcome and authorization state are not the same.
|
||||
|
||||
Reclaim MUST also work while waiting for an agent or after an operation failure.
|
||||
Another task MUST require a new human grant. Closing/hiding/switching DEV MUST
|
||||
Another task MUST require a newly admitted integrated activity or a fresh explicit legacy external grant. Closing/hiding/switching DEV MUST
|
||||
NOT release control. Closing the project or Studio MUST revoke authority and
|
||||
stop managed processes before teardown of their providers/executors. Reopening
|
||||
MUST start in manual control, even when restoring DEV as the selected workspace.
|
||||
@@ -313,17 +328,17 @@ specified in [MCP Tools and Project Knowledge Contract](11.%20MCP%20Tools%20and%
|
||||
|
||||
The desktop MUST host Streamable HTTP at `127.0.0.1:<OS-assigned-port>/mcp`.
|
||||
DEC-0061 adds Studio-owned stdio discovery and one-time preparation as specified
|
||||
in spec 11. Each human grant publishes a fresh project-scoped credential through
|
||||
in spec 11. Each project opening publishes a fresh project-scoped credential through
|
||||
the required lifecycle participant in spec 8. Authentication, project scope and
|
||||
task identity remain separate checks. There is no global credential bypass.
|
||||
Restart invalidates old access and requires a fresh human grant, while the native
|
||||
Restart invalidates old access and requires fresh project access and activity admission, while the native
|
||||
client's command/configuration remains unchanged. No remote binding, accounts or
|
||||
OAuth are introduced. Preparation never grants editing authority.
|
||||
|
||||
| Tool group | Required capabilities | Required authority |
|
||||
| --- | --- | --- |
|
||||
| Context/references | Project identity, languages, versions, capabilities and paginated references | Project credential; no acquired task required |
|
||||
| Control | Acquire task and release control | Prior human grant for acquisition; valid task identity for release |
|
||||
| Control | Acquire task and release control | Admitted integrated activity or prior legacy human grant; valid task identity for release |
|
||||
| Language | Existing LSP diagnostics/navigation and supported capabilities | Valid project/task identity |
|
||||
| Build | Compile and pack | Valid project/task identity |
|
||||
| Headless | Boot/reset, input, advance, capture, state/fault and shutdown | Valid project/task identity |
|
||||
@@ -364,7 +379,7 @@ pagination, not arbitrary paths. Documentation ownership remains with its
|
||||
language/SDK/library owner; packaging does not create parallel language semantics.
|
||||
|
||||
Connection guidance MUST describe: connect → consult current project/languages/
|
||||
references → acquire after human grant → work using saved files and validate
|
||||
references → obtain the admitted integrated task (or acquire after a legacy human grant) → work using saved files and validate
|
||||
through LSP/build → release. The agent need not know PBS in advance. Missing
|
||||
documentation or unsupported language MUST appear as explicit limitations;
|
||||
static copied instructions MUST NOT substitute for current project context.
|
||||
|
||||
Reference in New Issue
Block a user