feat(runtime): rebuild ACP execution as plugin adapters - #5224
Open
Sun-GLiang wants to merge 2 commits into
Open
Sun-GLiang wants to merge 2 commits into
Sun-GLiang wants to merge 2 commits into
Conversation
Sun-GLiang
force-pushed
the
feat/antigravity-acp-pr2
branch
from
September 12, 2026 07:29
6a6b3be to
84bbed6
Compare
Sun-GLiang
marked this pull request as ready for review
September 14, 2026 03:22
Sun-GLiang
force-pushed
the
feat/antigravity-acp-pr2
branch
from
September 14, 2026 14:09
9767546 to
b278ff0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR has been rebuilt from the latest
main(ea990cab) after #5283 established the generic Plugin-backed Session executor architecture.@maka/acp-executor-plugin, a shared ACP Runtime Plugin that exposesctx.acp.register(ctx, adapter, config)to child Plugin Entries.@maka/antigravity-acp-pluginas a thin Antigravity adapter containing only executable/helper validation, launch environment policy, and optional initial model configuration.PluginExecutorService/PluginExecutorBackend; ACP is not a second backend or Session-routing authority.text | file_difftool results.Refs #5103
Architecture
Runtime layers
flowchart LR Client["Desktop / CLI / API"] subgraph Maka["Maka generic execution authority"] Session["Session Manager<br/>executorId"] Backend["PluginExecutorBackend<br/>canonical event + interaction bridge"] Registry["PluginExecutorService<br/>scoped registry + generation binding"] end subgraph ACPPlugin["ACP Runtime Plugin"] AcpService["ctx.acp<br/>adapter registration"] AcpExecutor["AcpExecutor<br/>protocol + process + Session lifecycle"] end subgraph Adapters["External-Agent adapter plugins"] Antigravity["Antigravity adapter<br/>paths + env + model quirks"] Future["Future ACP adapter<br/>Cursor / other Agent"] end Agent["External ACP process"] Forms["Hosted Form authority"] Transcript["Canonical Session events"] Client -->|"create/send with executorId"| Session Session --> Backend Backend -->|"generation-pinned execute"| Registry Registry --> AcpExecutor AcpService -->|"wrap adapter as executor"| AcpExecutor Antigravity -->|"ctx.acp.register(ctx, adapter, config)"| AcpService Future -->|"ctx.acp.register(ctx, adapter, config)"| AcpService AcpExecutor <-->|"ACP over stdio"| Agent AcpExecutor -->|"PluginExecutorOutputEvent"| Backend Backend --> Transcript AcpExecutor -->|"requestPermission"| Backend Backend <--> FormsThe key boundary is the generic executor contract. Maka owns routing, binding, canonical persistence, and hosted interactions; the ACP Runtime Plugin owns ACP mechanics; each adapter owns only product-specific launch/configuration differences.
Setup-to-plugin activation
RuntimePolicy remains the durable owner of setup facts. The coordinator creates replaceable derived Plugin packages in dependency order and compares canonical content digests before installation, so restart and repeated reconciliation do not churn Plugin generations. Clearing the setting removes the adapter first and then the shared runtime. Neither Plugin bundle receives RuntimePolicy authority.
Plugin composition and ownership
The Host installs
acp-executoras a system-managed package and contributes an isolatedacp-runtimeprofile Entry. External-Agent Entries are mounted below it, so service availability and disposal follow normal Plugin Context/Fiber ownership. The adapter passes its consuming Context explicitly across independently bundled generations; executor registration remains scoped, transactional, generation-pinned, and retired by #5283's existing machinery.One request lifecycle
sequenceDiagram participant User participant Session as Maka Session participant Backend as PluginExecutorBackend participant Service as PluginExecutorService participant ACP as ACP Runtime participant Agent as External ACP Agent User->>Session: send(turn, executorId) Session->>Backend: BackendSendInput Backend->>Service: execute(binding, request) Service->>ACP: execute(request, context) alt first prompt for this conversation ACP->>Agent: spawn + initialize ACP->>Agent: session/new(cwd) ACP->>Agent: setConfigOption (optional) ACP->>ACP: persist continuity marker end ACP->>Agent: session/prompt Agent-->>ACP: text / thought / tool updates ACP-->>Backend: generic output events Backend-->>Session: canonical SessionEvents opt Agent requests permission Agent->>ACP: session/requestPermission ACP->>Backend: context.requestPermission Backend->>User: Hosted Form User-->>Backend: selected / cancelled Backend-->>ACP: validated result ACP-->>Agent: ACP permission outcome end Agent-->>ACP: stopReason ACP-->>Service: completed / cancelled / failed Service-->>Backend: normalized terminal result Backend-->>Session: complete / abort / errorCancellation flows in the reverse direction through the same chain: Session stop aborts the bound executor call, ACP sends
session/cancel, waits for settlement, and force-terminates the process tree only when cooperative cleanup does not finish. Plugin disable/reload/uninstall uses the same retirement and drain path.Responsibility boundary
executorIdrouting, scoped registration, generation binding, canonical events, Hosted FormsThe Antigravity adapter build is about 2.4 KB; the ACP SDK and shared lifecycle implementation live only in the runtime package. A future ACP provider implements the adapter contract instead of copying process, protocol, file, permission, cancellation, and event-projection code.
Removed from the previous implementation
The rebuild deliberately does not carry forward the old PR's:
AcpAgentBackendand ACP backend registry;backend: "acp"/externalAgentIdSession and Storage branches;Those paths either duplicate #5283 or require a future generic executor configuration/selection capability. The installation and authentication foundation already merged in #5164 remains unchanged because it is still live mainline behavior.
Behavior and safety
session/new, prompt, cancellation, and cleanup are shared across adapters.file_difftool results; oversized diffs degrade to a bounded summary.Remaining PR 2 work
PR 2 remains one vertical PR. Work is tracked as four producer-to-consumer minimum sets inside this same PR:
A checklist group is complete only when its producer, boundary contract, real consumer, and acceptance test land together. Dynamic modes and catalog invalidation remain PR 4; restoring the same external Session remains PR 3.
Verification
Current head:
169b969dfplugin.mjsinstall/restart/config-clear testgit diff --checkand staged ASF header guardAI use
Select exactly one:
Tool(s) and scope: OpenAI Codex contributed architecture analysis, implementation, tests, verification, documentation, and PR preparation. Independent human review remains required.
Checklist
main