瀏覽代碼

chore: generate

opencode-agent[bot] 2 月之前
父節點
當前提交
b000256f57

+ 1 - 7
packages/opencode/src/server/routes/instance/httpapi/server.ts

@@ -1,12 +1,6 @@
 import { Config as EffectConfig, Context, Effect, Layer } from "effect"
 import { HttpApiBuilder, OpenApi } from "effect/unstable/httpapi"
-import {
-  HttpClient,
-  HttpMiddleware,
-  HttpRouter,
-  HttpServer,
-  HttpServerResponse,
-} from "effect/unstable/http"
+import { HttpClient, HttpMiddleware, HttpRouter, HttpServer, HttpServerResponse } from "effect/unstable/http"
 import * as Socket from "effect/unstable/socket/Socket"
 import { FSUtil } from "@opencode-ai/core/fs-util"
 import * as Observability from "@opencode-ai/core/observability"

+ 81 - 81
packages/sdk/js/src/v2/gen/types.gen.ts

@@ -77,18 +77,18 @@ export type Event =
   | EventCommandExecuted
   | EventProjectDirectoriesUpdated
   | EventProjectUpdated
-  | EventVcsBranchUpdated
+  | EventSessionStatus
+  | EventSessionIdle
   | EventQuestionAsked
   | EventQuestionReplied
   | EventQuestionRejected
-  | EventSessionStatus
-  | EventSessionIdle
   | EventSessionCompacted
-  | EventWorktreeReady
-  | EventWorktreeFailed
+  | EventVcsBranchUpdated
   | EventWorkspaceReady
   | EventWorkspaceFailed
   | EventWorkspaceStatus
+  | EventWorktreeReady
+  | EventWorktreeFailed
   | EventServerConnected
   | EventGlobalDisposed
   | EventServerInstanceDisposed
@@ -667,6 +667,28 @@ export type Todo = {
   priority: string
 }
 
