fix(agents): share runtimes across connection sessions

This commit is contained in:
t8y2 committed 2026-07-13 15:13:48 +08:00
1 parent 1280450b98
commit 67541232a2
67 files changed
+2904 -354

No files matched your search

@@ -44,6 +44,7 @@ const driverStoreTab = ref("agent");
import { useSettingsStore } from "@/stores/settingsStore";
import type { DriverStorePathInfo } from "@/lib/backend/api";
import { driverRuntimeProtocolLabel } from "./driverRuntimeDisplay";
const settingsStore = useSettingsStore();
type DriverStoreDirKind = "plugin" | "agent";
@@ -1479,6 +1480,10 @@ watch(driverStoreTab, (tab) => {
<span>{{ runtimeKindLabel(runtime) }}</span>
<span class="text-muted-foreground/50">/</span>
<span>{{ runtimeSourceLabel(runtime) }}</span>
<template v-if="runtime.protocol_mode">
<span class="text-muted-foreground/50">/</span>
<span>{{ driverRuntimeProtocolLabel(runtime) }}</span>
</template>
</div>
</div>
@@ -0,0 +1,13 @@
import { describe, expect, it } from "vitest";
import { driverRuntimeProtocolLabel } from "./driverRuntimeDisplay";
describe("driverRuntimeProtocolLabel", () => {
it("shows aggregated multi-session counts", () => {
expect(driverRuntimeProtocolLabel({ protocol_mode: "multi_session", active_sessions: 4 })).toBe("Multi-session · 4 sessions");
});
it("labels legacy runtimes and hides unknown modes", () => {
expect(driverRuntimeProtocolLabel({ protocol_mode: "legacy", active_sessions: null })).toBe("Legacy");
expect(driverRuntimeProtocolLabel({ protocol_mode: null, active_sessions: null })).toBeNull();
});
});
@@ -0,0 +1,11 @@
import type { DriverRuntimeInfo } from "@/lib/backend/tauri";
export function driverRuntimeProtocolLabel(runtime: Pick<DriverRuntimeInfo, "protocol_mode" | "active_sessions">): string | null {
if (runtime.protocol_mode === "multi_session") {
return `Multi-session · ${runtime.active_sessions ?? 0} sessions`;
}
if (runtime.protocol_mode === "legacy") {
return "Legacy";
}
return null;
}