fix(runtime): display multica CLI version instead of agent CLI version (#332)

The runtime detail page was showing the agent CLI version (claude/codex)
as "CLI Version" because metadata.version stored the agent version from
agent.DetectVersion(). The multica CLI version was never sent.

Fix: daemon now sends cli_version in the registration request, server
stores it as metadata.cli_version alongside the existing agent version,
and frontend reads metadata.cli_version.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
LinYushen 2026-04-02 14:40:35 +08:00 committed by GitHub
parent eba2e7eacf
commit 682dc20ba9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 13 additions and 4 deletions

View file

@ -6,8 +6,12 @@ import { UpdateSection } from "./update-section";
import { UsageSection } from "./usage-section";
function getCliVersion(metadata: Record<string, unknown>): string | null {
if (metadata && typeof metadata.version === "string" && metadata.version) {
return metadata.version;
if (
metadata &&
typeof metadata.cli_version === "string" &&
metadata.cli_version
) {
return metadata.cli_version;
}
return null;
}

View file

@ -263,6 +263,7 @@ func runDaemonForeground(cmd *cobra.Command) error {
if err != nil {
return err
}
cfg.CLIVersion = version
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer stop()

View file

@ -28,6 +28,7 @@ type Config struct {
DaemonID string
DeviceName string
RuntimeName string
CLIVersion string // multica CLI version (e.g. "0.1.13")
Profile string // profile name (empty = default)
Agents map[string]AgentEntry // "claude" -> entry, "codex" -> entry
WorkspacesRoot string // base path for execution envs (default: ~/multica_workspaces)

View file

@ -254,6 +254,7 @@ func (d *Daemon) registerRuntimesForWorkspace(ctx context.Context, workspaceID s
"workspace_id": workspaceID,
"daemon_id": d.cfg.DaemonID,
"device_name": d.cfg.DeviceName,
"cli_version": d.cfg.CLIVersion,
"runtimes": runtimes,
}

View file

@ -23,10 +23,11 @@ type DaemonRegisterRequest struct {
WorkspaceID string `json:"workspace_id"`
DaemonID string `json:"daemon_id"`
DeviceName string `json:"device_name"`
CLIVersion string `json:"cli_version"` // multica CLI version
Runtimes []struct {
Name string `json:"name"`
Type string `json:"type"`
Version string `json:"version"`
Version string `json:"version"` // agent CLI version (claude/codex)
Status string `json:"status"`
} `json:"runtimes"`
}
@ -90,7 +91,8 @@ func (h *Handler) DaemonRegister(w http.ResponseWriter, r *http.Request) {
status = "offline"
}
metadata, _ := json.Marshal(map[string]any{
"version": runtime.Version,
"version": runtime.Version,
"cli_version": req.CLIVersion,
})
registered, err := h.Queries.UpsertAgentRuntime(r.Context(), db.UpsertAgentRuntimeParams{