diff --git a/clients/macos/vellum-assistant/Features/Chat/MediaEmbeds/InlineVideoAttachmentView.swift b/clients/macos/vellum-assistant/Features/Chat/MediaEmbeds/InlineVideoAttachmentView.swift index 8cb5435b24e..e2efe9f62b8 100644 --- a/clients/macos/vellum-assistant/Features/Chat/MediaEmbeds/InlineVideoAttachmentView.swift +++ b/clients/macos/vellum-assistant/Features/Chat/MediaEmbeds/InlineVideoAttachmentView.swift @@ -184,7 +184,7 @@ struct InlineVideoAttachmentView: View { /// Fetch attachment base64 data from the daemon HTTP endpoint. private func fetchAttachmentData(port: Int, attachmentId: String) async throws -> String { - guard let token = await SessionTokenManager.getTokenAsync() else { + guard let token = readHttpToken() else { throw URLError(.userAuthenticationRequired) } let url = URL(string: "http://localhost:\(port)/v1/attachments/\(attachmentId)")! diff --git a/clients/shared/IPC/DaemonClient.swift b/clients/shared/IPC/DaemonClient.swift index 2065ed3dcc0..c7abc6389db 100644 --- a/clients/shared/IPC/DaemonClient.swift +++ b/clients/shared/IPC/DaemonClient.swift @@ -51,6 +51,18 @@ func readSessionToken(environment: [String: String]? = nil) -> String? { } return token } + +/// Read the daemon HTTP bearer token from disk (~/.vellum/http-token). +func readHttpToken() -> String? { + let tokenPath = NSHomeDirectory() + "/.vellum/http-token" + guard let data = try? Data(contentsOf: URL(fileURLWithPath: tokenPath)), + let token = String(data: data, encoding: .utf8)? + .trimmingCharacters(in: .whitespacesAndNewlines), + !token.isEmpty else { + return nil + } + return token +} #endif /// Protocol for daemon client communication, enabling dependency injection and testing.