Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
Show version number in Skyvern's UI (#SKY-8048) (#4994)
Celal Zamanoğlu66dbe83ecce1
diff --git a/skyvern-frontend/src/hooks/useVersionQuery.ts b/skyvern-frontend/src/hooks/useVersionQuery.tsnew file mode 100644index 000000000..950623937--- /dev/null+++ b/skyvern-frontend/src/hooks/useVersionQuery.ts@@ -0,0 +1,22 @@+import { getClient } from "@/api/AxiosClient";+import { useQuery } from "@tanstack/react-query";++type VersionResponse = {+ version: string;+};++function useVersionQuery() {+ return useQuery<VersionResponse>({+ queryKey: ["version"],+ queryFn: async () => {+ const client = await getClient(null);+ return client.get("/version").then((response) => response.data);+ },+ staleTime: 60 * 60 * 1000,+ gcTime: 60 * 60 * 1000,+ refetchOnWindowFocus: false,+ retry: false,+ });+}++export { useVersionQuery };diff --git a/skyvern-frontend/src/routes/settings/Settings.tsx b/skyvern-frontend/src/routes/settings/Settings.tsxindex 686f89d1a..dd5ee5c21 100644--- a/skyvern-frontend/src/routes/settings/Settings.tsx+++ b/skyvern-frontend/src/routes/settings/Settings.tsx@@ -19,11 +19,14 @@ import { HiddenCopyableInput } from "@/components/ui/hidden-copyable-input";import { OnePasswordTokenForm } from "@/components/OnePasswordTokenForm";import { AzureClientSecretCredentialTokenForm } from "@/components/AzureClientSecretCredentialTokenForm";import { CustomCredentialServiceConfigForm } from "@/components/CustomCredentialServiceConfigForm";+import { useVersionQuery } from "@/hooks/useVersionQuery";+import { formatVersion } from "@/util/version";function Settings() {const { environment, organization, setEnvironment, setOrganization } =useSettingsStore();const apiKey = getRuntimeApiKey();+ const { data: versionData } = useVersionQuery();return (<div className="flex flex-col gap-8">@@ -109,6 +112,11 @@ function Settings() {<CustomCredentialServiceConfigForm /></CardContent></Card>+ {versionData?.version && (+ <p className="text-center text-xs text-muted-foreground/50">+ v{formatVersion(versionData.version)}+ </p>+ )}</div>);}diff --git a/skyvern-frontend/src/util/version.test.ts b/skyvern-frontend/src/util/version.test.tsnew file mode 100644index 000000000..7a65a64fd--- /dev/null+++ b/skyvern-frontend/src/util/version.test.ts@@ -0,0 +1,13 @@+import { formatVersion } from "./version";+import { describe, test, expect } from "vitest";++describe("formatVersion", () => {+ test("passes through semver tags as-is", () => {+ expect(formatVersion("1.2.3")).toBe("1.2.3");+ expect(formatVersion("v2.0.0-beta.1")).toBe("v2.0.0-beta.1");+ });++ test("passes through arbitrary strings as-is", () => {+ expect(formatVersion("custom-build")).toBe("custom-build");+ });+});diff --git a/skyvern-frontend/src/util/version.ts b/skyvern-frontend/src/util/version.tsnew file mode 100644index 000000000..835e31e21--- /dev/null+++ b/skyvern-frontend/src/util/version.ts@@ -0,0 +1,5 @@+function formatVersion(version: string): string {+ return version;+}++export { formatVersion };diff --git a/skyvern/forge/sdk/routes/agent_protocol.py b/skyvern/forge/sdk/routes/agent_protocol.pyindex 636370b4e..752ad680b 100644--- a/skyvern/forge/sdk/routes/agent_protocol.py+++ b/skyvern/forge/sdk/routes/agent_protocol.py@@ -24,6 +24,7 @@ from pydantic import ValidationErrorfrom skyvern import analyticsfrom skyvern._version import __version__+from skyvern.analytics import get_oss_versionfrom skyvern.config import settingsfrom skyvern.exceptions import (MissingBrowserAddressError,@@ -1692,6 +1693,19 @@ async def heartbeat() -> Response:return Response(content="Server is running.", status_code=200, headers={"X-Skyvern-API-Version": __version__})+@legacy_base_router.get(+ "/version",+ tags=["server"],+ include_in_schema=False,+)+@legacy_base_router.get("/version/", include_in_schema=False)+async def get_version() -> dict[str, str]:+ """+ Get the current server version.+ """+ return {"version": get_oss_version()}++@legacy_base_router.get("/models",tags=["agent"],