feat(daemon): expose control-plane action registry over HTTP + WS#143
Merged
feat(daemon): expose control-plane action registry over HTTP + WS#143
Conversation
Wires @agentage/core@0.10.0's action registry into the daemon so host
UIs (desktop, web, future MCP clients) can dispatch control-plane
actions: update the CLI, clone a project from a remote, install an agent.
- src/daemon/actions.ts — registry singleton, registers the three
built-in actions bound to the real shell adapter + VERSION
- src/daemon/actions/{cli-update,project-add-from-origin,agent-install}.ts
— domain-owned action factories with input validation
- GET /api/actions — list manifests (introspection for host UIs)
- POST /api/actions/:name — SSE stream of InvokeEvent (accepted →
progress* → result|error), x-capabilities header for auth scoping,
cancels invocation on client disconnect
- WS { type: 'invoke', requestId, action, input, ... } — streams
action_event messages tagged with requestId; { type: 'cancel_invoke' }
aborts an in-flight invocation
Bumps @agentage/core to ^0.10.0. Coverage: 13 new tests across action
factories, registry bootstrap, and route SSE streaming.
Contributor
|
🎉 PR Validation ✅ PASSED Commit: Checks:
Ready to merge! ✨ 🔗 View workflow run |
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
Wires
@agentage/core@0.10.0's action registry into the daemon so host UIs (desktop, web dashboard, future MCP clients) can dispatch control-plane actions: update the CLI, clone a project from a remote, install an agent.The registry lives in core (merged in agentkit#105); this PR plugs it into the daemon's existing Express + WebSocket server and ships three reference actions. Adjacent CLAUDE.md note: each host owns its actions so they can bind to the host's real state (shell adapter, VERSION, projects list). A follow-up will re-export the core-side reference factories from the top-level barrel for hosts that want the pre-built versions.
Design
src/daemon/actions.ts) — built once on first access, registers the three built-in actions.GET /api/actions→{ success, data: ActionManifest[] }for introspectionPOST /api/actions/:name→ SSE stream ofInvokeEvent(accepted→progress*→result | error). Headers:x-capabilities(comma-separated; defaults to*for local callers),x-caller-id. Body:{ input, version?, idempotencyKey? }. Client disconnect aborts the invocation viares.on('close')— usedresrather thanreqto avoid premature aborts when the JSON body finishes streaming.{ type: 'invoke', requestId, action, input, version?, idempotencyKey?, capabilities? }— streams{ type: 'action_event', requestId, event: InvokeEvent }back, tagged withrequestIdfor multiplexing concurrent invocations{ type: 'cancel_invoke', requestId }— aborts an in-flight invocationsrc/daemon/actions/*.ts):cli:update(semver/latest validated, shellsnpm install -g),project:addFromOrigin(git URL validated, derives name, optional branch),agent:install(npm install in a workspace dir). Each declares a distinctcapability(cli.write,project.write,agent.write) andscope: 'machine'.Changes
src/daemon/actions.ts— registry bootstrap singletonsrc/daemon/actions/— cli-update, project-add-from-origin, agent-install + sharedShellExec/ActionProgresstypessrc/daemon/routes.ts— addswireActionRoutes, SSE streaming helper, capability header parsingsrc/daemon/websocket.ts—invoke/cancel_invokemessage handling, active invocations mapactions.test.ts,actions/actions.test.ts,routes.actions.test.ts(13 new tests)package.json— bumps@agentage/coreto^0.10.0Test plan
npm run verify— type-check + lint + format + build all green; 524/525 tests pass (one unrelated pre-existing worker-timeout flake inensure-daemon.test.ts— reproducible on master, not touched by this PR)*default works for local)cli:updateend-to-end from Desktop/Claude Code once an MCP or IPC client is wired@agentage/coretop-level so hosts don't need to copy themRelated
@agentage/core/controlmodule@agentage/core@0.10.0