From ddd0fcdc834ca4ef7ea789176d2360337b15ec3b Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 7 Apr 2026 03:42:55 +0100 Subject: [PATCH] fix(ci): refresh extension mocks and protocol models --- .../OpenClawProtocol/GatewayModels.swift | 230 ++++++++++++++++++ .../OpenClawProtocol/GatewayModels.swift | 230 ++++++++++++++++++ extensions/feishu/src/send.test.ts | 10 +- extensions/msteams/src/send.test.ts | 10 +- 4 files changed, 474 insertions(+), 6 deletions(-) diff --git a/apps/macos/Sources/OpenClawProtocol/GatewayModels.swift b/apps/macos/Sources/OpenClawProtocol/GatewayModels.swift index 9d295c2b0ef..ea9c50f5b9e 100644 --- a/apps/macos/Sources/OpenClawProtocol/GatewayModels.swift +++ b/apps/macos/Sources/OpenClawProtocol/GatewayModels.swift @@ -1327,6 +1327,236 @@ public struct SessionsResolveParams: Codable, Sendable { } } +public struct SessionCompactionCheckpoint: Codable, Sendable { + public let checkpointid: String + public let sessionkey: String + public let sessionid: String + public let createdat: Int + public let reason: AnyCodable + public let tokensbefore: Int? + public let tokensafter: Int? + public let summary: String? + public let firstkeptentryid: String? + public let precompaction: [String: AnyCodable] + public let postcompaction: [String: AnyCodable] + + public init( + checkpointid: String, + sessionkey: String, + sessionid: String, + createdat: Int, + reason: AnyCodable, + tokensbefore: Int?, + tokensafter: Int?, + summary: String?, + firstkeptentryid: String?, + precompaction: [String: AnyCodable], + postcompaction: [String: AnyCodable]) + { + self.checkpointid = checkpointid + self.sessionkey = sessionkey + self.sessionid = sessionid + self.createdat = createdat + self.reason = reason + self.tokensbefore = tokensbefore + self.tokensafter = tokensafter + self.summary = summary + self.firstkeptentryid = firstkeptentryid + self.precompaction = precompaction + self.postcompaction = postcompaction + } + + private enum CodingKeys: String, CodingKey { + case checkpointid = "checkpointId" + case sessionkey = "sessionKey" + case sessionid = "sessionId" + case createdat = "createdAt" + case reason + case tokensbefore = "tokensBefore" + case tokensafter = "tokensAfter" + case summary + case firstkeptentryid = "firstKeptEntryId" + case precompaction = "preCompaction" + case postcompaction = "postCompaction" + } +} + +public struct SessionsCompactionListParams: Codable, Sendable { + public let key: String + + public init( + key: String) + { + self.key = key + } + + private enum CodingKeys: String, CodingKey { + case key + } +} + +public struct SessionsCompactionGetParams: Codable, Sendable { + public let key: String + public let checkpointid: String + + public init( + key: String, + checkpointid: String) + { + self.key = key + self.checkpointid = checkpointid + } + + private enum CodingKeys: String, CodingKey { + case key + case checkpointid = "checkpointId" + } +} + +public struct SessionsCompactionBranchParams: Codable, Sendable { + public let key: String + public let checkpointid: String + + public init( + key: String, + checkpointid: String) + { + self.key = key + self.checkpointid = checkpointid + } + + private enum CodingKeys: String, CodingKey { + case key + case checkpointid = "checkpointId" + } +} + +public struct SessionsCompactionRestoreParams: Codable, Sendable { + public let key: String + public let checkpointid: String + + public init( + key: String, + checkpointid: String) + { + self.key = key + self.checkpointid = checkpointid + } + + private enum CodingKeys: String, CodingKey { + case key + case checkpointid = "checkpointId" + } +} + +public struct SessionsCompactionListResult: Codable, Sendable { + public let ok: Bool + public let key: String + public let checkpoints: [SessionCompactionCheckpoint] + + public init( + ok: Bool, + key: String, + checkpoints: [SessionCompactionCheckpoint]) + { + self.ok = ok + self.key = key + self.checkpoints = checkpoints + } + + private enum CodingKeys: String, CodingKey { + case ok + case key + case checkpoints + } +} + +public struct SessionsCompactionGetResult: Codable, Sendable { + public let ok: Bool + public let key: String + public let checkpoint: SessionCompactionCheckpoint + + public init( + ok: Bool, + key: String, + checkpoint: SessionCompactionCheckpoint) + { + self.ok = ok + self.key = key + self.checkpoint = checkpoint + } + + private enum CodingKeys: String, CodingKey { + case ok + case key + case checkpoint + } +} + +public struct SessionsCompactionBranchResult: Codable, Sendable { + public let ok: Bool + public let sourcekey: String + public let key: String + public let sessionid: String + public let checkpoint: SessionCompactionCheckpoint + public let entry: [String: AnyCodable] + + public init( + ok: Bool, + sourcekey: String, + key: String, + sessionid: String, + checkpoint: SessionCompactionCheckpoint, + entry: [String: AnyCodable]) + { + self.ok = ok + self.sourcekey = sourcekey + self.key = key + self.sessionid = sessionid + self.checkpoint = checkpoint + self.entry = entry + } + + private enum CodingKeys: String, CodingKey { + case ok + case sourcekey = "sourceKey" + case key + case sessionid = "sessionId" + case checkpoint + case entry + } +} + +public struct SessionsCompactionRestoreResult: Codable, Sendable { + public let ok: Bool + public let key: String + public let sessionid: String + public let checkpoint: SessionCompactionCheckpoint + public let entry: [String: AnyCodable] + + public init( + ok: Bool, + key: String, + sessionid: String, + checkpoint: SessionCompactionCheckpoint, + entry: [String: AnyCodable]) + { + self.ok = ok + self.key = key + self.sessionid = sessionid + self.checkpoint = checkpoint + self.entry = entry + } + + private enum CodingKeys: String, CodingKey { + case ok + case key + case sessionid = "sessionId" + case checkpoint + case entry + } +} + public struct SessionsCreateParams: Codable, Sendable { public let key: String? public let agentid: String? diff --git a/apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift b/apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift index 9d295c2b0ef..ea9c50f5b9e 100644 --- a/apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift +++ b/apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift @@ -1327,6 +1327,236 @@ public struct SessionsResolveParams: Codable, Sendable { } } +public struct SessionCompactionCheckpoint: Codable, Sendable { + public let checkpointid: String + public let sessionkey: String + public let sessionid: String + public let createdat: Int + public let reason: AnyCodable + public let tokensbefore: Int? + public let tokensafter: Int? + public let summary: String? + public let firstkeptentryid: String? + public let precompaction: [String: AnyCodable] + public let postcompaction: [String: AnyCodable] + + public init( + checkpointid: String, + sessionkey: String, + sessionid: String, + createdat: Int, + reason: AnyCodable, + tokensbefore: Int?, + tokensafter: Int?, + summary: String?, + firstkeptentryid: String?, + precompaction: [String: AnyCodable], + postcompaction: [String: AnyCodable]) + { + self.checkpointid = checkpointid + self.sessionkey = sessionkey + self.sessionid = sessionid + self.createdat = createdat + self.reason = reason + self.tokensbefore = tokensbefore + self.tokensafter = tokensafter + self.summary = summary + self.firstkeptentryid = firstkeptentryid + self.precompaction = precompaction + self.postcompaction = postcompaction + } + + private enum CodingKeys: String, CodingKey { + case checkpointid = "checkpointId" + case sessionkey = "sessionKey" + case sessionid = "sessionId" + case createdat = "createdAt" + case reason + case tokensbefore = "tokensBefore" + case tokensafter = "tokensAfter" + case summary + case firstkeptentryid = "firstKeptEntryId" + case precompaction = "preCompaction" + case postcompaction = "postCompaction" + } +} + +public struct SessionsCompactionListParams: Codable, Sendable { + public let key: String + + public init( + key: String) + { + self.key = key + } + + private enum CodingKeys: String, CodingKey { + case key + } +} + +public struct SessionsCompactionGetParams: Codable, Sendable { + public let key: String + public let checkpointid: String + + public init( + key: String, + checkpointid: String) + { + self.key = key + self.checkpointid = checkpointid + } + + private enum CodingKeys: String, CodingKey { + case key + case checkpointid = "checkpointId" + } +} + +public struct SessionsCompactionBranchParams: Codable, Sendable { + public let key: String + public let checkpointid: String + + public init( + key: String, + checkpointid: String) + { + self.key = key + self.checkpointid = checkpointid + } + + private enum CodingKeys: String, CodingKey { + case key + case checkpointid = "checkpointId" + } +} + +public struct SessionsCompactionRestoreParams: Codable, Sendable { + public let key: String + public let checkpointid: String + + public init( + key: String, + checkpointid: String) + { + self.key = key + self.checkpointid = checkpointid + } + + private enum CodingKeys: String, CodingKey { + case key + case checkpointid = "checkpointId" + } +} + +public struct SessionsCompactionListResult: Codable, Sendable { + public let ok: Bool + public let key: String + public let checkpoints: [SessionCompactionCheckpoint] + + public init( + ok: Bool, + key: String, + checkpoints: [SessionCompactionCheckpoint]) + { + self.ok = ok + self.key = key + self.checkpoints = checkpoints + } + + private enum CodingKeys: String, CodingKey { + case ok + case key + case checkpoints + } +} + +public struct SessionsCompactionGetResult: Codable, Sendable { + public let ok: Bool + public let key: String + public let checkpoint: SessionCompactionCheckpoint + + public init( + ok: Bool, + key: String, + checkpoint: SessionCompactionCheckpoint) + { + self.ok = ok + self.key = key + self.checkpoint = checkpoint + } + + private enum CodingKeys: String, CodingKey { + case ok + case key + case checkpoint + } +} + +public struct SessionsCompactionBranchResult: Codable, Sendable { + public let ok: Bool + public let sourcekey: String + public let key: String + public let sessionid: String + public let checkpoint: SessionCompactionCheckpoint + public let entry: [String: AnyCodable] + + public init( + ok: Bool, + sourcekey: String, + key: String, + sessionid: String, + checkpoint: SessionCompactionCheckpoint, + entry: [String: AnyCodable]) + { + self.ok = ok + self.sourcekey = sourcekey + self.key = key + self.sessionid = sessionid + self.checkpoint = checkpoint + self.entry = entry + } + + private enum CodingKeys: String, CodingKey { + case ok + case sourcekey = "sourceKey" + case key + case sessionid = "sessionId" + case checkpoint + case entry + } +} + +public struct SessionsCompactionRestoreResult: Codable, Sendable { + public let ok: Bool + public let key: String + public let sessionid: String + public let checkpoint: SessionCompactionCheckpoint + public let entry: [String: AnyCodable] + + public init( + ok: Bool, + key: String, + sessionid: String, + checkpoint: SessionCompactionCheckpoint, + entry: [String: AnyCodable]) + { + self.ok = ok + self.key = key + self.sessionid = sessionid + self.checkpoint = checkpoint + self.entry = entry + } + + private enum CodingKeys: String, CodingKey { + case ok + case key + case sessionid = "sessionId" + case checkpoint + case entry + } +} + public struct SessionsCreateParams: Codable, Sendable { public let key: String? public let agentid: String? diff --git a/extensions/feishu/src/send.test.ts b/extensions/feishu/src/send.test.ts index 6f7052c388f..bc461e7d824 100644 --- a/extensions/feishu/src/send.test.ts +++ b/extensions/feishu/src/send.test.ts @@ -28,9 +28,13 @@ vi.mock("openclaw/plugin-sdk/config-runtime", () => ({ resolveMarkdownTableMode: mockResolveMarkdownTableMode, })); -vi.mock("openclaw/plugin-sdk/text-runtime", () => ({ - convertMarkdownTables: mockConvertMarkdownTables, -})); +vi.mock("openclaw/plugin-sdk/text-runtime", async (importOriginal) => { + const actual = await importOriginal(); + return { + ...actual, + convertMarkdownTables: mockConvertMarkdownTables, + }; +}); vi.mock("./client.js", () => ({ createFeishuClient: mockCreateFeishuClient, diff --git a/extensions/msteams/src/send.test.ts b/extensions/msteams/src/send.test.ts index 3b2e213edbd..af9d38ac411 100644 --- a/extensions/msteams/src/send.test.ts +++ b/extensions/msteams/src/send.test.ts @@ -26,9 +26,13 @@ vi.mock("openclaw/plugin-sdk/config-runtime", () => ({ resolveMarkdownTableMode: mockState.resolveMarkdownTableMode, })); -vi.mock("openclaw/plugin-sdk/text-runtime", () => ({ - convertMarkdownTables: mockState.convertMarkdownTables, -})); +vi.mock("openclaw/plugin-sdk/text-runtime", async (importOriginal) => { + const actual = await importOriginal(); + return { + ...actual, + convertMarkdownTables: mockState.convertMarkdownTables, + }; +}); vi.mock("./send-context.js", () => ({ resolveMSTeamsSendContext: mockState.resolveMSTeamsSendContext,