diff --git a/apps/macos/Sources/ClawdbotProtocol/GatewayModels.swift b/apps/macos/Sources/ClawdbotProtocol/GatewayModels.swift index 7d8189248..aefbdb572 100644 --- a/apps/macos/Sources/ClawdbotProtocol/GatewayModels.swift +++ b/apps/macos/Sources/ClawdbotProtocol/GatewayModels.swift @@ -552,6 +552,44 @@ public struct AgentParams: Codable, Sendable { } } +public struct AgentIdentityParams: Codable, Sendable { + public let agentid: String? + public let sessionkey: String? + + public init( + agentid: String?, + sessionkey: String? + ) { + self.agentid = agentid + self.sessionkey = sessionkey + } + private enum CodingKeys: String, CodingKey { + case agentid = "agentId" + case sessionkey = "sessionKey" + } +} + +public struct AgentIdentityResult: Codable, Sendable { + public let agentid: String + public let name: String? + public let avatar: String? + + public init( + agentid: String, + name: String?, + avatar: String? + ) { + self.agentid = agentid + self.name = name + self.avatar = avatar + } + private enum CodingKeys: String, CodingKey { + case agentid = "agentId" + case name + case avatar + } +} + public struct AgentWaitParams: Codable, Sendable { public let runid: String public let timeoutms: Int? @@ -1447,17 +1485,21 @@ public struct WebLoginWaitParams: Codable, Sendable { public struct AgentSummary: Codable, Sendable { public let id: String public let name: String? + public let identity: [String: AnyCodable]? public init( id: String, - name: String? + name: String?, + identity: [String: AnyCodable]? ) { self.id = id self.name = name + self.identity = identity } private enum CodingKeys: String, CodingKey { case id case name + case identity } } diff --git a/apps/shared/ClawdbotKit/Sources/ClawdbotProtocol/GatewayModels.swift b/apps/shared/ClawdbotKit/Sources/ClawdbotProtocol/GatewayModels.swift index 7d8189248..aefbdb572 100644 --- a/apps/shared/ClawdbotKit/Sources/ClawdbotProtocol/GatewayModels.swift +++ b/apps/shared/ClawdbotKit/Sources/ClawdbotProtocol/GatewayModels.swift @@ -552,6 +552,44 @@ public struct AgentParams: Codable, Sendable { } } +public struct AgentIdentityParams: Codable, Sendable { + public let agentid: String? + public let sessionkey: String? + + public init( + agentid: String?, + sessionkey: String? + ) { + self.agentid = agentid + self.sessionkey = sessionkey + } + private enum CodingKeys: String, CodingKey { + case agentid = "agentId" + case sessionkey = "sessionKey" + } +} + +public struct AgentIdentityResult: Codable, Sendable { + public let agentid: String + public let name: String? + public let avatar: String? + + public init( + agentid: String, + name: String?, + avatar: String? + ) { + self.agentid = agentid + self.name = name + self.avatar = avatar + } + private enum CodingKeys: String, CodingKey { + case agentid = "agentId" + case name + case avatar + } +} + public struct AgentWaitParams: Codable, Sendable { public let runid: String public let timeoutms: Int? @@ -1447,17 +1485,21 @@ public struct WebLoginWaitParams: Codable, Sendable { public struct AgentSummary: Codable, Sendable { public let id: String public let name: String? + public let identity: [String: AnyCodable]? public init( id: String, - name: String? + name: String?, + identity: [String: AnyCodable]? ) { self.id = id self.name = name + self.identity = identity } private enum CodingKeys: String, CodingKey { case id case name + case identity } } diff --git a/src/agents/identity-avatar.test.ts b/src/agents/identity-avatar.test.ts index 3d5d42611..d2b9449e8 100644 --- a/src/agents/identity-avatar.test.ts +++ b/src/agents/identity-avatar.test.ts @@ -31,11 +31,12 @@ describe("resolveAgentAvatar", () => { }, }; - const expectedPath = await fs.realpath(avatarPath); + const workspaceReal = await fs.realpath(workspace); const resolved = resolveAgentAvatar(cfg, "main"); expect(resolved.kind).toBe("local"); if (resolved.kind === "local") { - expect(resolved.filePath).toBe(expectedPath); + const resolvedReal = await fs.realpath(resolved.filePath); + expect(path.relative(workspaceReal, resolvedReal)).toBe(path.join("avatars", "main.png")); } }); @@ -83,11 +84,12 @@ describe("resolveAgentAvatar", () => { }, }; - const expectedPath = await fs.realpath(avatarPath); + const workspaceReal = await fs.realpath(workspace); const resolved = resolveAgentAvatar(cfg, "main"); expect(resolved.kind).toBe("local"); if (resolved.kind === "local") { - expect(resolved.filePath).toBe(expectedPath); + const resolvedReal = await fs.realpath(resolved.filePath); + expect(path.relative(workspaceReal, resolvedReal)).toBe(path.join("avatars", "fallback.png")); } });