Răsfoiți Sursa

chore: generate

opencode-agent[bot] 3 luni în urmă
părinte
comite
8f57a2a462

+ 3 - 4
packages/opencode/src/control-plane/dev/README.md

@@ -1,4 +1,3 @@
-
 This is a plugin to simulate a remote environment locally. Add this to `.opencode/opencode.jsonc`:
 
 ```json
@@ -15,6 +14,6 @@ With the plugin install, you can now run OpenCode and create a `debug` workspace
 
 How this works:
 
-* The workspace server needs to know the workspace id and port to run. It waits for this information to be written to a file and starts the server when the data is written.
-* The debug plugin writes this information in the `create` call to the workspace. So create a `debug` workspace will always kick off a new external server.
-* The server script watches for file changes, so whenver you create a new `debug` workspace it will restart with the new information. This means that there is only ever one working `debug` workspace at a time; when you create a new one all previous sessions will show that it can't connect because previous debug workspaces do not exist.
+- The workspace server needs to know the workspace id and port to run. It waits for this information to be written to a file and starts the server when the data is written.
+- The debug plugin writes this information in the `create` call to the workspace. So create a `debug` workspace will always kick off a new external server.
+- The server script watches for file changes, so whenver you create a new `debug` workspace it will restart with the new information. This means that there is only ever one working `debug` workspace at a time; when you create a new one all previous sessions will show that it can't connect because previous debug workspaces do not exist.

+ 7 - 4
packages/opencode/src/control-plane/workspace.ts

@@ -101,10 +101,13 @@ export class SyncHttpError extends Schema.TaggedErrorClass<SyncHttpError>()("Wor
   body: Schema.optional(Schema.String),
 }) {}
 
-export class WorkspaceNotFoundError extends Schema.TaggedErrorClass<WorkspaceNotFoundError>()("WorkspaceNotFoundError", {
-  message: Schema.String,
-  workspaceID: WorkspaceID,
-}) {}
+export class WorkspaceNotFoundError extends Schema.TaggedErrorClass<WorkspaceNotFoundError>()(
+  "WorkspaceNotFoundError",
+  {
+    message: Schema.String,
+    workspaceID: WorkspaceID,
+  },
+) {}
 
 export class SessionEventsNotFoundError extends Schema.TaggedErrorClass<SessionEventsNotFoundError>()(
   "WorkspaceSessionEventsNotFoundError",

Fișier diff suprimat deoarece este prea mare
+ 476 - 379
packages/opencode/test/control-plane/workspace.test.ts


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

@@ -452,6 +452,38 @@ export type EventVcsBranchUpdated = {
   }
 }
 
+export type EventWorkspaceReady = {
+  type: "workspace.ready"
+  properties: {
+    name: string
+  }
+}
+
+export type EventWorkspaceFailed = {
+  type: "workspace.failed"
+  properties: {
+    message: string
+  }
+}
+
+export type EventWorkspaceRestore = {
+  type: "workspace.restore"
+  properties: {
+    workspaceID: string
+    sessionID: string
+    total: number
+    step: number
+  }
+}
+
+export type EventWorkspaceStatus = {
+  type: "workspace.status"
+  properties: {
+    workspaceID: string
+    status: "connected" | "connecting" | "disconnected" | "error"
+  }
+}
+
 export type EventWorktreeReady = {
   type: "worktree.ready"
   properties: {
@@ -506,38 +538,6 @@ export type EventPtyDeleted = {
   }
 }
 
-export type EventWorkspaceReady = {
-  type: "workspace.ready"
-  properties: {
-    name: string
-  }
-}
-
-export type EventWorkspaceFailed = {
-  type: "workspace.failed"
-  properties: {
-    message: string
-  }
-}
-
-export type EventWorkspaceRestore = {
-  type: "workspace.restore"
-  properties: {
-    workspaceID: string
-    sessionID: string
-    total: number
-    step: number
-  }
-}
-
-export type EventWorkspaceStatus = {
-  type: "workspace.status"
-  properties: {
-    workspaceID: string
-    status: "connected" | "connecting" | "disconnected" | "error"
-  }
-}
-
 export type OutputFormatText = {
   type: "text"
 }
@@ -1141,16 +1141,16 @@ export type GlobalEvent = {
     | EventMcpBrowserOpenFailed
     | EventCommandExecuted
     | EventVcsBranchUpdated
+    | EventWorkspaceReady
+    | EventWorkspaceFailed
+    | EventWorkspaceRestore
+    | EventWorkspaceStatus
     | EventWorktreeReady
     | EventWorktreeFailed
     | EventPtyCreated
     | EventPtyUpdated
     | EventPtyExited
     | EventPtyDeleted
-    | EventWorkspaceReady
-    | EventWorkspaceFailed
-    | EventWorkspaceRestore
-    | EventWorkspaceStatus
     | EventMessageUpdated
     | EventMessageRemoved
     | EventMessagePartUpdated
@@ -2084,16 +2084,16 @@ export type Event =
   | EventMcpBrowserOpenFailed
   | EventCommandExecuted
   | EventVcsBranchUpdated
+  | EventWorkspaceReady
+  | EventWorkspaceFailed
+  | EventWorkspaceRestore
+  | EventWorkspaceStatus
   | EventWorktreeReady
   | EventWorktreeFailed
   | EventPtyCreated
   | EventPtyUpdated
   | EventPtyExited
   | EventPtyDeleted
-  | EventWorkspaceReady
-  | EventWorkspaceFailed
-  | EventWorkspaceRestore
-  | EventWorkspaceStatus
   | EventMessageUpdated
   | EventMessageRemoved
   | EventMessagePartUpdated

+ 116 - 116
packages/sdk/openapi.json

@@ -8743,6 +8743,102 @@
         },
         "required": ["type", "properties"]
       },
+      "Event.workspace.ready": {
+        "type": "object",
+        "properties": {
+          "type": {
+            "type": "string",
+            "const": "workspace.ready"
+          },
+          "properties": {
+            "type": "object",
+            "properties": {
+              "name": {
+                "type": "string"
+              }
+            },
+            "required": ["name"]
+          }
+        },
+        "required": ["type", "properties"]
+      },
+      "Event.workspace.failed": {
+        "type": "object",
+        "properties": {
+          "type": {
+            "type": "string",
+            "const": "workspace.failed"
+          },
+          "properties": {
+            "type": "object",
+            "properties": {
+              "message": {
+                "type": "string"
+              }
+            },
+            "required": ["message"]
+          }
+        },
+        "required": ["type", "properties"]
+      },
+      "Event.workspace.restore": {
+        "type": "object",
+        "properties": {
+          "type": {
+            "type": "string",
+            "const": "workspace.restore"
+          },
+          "properties": {
+            "type": "object",
+            "properties": {
+              "workspaceID": {
+                "type": "string",
+                "pattern": "^wrk.*"
+              },
+              "sessionID": {
+                "type": "string",
+                "pattern": "^ses.*"
+              },
+              "total": {
+                "type": "integer",
+                "minimum": 0,
+                "maximum": 9007199254740991
+              },
+              "step": {
+                "type": "integer",
+                "minimum": 0,
+                "maximum": 9007199254740991
+              }
+            },
+            "required": ["workspaceID", "sessionID", "total", "step"]
+          }
+        },
+        "required": ["type", "properties"]
+      },
+      "Event.workspace.status": {
+        "type": "object",
+        "properties": {
+          "type": {
+            "type": "string",
+            "const": "workspace.status"
+          },
+          "properties": {
+            "type": "object",
+            "properties": {
+              "workspaceID": {
+                "type": "string",
+                "pattern": "^wrk.*"
+              },
+              "status": {
+                "type": "string",
+                "enum": ["connected", "connecting", "disconnected", "error"]
+              }
+            },
+            "required": ["workspaceID", "status"]
+          }
+        },
+        "required": ["type", "properties"]
+      },
       "Event.worktree.ready": {
         "type": "object",
         "properties": {
@@ -8901,102 +8997,6 @@
         },
         "required": ["type", "properties"]
       },
-      "Event.workspace.ready": {
-        "type": "object",
-        "properties": {
-          "type": {
-            "type": "string",
-            "const": "workspace.ready"
-          },
-          "properties": {
-            "type": "object",
-            "properties": {
-              "name": {
-                "type": "string"
-              }
-            },
-            "required": ["name"]
-          }
-        },
-        "required": ["type", "properties"]
-      },
-      "Event.workspace.failed": {
-        "type": "object",
-        "properties": {
-          "type": {
-            "type": "string",
-            "const": "workspace.failed"
-          },
-          "properties": {
-            "type": "object",
-            "properties": {
-              "message": {
-                "type": "string"
-              }
-            },
-            "required": ["message"]
-          }
-        },
-        "required": ["type", "properties"]
-      },
-      "Event.workspace.restore": {
-        "type": "object",
-        "properties": {
-          "type": {
-            "type": "string",
-            "const": "workspace.restore"
-          },
-          "properties": {
-            "type": "object",
-            "properties": {
-              "workspaceID": {
-                "type": "string",
-                "pattern": "^wrk.*"
-              },
-              "sessionID": {
-                "type": "string",
-                "pattern": "^ses.*"
-              },
-              "total": {
-                "type": "integer",
-                "minimum": 0,
-                "maximum": 9007199254740991
-              },
-              "step": {
-                "type": "integer",
-                "minimum": 0,
-                "maximum": 9007199254740991
-              }
-            },
-            "required": ["workspaceID", "sessionID", "total", "step"]
-          }
-        },
-        "required": ["type", "properties"]
-      },
-      "Event.workspace.status": {
-        "type": "object",
-        "properties": {
-          "type": {
-            "type": "string",
-            "const": "workspace.status"
-          },
-          "properties": {
-            "type": "object",
-            "properties": {
-              "workspaceID": {
-                "type": "string",
-                "pattern": "^wrk.*"
-              },
-              "status": {
-                "type": "string",
-                "enum": ["connected", "connecting", "disconnected", "error"]
-              }
-            },
-            "required": ["workspaceID", "status"]
-          }
-        },
-        "required": ["type", "properties"]
-      },
       "OutputFormatText": {
         "type": "object",
         "properties": {
@@ -11048,34 +11048,34 @@
                 "$ref": "#/components/schemas/Event.vcs.branch.updated"
               },
               {
-                "$ref": "#/components/schemas/Event.worktree.ready"
+                "$ref": "#/components/schemas/Event.workspace.ready"
               },
               {
-                "$ref": "#/components/schemas/Event.worktree.failed"
+                "$ref": "#/components/schemas/Event.workspace.failed"
               },
               {
-                "$ref": "#/components/schemas/Event.pty.created"
+                "$ref": "#/components/schemas/Event.workspace.restore"
               },
               {
-                "$ref": "#/components/schemas/Event.pty.updated"
+                "$ref": "#/components/schemas/Event.workspace.status"
               },
               {
-                "$ref": "#/components/schemas/Event.pty.exited"
+                "$ref": "#/components/schemas/Event.worktree.ready"
               },
               {
-                "$ref": "#/components/schemas/Event.pty.deleted"
+                "$ref": "#/components/schemas/Event.worktree.failed"
               },
               {
-                "$ref": "#/components/schemas/Event.workspace.ready"
+                "$ref": "#/components/schemas/Event.pty.created"
               },
               {
-                "$ref": "#/components/schemas/Event.workspace.failed"
+                "$ref": "#/components/schemas/Event.pty.updated"
               },
               {
-                "$ref": "#/components/schemas/Event.workspace.restore"
+                "$ref": "#/components/schemas/Event.pty.exited"
               },
               {
-                "$ref": "#/components/schemas/Event.workspace.status"
+                "$ref": "#/components/schemas/Event.pty.deleted"
               },
               {
                 "$ref": "#/components/schemas/Event.message.updated"
@@ -13341,34 +13341,34 @@
             "$ref": "#/components/schemas/Event.vcs.branch.updated"
           },
           {
-            "$ref": "#/components/schemas/Event.worktree.ready"
+            "$ref": "#/components/schemas/Event.workspace.ready"
           },
           {
-            "$ref": "#/components/schemas/Event.worktree.failed"
+            "$ref": "#/components/schemas/Event.workspace.failed"
           },
           {
-            "$ref": "#/components/schemas/Event.pty.created"
+            "$ref": "#/components/schemas/Event.workspace.restore"
           },
           {
-            "$ref": "#/components/schemas/Event.pty.updated"
+            "$ref": "#/components/schemas/Event.workspace.status"
           },
           {
-            "$ref": "#/components/schemas/Event.pty.exited"
+            "$ref": "#/components/schemas/Event.worktree.ready"
           },
           {
-            "$ref": "#/components/schemas/Event.pty.deleted"
+            "$ref": "#/components/schemas/Event.worktree.failed"
           },
           {
-            "$ref": "#/components/schemas/Event.workspace.ready"
+            "$ref": "#/components/schemas/Event.pty.created"
           },
           {
-            "$ref": "#/components/schemas/Event.workspace.failed"
+            "$ref": "#/components/schemas/Event.pty.updated"
           },
           {
-            "$ref": "#/components/schemas/Event.workspace.restore"
+            "$ref": "#/components/schemas/Event.pty.exited"
           },
           {
-            "$ref": "#/components/schemas/Event.workspace.status"
+            "$ref": "#/components/schemas/Event.pty.deleted"
           },
           {
             "$ref": "#/components/schemas/Event.message.updated"

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff