diff --git a/web/host/web-host.ts b/web/host/web-host.ts index 6203e647..779d502a 100644 --- a/web/host/web-host.ts +++ b/web/host/web-host.ts @@ -9,7 +9,10 @@ import { } from "node:http"; import { URL } from "node:url"; import { promisify } from "node:util"; -import { subscribeWebCapabilities } from "../../extensions/shared/web-observer-registry.ts"; +import { + subscribeWebCapabilities, + webCapabilitySnapshot, +} from "../../extensions/shared/web-observer-registry.ts"; import { PiWebAdapter } from "../adapter/pi-adapter.ts"; import { jsonByteLength, @@ -557,6 +560,19 @@ export class WebHost { } if (url.pathname === "/api/models") return this.json(response, 200, { models: this.runtime.listModels() }); + if (url.pathname === "/api/capabilities") + return this.json(response, 200, { + sessionId: this.runtime.sessionManager.getSessionId(), + capabilities: webCapabilitySnapshot(this.runtime.sessionManager), + }); + if (url.pathname === "/api/diagnostics") + return this.json(response, 200, { + node: process.version, + cwd: this.runtime.cwd, + sessionId: this.runtime.sessionManager.getSessionId(), + workspaceSelected: this.runtime.workspaceSelected, + models: this.runtime.listModels().filter((model) => model.current), + }); if (url.pathname === "/api/snapshot") { const cursor = this.sequence; const projection = await this.adapter.getSnapshot(