+export type SessionStatus =
+  | {
+      type: "idle"
+    }
+  | {
+      type: "retry"
+      attempt: number
+      message: string
+      action?: {
+        reason: string
+        provider: string
+        title: string
+        message: string
+        label: string
+        link?: string
+      }
+      next: number
+    }
+  | {
+      type: "busy"
+    }
+
 export type QuestionOption = {
   /**
    * Display text (1-5 words, concise)
@@ -702,28 +724,6 @@ export type QuestionTool = {
 
 export type QuestionAnswer = Array<string>
 
-export type SessionStatus =
-  | {
-      type: "idle"
-    }
-  | {
-      type: "retry"
-      attempt: number
-      message: string
-      action?: {
-        reason: string
-        provider: string
-        title: string
-        message: string
-        label: string
-        link?: string
-      }
-      next: number
-    }
-  | {
-      type: "busy"
-    }
-
 export type GlobalEvent = {
   directory: string
   project?: string
@@ -1515,9 +1515,17 @@ export type GlobalEvent = {
       }
     | {
         id: string
-        type: "vcs.branch.updated"
+        type: "session.status"
         properties: {
-          branch?: string
+          sessionID: string
+          status: SessionStatus
+        }
+      }
+    | {
+        id: string
+        type: "session.idle"
+        properties: {
+          sessionID: string
         }
       }
     | {
@@ -1552,61 +1560,53 @@ export type GlobalEvent = {
       }
     | {
         id: string
-        type: "session.status"
-        properties: {
-          sessionID: string
-          status: SessionStatus
-        }
-      }
-    | {
-        id: string
-        type: "session.idle"
+        type: "session.compacted"
         properties: {
           sessionID: string
         }
       }
     | {
         id: string
-        type: "session.compacted"
+        type: "vcs.branch.updated"
         properties: {
-          sessionID: string
+          branch?: string
         }
       }
     | {
         id: string
-        type: "worktree.ready"
+        type: "workspace.ready"
         properties: {
           name: string
-          branch?: string
         }
       }
     | {
         id: string
-        type: "worktree.failed"
+        type: "workspace.failed"
         properties: {
           message: string
         }
       }
     | {
         id: string
-        type: "workspace.ready"
+        type: "workspace.status"
         properties: {
-          name: string
+          workspaceID: string
+          status: "connected" | "connecting" | "disconnected" | "error"
         }
       }
     | {
         id: string
-        type: "workspace.failed"
+        type: "worktree.ready"
         properties: {
-          message: string
+          name: string
+          branch?: string
         }
       }
     | {
         id: string
-        type: "workspace.status"
+        type: "worktree.failed"
         properties: {
-          workspaceID: string
-          status: "connected" | "connecting" | "disconnected" | "error"
+          message: string
         }
       }
     | {
@@ -5123,11 +5123,20 @@ export type EventProjectUpdated = {
   }
 }
 
-export type EventVcsBranchUpdated = {
+export type EventSessionStatus = {
   id: string
-  type: "vcs.branch.updated"
+  type: "session.status"
   properties: {
-    branch?: string
+    sessionID: string
+    status: SessionStatus
+  }
+}
+
+export type EventSessionIdle = {
+  id: string
+  type: "session.idle"
+  properties: {
+    sessionID: string
   }
 }
 
@@ -5164,23 +5173,6 @@ export type EventQuestionRejected = {
   }
 }
 
-export type EventSessionStatus = {
-  id: string
-  type: "session.status"
-  properties: {
-    sessionID: string
-    status: SessionStatus
-  }
-}
-
-export type EventSessionIdle = {
-  id: string
-  type: "session.idle"
-  properties: {
-    sessionID: string
-  }
-}
-
 export type EventSessionCompacted = {
   id: string
   type: "session.compacted"
@@ -5189,23 +5181,14 @@ export type EventSessionCompacted = {
   }
 }
 
-export type EventWorktreeReady = {
+export type EventVcsBranchUpdated = {
   id: string
-  type: "worktree.ready"
+  type: "vcs.branch.updated"
   properties: {
-    name: string
     branch?: string
   }
 }
 
-export type EventWorktreeFailed = {
-  id: string
-  type: "worktree.failed"
-  properties: {
-    message: string
-  }
-}
-
 export type EventWorkspaceReady = {
   id: string
   type: "workspace.ready"
@@ -5231,6 +5214,23 @@ export type EventWorkspaceStatus = {
   }
 }
 
+export type EventWorktreeReady = {
+  id: string
+  type: "worktree.ready"
+  properties: {
+    name: string
+    branch?: string
+  }
+}
+
+export type EventWorktreeFailed = {
+  id: string
+  type: "worktree.failed"
+  properties: {
+    message: string
+  }
+}
+
 export type EventServerConnected = {
   id: string
   type: "server.connected"

+ 200 - 200
packages/sdk/openapi.json

@@ -13788,7 +13788,10 @@
             "$ref": "#/components/schemas/EventProjectUpdated"
           },
           {
-            "$ref": "#/components/schemas/EventVcsBranchUpdated"
+            "$ref": "#/components/schemas/EventSessionStatus"
+          },
+          {
+            "$ref": "#/components/schemas/EventSessionIdle"
           },
           {
             "$ref": "#/components/schemas/EventQuestionAsked"
@@ -13799,20 +13802,11 @@
           {
             "$ref": "#/components/schemas/EventQuestionRejected"
           },
-          {
-            "$ref": "#/components/schemas/EventSessionStatus"
-          },
-          {
-            "$ref": "#/components/schemas/EventSessionIdle"
-          },
           {
             "$ref": "#/components/schemas/EventSessionCompacted"
           },
           {
-            "$ref": "#/components/schemas/EventWorktreeReady"
-          },
-          {
-            "$ref": "#/components/schemas/EventWorktreeFailed"
+            "$ref": "#/components/schemas/EventVcsBranchUpdated"
           },
           {
             "$ref": "#/components/schemas/EventWorkspaceReady"
@@ -13823,6 +13817,12 @@
           {
             "$ref": "#/components/schemas/EventWorkspaceStatus"
           },
+          {
+            "$ref": "#/components/schemas/EventWorktreeReady"
+          },
+          {
+            "$ref": "#/components/schemas/EventWorktreeFailed"
+          },
           {
             "$ref": "#/components/schemas/EventServerConnected"
           },
@@ -15565,69 +15565,6 @@
         "required": ["content", "status", "priority"],
         "additionalProperties": false
       },
-      "QuestionOption": {
-        "type": "object",
-        "properties": {
-          "label": {
-            "type": "string",
-            "description": "Display text (1-5 words, concise)"
-          },
-          "description": {
-            "type": "string",
-            "description": "Explanation of choice"
-          }
-        },
-        "required": ["label", "description"],
-        "additionalProperties": false
-      },
-      "QuestionInfo": {
-        "type": "object",
-        "properties": {
-          "question": {
-            "type": "string",
-            "description": "Complete question"
-          },
-          "header": {
-            "type": "string",
-            "description": "Very short label (max 30 chars)"
-          },
-          "options": {
-            "type": "array",
-            "items": {
-              "$ref": "#/components/schemas/QuestionOption"
-            },
-            "description": "Available choices"
-          },
-          "multiple": {
-            "type": "boolean"
-          },
-          "custom": {
-            "type": "boolean"
-          }
-        },
-        "required": ["question", "header", "options"],
-        "additionalProperties": false
-      },
-      "QuestionTool": {
-        "type": "object",
-        "properties": {
-          "messageID": {
-            "type": "string",
-            "pattern": "^msg"
-          },
-          "callID": {
-            "type": "string"
-          }
-        },
-        "required": ["messageID", "callID"],
-        "additionalProperties": false
-      },
-      "QuestionAnswer": {
-        "type": "array",
-        "items": {
-          "type": "string"
-        }
-      },
       "SessionStatus": {
         "anyOf": [
           {
@@ -15701,6 +15638,69 @@
           }
         ]
       },
+      "QuestionOption": {
+        "type": "object",
+        "properties": {
+          "label": {
+            "type": "string",
+            "description": "Display text (1-5 words, concise)"
+          },
+          "description": {
+            "type": "string",
+            "description": "Explanation of choice"
+          }
+        },
+        "required": ["label", "description"],
+        "additionalProperties": false
+      },
+      "QuestionInfo": {
+        "type": "object",
+        "properties": {
+          "question": {
+            "type": "string",
+            "description": "Complete question"
+          },
+          "header": {
+            "type": "string",
+            "description": "Very short label (max 30 chars)"
+          },
+          "options": {
+            "type": "array",
+            "items": {
+              "$ref": "#/components/schemas/QuestionOption"
+            },
+            "description": "Available choices"
+          },
+          "multiple": {
+            "type": "boolean"
+          },
+          "custom": {
+            "type": "boolean"
+          }
+        },
+        "required": ["question", "header", "options"],
+        "additionalProperties": false
+      },
+      "QuestionTool": {
+        "type": "object",
+        "properties": {
+          "messageID": {
+            "type": "string",
+            "pattern": "^msg"
+          },
+          "callID": {
+            "type": "string"
+          }
+        },
+        "required": ["messageID", "callID"],
+        "additionalProperties": false
+      },
+      "QuestionAnswer": {
+        "type": "array",
+        "items": {
+          "type": "string"
+        }
+      },
       "GlobalEvent": {
         "type": "object",
         "properties": {
@@ -18384,15 +18384,46 @@
                   },
                   "type": {
                     "type": "string",
-                    "enum": ["vcs.branch.updated"]
+                    "enum": ["session.status"]
                   },
                   "properties": {
                     "type": "object",
                     "properties": {
-                      "branch": {
-                        "type": "string"
+                      "sessionID": {
+                        "type": "string",
+                        "pattern": "^ses"
+                      },
+                      "status": {
+                        "$ref": "#/components/schemas/SessionStatus"
+                      }
+                    },
+                    "required": ["sessionID", "status"],
+                    "additionalProperties": false
+                  }
+                },
+                "required": ["id", "type", "properties"],
+                "additionalProperties": false
+              },
+              {
+                "type": "object",
+                "properties": {
+                  "id": {
+                    "type": "string",
+                    "pattern": "^evt_"
+                  },
+                  "type": {
+                    "type": "string",
+                    "enum": ["session.idle"]
+                  },
+                  "properties": {
+                    "type": "object",
+                    "properties": {
+                      "sessionID": {
+                        "type": "string",
+                        "pattern": "^ses"
                       }
                     },
+                    "required": ["sessionID"],
                     "additionalProperties": false
                   }
                 },
@@ -18514,36 +18545,7 @@
                   },
                   "type": {
                     "type": "string",
-                    "enum": ["session.status"]
-                  },
-                  "properties": {
-                    "type": "object",
-                    "properties": {
-                      "sessionID": {
-                        "type": "string",
-                        "pattern": "^ses"
-                      },
-                      "status": {
-                        "$ref": "#/components/schemas/SessionStatus"
-                      }
-                    },
-                    "required": ["sessionID", "status"],
-                    "additionalProperties": false
-                  }
-                },
-                "required": ["id", "type", "properties"],
-                "additionalProperties": false
-              },
-              {
-                "type": "object",
-                "properties": {
-                  "id": {
-                    "type": "string",
-                    "pattern": "^evt_"
-                  },
-                  "type": {
-                    "type": "string",
-                    "enum": ["session.idle"]
+                    "enum": ["session.compacted"]
                   },
                   "properties": {
                     "type": "object",
@@ -18569,17 +18571,15 @@
                   },
                   "type": {
                     "type": "string",
-                    "enum": ["session.compacted"]
+                    "enum": ["vcs.branch.updated"]
                   },
                   "properties": {
                     "type": "object",
                     "properties": {
-                      "sessionID": {
-                        "type": "string",
-                        "pattern": "^ses"
+                      "branch": {
+                        "type": "string"
                       }
                     },
-                    "required": ["sessionID"],
                     "additionalProperties": false
                   }
                 },
@@ -18595,16 +18595,13 @@
                   },
                   "type": {
                     "type": "string",
-                    "enum": ["worktree.ready"]
+                    "enum": ["workspace.ready"]
                   },
                   "properties": {
                     "type": "object",
                     "properties": {
                       "name": {
                         "type": "string"
-                      },
-                      "branch": {
-                        "type": "string"
                       }
                     },
                     "required": ["name"],
@@ -18623,7 +18620,7 @@
                   },
                   "type": {
                     "type": "string",
-                    "enum": ["worktree.failed"]
+                    "enum": ["workspace.failed"]
                   },
                   "properties": {
                     "type": "object",
@@ -18648,16 +18645,21 @@
                   },
                   "type": {
                     "type": "string",
-                    "enum": ["workspace.ready"]
+                    "enum": ["workspace.status"]
                   },
                   "properties": {
                     "type": "object",
                     "properties": {
-                      "name": {
-                        "type": "string"
+                      "workspaceID": {
+                        "type": "string",
+                        "pattern": "^wrk"
+                      },
+                      "status": {
+                        "type": "string",
+                        "enum": ["connected", "connecting", "disconnected", "error"]
                       }
                     },
-                    "required": ["name"],
+                    "required": ["workspaceID", "status"],
                     "additionalProperties": false
                   }
                 },
@@ -18673,16 +18675,19 @@
                   },
                   "type": {
                     "type": "string",
-                    "enum": ["workspace.failed"]
+                    "enum": ["worktree.ready"]
                   },
                   "properties": {
                     "type": "object",
                     "properties": {
-                      "message": {
+                      "name": {
+                        "type": "string"
+                      },
+                      "branch": {
                         "type": "string"
                       }
                     },
-                    "required": ["message"],
+                    "required": ["name"],
                     "additionalProperties": false
                   }
                 },
@@ -18698,21 +18703,16 @@
                   },
                   "type": {
                     "type": "string",
-                    "enum": ["workspace.status"]
+                    "enum": ["worktree.failed"]
                   },
                   "properties": {
                     "type": "object",
                     "properties": {
-                      "workspaceID": {
-                        "type": "string",
-                        "pattern": "^wrk"
-                      },
-                      "status": {
-                        "type": "string",
-                        "enum": ["connected", "connecting", "disconnected", "error"]
+                      "message": {
+                        "type": "string"
                       }
                     },
-                    "required": ["workspaceID", "status"],
+                    "required": ["message"],
                     "additionalProperties": false
                   }
                 },
@@ -29793,7 +29793,7 @@
         "required": ["id", "type", "properties"],
         "additionalProperties": false
       },
-      "EventVcsBranchUpdated": {
+      "EventSessionStatus": {
         "type": "object",
         "properties": {
           "id": {
@@ -29802,15 +29802,46 @@
           },
           "type": {
             "type": "string",
-            "enum": ["vcs.branch.updated"]
+            "enum": ["session.status"]
           },
           "properties": {
             "type": "object",
             "properties": {
-              "branch": {
-                "type": "string"
+              "sessionID": {
+                "type": "string",
+                "pattern": "^ses"
+              },
+              "status": {
+                "$ref": "#/components/schemas/SessionStatus"
+              }
+            },
+            "required": ["sessionID", "status"],
+            "additionalProperties": false
+          }
+        },
+        "required": ["id", "type", "properties"],
+        "additionalProperties": false
+      },
+      "EventSessionIdle": {
+        "type": "object",
+        "properties": {
+          "id": {
+            "type": "string",
+            "pattern": "^evt_"
+          },
+          "type": {
+            "type": "string",
+            "enum": ["session.idle"]
+          },
+          "properties": {
+            "type": "object",
+            "properties": {
+              "sessionID": {
+                "type": "string",
+                "pattern": "^ses"
               }
             },
+            "required": ["sessionID"],
             "additionalProperties": false
           }
         },
@@ -29923,36 +29954,7 @@
         "required": ["id", "type", "properties"],
         "additionalProperties": false
       },
-      "EventSessionStatus": {
-        "type": "object",
-        "properties": {
-          "id": {
-            "type": "string",
-            "pattern": "^evt_"
-          },
-          "type": {
-            "type": "string",
-            "enum": ["session.status"]
-          },
-          "properties": {
-            "type": "object",
-            "properties": {
-              "sessionID": {
-                "type": "string",
-                "pattern": "^ses"
-              },
-              "status": {
-                "$ref": "#/components/schemas/SessionStatus"
-              }
-            },
-            "required": ["sessionID", "status"],
-            "additionalProperties": false
-          }
-        },
-        "required": ["id", "type", "properties"],
-        "additionalProperties": false
-      },
-      "EventSessionIdle": {
+      "EventSessionCompacted": {
         "type": "object",
         "properties": {
           "id": {
@@ -29961,7 +29963,7 @@
           },
           "type": {
             "type": "string",
-            "enum": ["session.idle"]
+            "enum": ["session.compacted"]
           },
           "properties": {
             "type": "object",
@@ -29978,7 +29980,7 @@
         "required": ["id", "type", "properties"],
         "additionalProperties": false
       },
-      "EventSessionCompacted": {
+      "EventVcsBranchUpdated": {
         "type": "object",
         "properties": {
           "id": {
@@ -29987,24 +29989,22 @@
           },
           "type": {
             "type": "string",
-            "enum": ["session.compacted"]
+            "enum": ["vcs.branch.updated"]
           },
           "properties": {
             "type": "object",
             "properties": {
-              "sessionID": {
-                "type": "string",
-                "pattern": "^ses"
+              "branch": {
+                "type": "string"
               }
             },
-            "required": ["sessionID"],
             "additionalProperties": false
           }
         },
         "required": ["id", "type", "properties"],
         "additionalProperties": false
       },
-      "EventWorktreeReady": {
+      "EventWorkspaceReady": {
         "type": "object",
         "properties": {
           "id": {
@@ -30013,16 +30013,13 @@
           },
           "type": {
             "type": "string",
-            "enum": ["worktree.ready"]
+            "enum": ["workspace.ready"]
           },
           "properties": {
             "type": "object",
             "properties": {
               "name": {
                 "type": "string"
-              },
-              "branch": {
-                "type": "string"
               }
             },
             "required": ["name"],
@@ -30032,7 +30029,7 @@
         "required": ["id", "type", "properties"],
         "additionalProperties": false
       },
-      "EventWorktreeFailed": {
+      "EventWorkspaceFailed": {
         "type": "object",
         "properties": {
           "id": {
@@ -30041,7 +30038,7 @@
           },
           "type": {
             "type": "string",
-            "enum": ["worktree.failed"]
+            "enum": ["workspace.failed"]
           },
           "properties": {
             "type": "object",
@@ -30057,7 +30054,7 @@
         "required": ["id", "type", "properties"],
         "additionalProperties": false
       },
-      "EventWorkspaceReady": {
+      "EventWorkspaceStatus": {
         "type": "object",
         "properties": {
           "id": {
@@ -30066,23 +30063,28 @@
           },
           "type": {
             "type": "string",
-            "enum": ["workspace.ready"]
+            "enum": ["workspace.status"]
           },
           "properties": {
             "type": "object",
             "properties": {
-              "name": {
-                "type": "string"
+              "workspaceID": {
+                "type": "string",
+                "pattern": "^wrk"
+              },
+              "status": {
+                "type": "string",
+                "enum": ["connected", "connecting", "disconnected", "error"]
               }
             },
-            "required": ["name"],
+            "required": ["workspaceID", "status"],
             "additionalProperties": false
           }
         },
         "required": ["id", "type", "properties"],
         "additionalProperties": false
       },
-      "EventWorkspaceFailed": {
+      "EventWorktreeReady": {
         "type": "object",
         "properties": {
           "id": {
@@ -30091,23 +30093,26 @@
           },
           "type": {
             "type": "string",
-            "enum": ["workspace.failed"]
+            "enum": ["worktree.ready"]
           },
           "properties": {
             "type": "object",
             "properties": {
-              "message": {
+              "name": {
+                "type": "string"
+              },
+              "branch": {
                 "type": "string"
               }
             },
-            "required": ["message"],
+            "required": ["name"],
             "additionalProperties": false
           }
         },
         "required": ["id", "type", "properties"],
         "additionalProperties": false
       },
-      "EventWorkspaceStatus": {
+      "EventWorktreeFailed": {
         "type": "object",
         "properties": {
           "id": {
@@ -30116,21 +30121,16 @@
           },
           "type": {
             "type": "string",
-            "enum": ["workspace.status"]
+            "enum": ["worktree.failed"]
           },
           "properties": {
             "type": "object",
             "properties": {
-              "workspaceID": {
-                "type": "string",
-                "pattern": "^wrk"
-              },
-              "status": {
-                "type": "string",
-                "enum": ["connected", "connecting", "disconnected", "error"]
+              "message": {
+                "type": "string"
               }
             },
-            "required": ["workspaceID", "status"],
+            "required": ["message"],
             "additionalProperties": false
           }
         },