Skip to content

Commit 262b643

Browse files
committed
fix(gateway,ui): regenerate protocol bindings, fix prod types and lint for file editor (#104698)
1 parent 96adb04 commit 262b643

4 files changed

Lines changed: 62 additions & 6 deletions

File tree

‎apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift‎

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3034,6 +3034,7 @@ public struct SessionFileEntry: Codable, Sendable {
30343034
public let size: Int?
30353035
public let updatedatms: Int?
30363036
public let content: String?
3037+
public let hash: String?
30373038

30383039
public init(
30393040
path: String,
@@ -3043,7 +3044,8 @@ public struct SessionFileEntry: Codable, Sendable {
30433044
missing: Bool,
30443045
size: Int? = nil,
30453046
updatedatms: Int? = nil,
3046-
content: String? = nil)
3047+
content: String? = nil,
3048+
hash: String? = nil)
30473049
{
30483050
self.path = path
30493051
self.workspacepath = workspacepath
@@ -3053,6 +3055,7 @@ public struct SessionFileEntry: Codable, Sendable {
30533055
self.size = size
30543056
self.updatedatms = updatedatms
30553057
self.content = content
3058+
self.hash = hash
30563059
}
30573060

30583061
private enum CodingKeys: String, CodingKey {
@@ -3064,6 +3067,7 @@ public struct SessionFileEntry: Codable, Sendable {
30643067
case size
30653068
case updatedatms = "updatedAtMs"
30663069
case content
3070+
case hash
30673071
}
30683072
}
30693073

@@ -3163,6 +3167,58 @@ public struct SessionsFilesGetResult: Codable, Sendable {
31633167
}
31643168
}
31653169

3170+
public struct SessionsFilesSetParams: Codable, Sendable {
3171+
public let sessionkey: String
3172+
public let path: String
3173+
public let agentid: String?
3174+
public let content: String
3175+
public let expectedhash: String
3176+
3177+
public init(
3178+
sessionkey: String,
3179+
path: String,
3180+
agentid: String? = nil,
3181+
content: String,
3182+
expectedhash: String)
3183+
{
3184+
self.sessionkey = sessionkey
3185+
self.path = path
3186+
self.agentid = agentid
3187+
self.content = content
3188+
self.expectedhash = expectedhash
3189+
}
3190+
3191+
private enum CodingKeys: String, CodingKey {
3192+
case sessionkey = "sessionKey"
3193+
case path
3194+
case agentid = "agentId"
3195+
case content
3196+
case expectedhash = "expectedHash"
3197+
}
3198+
}
3199+
3200+
public struct SessionsFilesSetResult: Codable, Sendable {
3201+
public let sessionkey: String
3202+
public let root: String?
3203+
public let file: SessionFileEntry
3204+
3205+
public init(
3206+
sessionkey: String,
3207+
root: String? = nil,
3208+
file: SessionFileEntry)
3209+
{
3210+
self.sessionkey = sessionkey
3211+
self.root = root
3212+
self.file = file
3213+
}
3214+
3215+
private enum CodingKeys: String, CodingKey {
3216+
case sessionkey = "sessionKey"
3217+
case root
3218+
case file
3219+
}
3220+
}
3221+
31663222
public struct SessionDiffFile: Codable, Sendable {
31673223
public let path: String
31683224
public let oldpath: String?

‎src/gateway/server-methods/sessions-files.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ function loadSessionFileRoot(params: { sessionKey: string; agentId?: string }) {
360360

361361
function resolveSessionFileCandidates(params: {
362362
root: string;
363-
fileRoot?: string;
363+
fileRoot: string | undefined;
364364
filePath: string;
365365
}): string[] {
366366
return [

‎ui/src/pages/chat/components/chat-sidebar.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ class ChatDetailPanel extends OpenClawLightDomElement {
10241024
this.fileSaving = true;
10251025
this.fileSaveNotice = null;
10261026
void this.saveFileContent(content, editor.getContent(), this.fileHash, version)
1027-
.catch((error) => {
1027+
.catch((error: unknown) => {
10281028
if (version === this.fileOperationVersion) {
10291029
this.fileSaveNotice = {
10301030
kind: "error",
@@ -1071,7 +1071,7 @@ class ChatDetailPanel extends OpenClawLightDomElement {
10711071
this.visibleContent = readOnly;
10721072
}
10731073
})
1074-
.catch((error) => {
1074+
.catch((error: unknown) => {
10751075
if (version === this.fileOperationVersion) {
10761076
this.fileSaveNotice = {
10771077
kind: "error",
@@ -1114,7 +1114,7 @@ class ChatDetailPanel extends OpenClawLightDomElement {
11141114
}
11151115
await this.saveFileContent(content, localContent, latest.hash, version);
11161116
})
1117-
.catch((error) => {
1117+
.catch((error: unknown) => {
11181118
if (version === this.fileOperationVersion) {
11191119
this.fileSaveNotice = {
11201120
kind: "error",

‎ui/src/pages/chat/components/file-editor-view.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export async function createFileEditorView(params: {
172172
}
173173
const decorations = [...lineNumbersToDecorate]
174174
.filter((line) => Number.isInteger(line) && line >= 1 && line <= view.state.doc.lines)
175-
.sort((a, b) => a - b)
175+
.toSorted((a, b) => a - b)
176176
.map((line) => {
177177
const classes: string[] = [];
178178
if (line === targetLine) {

0 commit comments

Comments
 (0)