Browse Source

chore: generate

GitHub Action 1 month ago
parent
commit
99794c25b0
1 changed files with 321 additions and 279 deletions
  1. 321 279
      packages/sdk/openapi.json

+ 321 - 279
packages/sdk/openapi.json

@@ -1,4 +1,3 @@
-<<<<<<< HEAD
 {
 {
   "openapi": "3.1.1",
   "openapi": "3.1.1",
   "info": {
   "info": {
@@ -968,6 +967,9 @@
                   },
                   },
                   "title": {
                   "title": {
                     "type": "string"
                     "type": "string"
+                  },
+                  "permission": {
+                    "$ref": "#/components/schemas/PermissionRuleset"
                   }
                   }
                 }
                 }
               }
               }
@@ -2038,6 +2040,7 @@
                     "type": "boolean"
                     "type": "boolean"
                   },
                   },
                   "tools": {
                   "tools": {
+                    "description": "@deprecated tools and permissions have been merged, you can set permissions on the session itself now",
                     "type": "object",
                     "type": "object",
                     "propertyNames": {
                     "propertyNames": {
                       "type": "string"
                       "type": "string"
@@ -2413,6 +2416,7 @@
                     "type": "boolean"
                     "type": "boolean"
                   },
                   },
                   "tools": {
                   "tools": {
+                    "description": "@deprecated tools and permissions have been merged, you can set permissions on the session itself now",
                     "type": "object",
                     "type": "object",
                     "propertyNames": {
                     "propertyNames": {
                       "type": "string"
                       "type": "string"
@@ -2832,6 +2836,7 @@
           }
           }
         ],
         ],
         "summary": "Respond to permission",
         "summary": "Respond to permission",
+        "deprecated": true,
         "description": "Approve or deny a permission request from the AI assistant.",
         "description": "Approve or deny a permission request from the AI assistant.",
         "responses": {
         "responses": {
           "200": {
           "200": {
@@ -2889,6 +2894,84 @@
         ]
         ]
       }
       }
     },
     },
+    "/permission/{requestID}/reply": {
+      "post": {
+        "operationId": "permission.reply",
+        "parameters": [
+          {
+            "in": "query",
+            "name": "directory",
+            "schema": {
+              "type": "string"
+            }
+          },
+          {
+            "in": "path",
+            "name": "requestID",
+            "schema": {
+              "type": "string"
+            },
+            "required": true
+          }
+        ],
+        "summary": "Respond to permission request",
+        "description": "Approve or deny a permission request from the AI assistant.",
+        "responses": {
+          "200": {
+            "description": "Permission processed successfully",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "type": "boolean"
+                }
+              }
+            }
+          },
+          "400": {
+            "description": "Bad request",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/BadRequestError"
+                }
+              }
+            }
+          },
+          "404": {
+            "description": "Not found",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/NotFoundError"
+                }
+              }
+            }
+          }
+        },
+        "requestBody": {
+          "content": {
+            "application/json": {
+              "schema": {
+                "type": "object",
+                "properties": {
+                  "reply": {
+                    "type": "string",
+                    "enum": ["once", "always", "reject"]
+                  }
+                },
+                "required": ["reply"]
+              }
+            }
+          }
+        },
+        "x-codeSamples": [
+          {
+            "lang": "js",
+            "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.permission.reply({\n  ...\n})"
+          }
+        ]
+      }
+    },
     "/permission": {
     "/permission": {
       "get": {
       "get": {
         "operationId": "permission.list",
         "operationId": "permission.list",
@@ -2911,7 +2994,7 @@
                 "schema": {
                 "schema": {
                   "type": "array",
                   "type": "array",
                   "items": {
                   "items": {
-                    "$ref": "#/components/schemas/Permission"
+                    "$ref": "#/components/schemas/PermissionRequest"
                   }
                   }
                 }
                 }
               }
               }
@@ -6363,39 +6446,25 @@
         },
         },
         "required": ["type", "properties"]
         "required": ["type", "properties"]
       },
       },
-      "Permission": {
+      "PermissionRequest": {
         "type": "object",
         "type": "object",
         "properties": {
         "properties": {
           "id": {
           "id": {
-            "type": "string"
-          },
-          "type": {
-            "type": "string"
-          },
-          "pattern": {
-            "anyOf": [
-              {
-                "type": "string"
-              },
-              {
-                "type": "array",
-                "items": {
-                  "type": "string"
-                }
-              }
-            ]
+            "type": "string",
+            "pattern": "^per.*"
           },
           },
           "sessionID": {
           "sessionID": {
-            "type": "string"
-          },
-          "messageID": {
-            "type": "string"
+            "type": "string",
+            "pattern": "^ses.*"
           },
           },
-          "callID": {
+          "permission": {
             "type": "string"
             "type": "string"
           },
           },
-          "title": {
-            "type": "string"
+          "patterns": {
+            "type": "array",
+            "items": {
+              "type": "string"
+            }
           },
           },
           "metadata": {
           "metadata": {
             "type": "object",
             "type": "object",
@@ -6404,103 +6473,46 @@
             },
             },
             "additionalProperties": {}
             "additionalProperties": {}
           },
           },
-          "time": {
-            "type": "object",
-            "properties": {
-              "created": {
-                "type": "number"
-              }
-            },
-            "required": ["created"]
-          }
-        },
-        "required": ["id", "type", "sessionID", "messageID", "title", "metadata", "time"]
-      },
-      "Event.permission.updated": {
-        "type": "object",
-        "properties": {
-          "type": {
-            "type": "string",
-            "const": "permission.updated"
-          },
-          "properties": {
-            "$ref": "#/components/schemas/Permission"
-          }
-        },
-        "required": ["type", "properties"]
-      },
-      "Event.permission.replied": {
-        "type": "object",
-        "properties": {
-          "type": {
-            "type": "string",
-            "const": "permission.replied"
+          "always": {
+            "type": "array",
+            "items": {
+              "type": "string"
+            }
           },
           },
-          "properties": {
+          "tool": {
             "type": "object",
             "type": "object",
             "properties": {
             "properties": {
-              "sessionID": {
-                "type": "string"
-              },
-              "permissionID": {
+              "messageID": {
                 "type": "string"
                 "type": "string"
               },
               },
-              "response": {
+              "callID": {
                 "type": "string"
                 "type": "string"
               }
               }
             },
             },
-            "required": ["sessionID", "permissionID", "response"]
+            "required": ["messageID", "callID"]
           }
           }
         },
         },
-        "required": ["type", "properties"]
+        "required": ["id", "sessionID", "permission", "patterns", "metadata", "always"]
       },
       },
-      "Event.file.edited": {
+      "Event.permission.asked": {
         "type": "object",
         "type": "object",
         "properties": {
         "properties": {
           "type": {
           "type": {
             "type": "string",
             "type": "string",
-            "const": "file.edited"
+            "const": "permission.asked"
           },
           },
           "properties": {
           "properties": {
-            "type": "object",
-            "properties": {
-              "file": {
-                "type": "string"
-              }
-            },
-            "required": ["file"]
+            "$ref": "#/components/schemas/PermissionRequest"
           }
           }
         },
         },
         "required": ["type", "properties"]
         "required": ["type", "properties"]
       },
       },
-      "Todo": {
-        "type": "object",
-        "properties": {
-          "content": {
-            "description": "Brief description of the task",
-            "type": "string"
-          },
-          "status": {
-            "description": "Current status of the task: pending, in_progress, completed, cancelled",
-            "type": "string"
-          },
-          "priority": {
-            "description": "Priority level of the task: high, medium, low",
-            "type": "string"
-          },
-          "id": {
-            "description": "Unique identifier for the todo item",
-            "type": "string"
-          }
-        },
-        "required": ["content", "status", "priority", "id"]
-      },
-      "Event.todo.updated": {
+      "Event.permission.replied": {
         "type": "object",
         "type": "object",
         "properties": {
         "properties": {
           "type": {
           "type": {
             "type": "string",
             "type": "string",
-            "const": "todo.updated"
+            "const": "permission.replied"
           },
           },
           "properties": {
           "properties": {
             "type": "object",
             "type": "object",
@@ -6508,14 +6520,15 @@
               "sessionID": {
               "sessionID": {
                 "type": "string"
                 "type": "string"
               },
               },
-              "todos": {
-                "type": "array",
-                "items": {
-                  "$ref": "#/components/schemas/Todo"
-                }
+              "requestID": {
+                "type": "string"
+              },
+              "reply": {
+                "type": "string",
+                "enum": ["once", "always", "reject"]
               }
               }
             },
             },
-            "required": ["sessionID", "todos"]
+            "required": ["sessionID", "requestID", "reply"]
           }
           }
         },
         },
         "required": ["type", "properties"]
         "required": ["type", "properties"]
@@ -6623,6 +6636,72 @@
         },
         },
         "required": ["type", "properties"]
         "required": ["type", "properties"]
       },
       },
+      "Event.file.edited": {
+        "type": "object",
+        "properties": {
+          "type": {
+            "type": "string",
+            "const": "file.edited"
+          },
+          "properties": {
+            "type": "object",
+            "properties": {
+              "file": {
+                "type": "string"
+              }
+            },
+            "required": ["file"]
+          }
+        },
+        "required": ["type", "properties"]
+      },
+      "Todo": {
+        "type": "object",
+        "properties": {
+          "content": {
+            "description": "Brief description of the task",
+            "type": "string"
+          },
+          "status": {
+            "description": "Current status of the task: pending, in_progress, completed, cancelled",
+            "type": "string"
+          },
+          "priority": {
+            "description": "Priority level of the task: high, medium, low",
+            "type": "string"
+          },
+          "id": {
+            "description": "Unique identifier for the todo item",
+            "type": "string"
+          }
+        },
+        "required": ["content", "status", "priority", "id"]
+      },
+      "Event.todo.updated": {
+        "type": "object",
+        "properties": {
+          "type": {
+            "type": "string",
+            "const": "todo.updated"
+          },
+          "properties": {
+            "type": "object",
+            "properties": {
+              "sessionID": {
+                "type": "string"
+              },
+              "todos": {
+                "type": "array",
+                "items": {
+                  "$ref": "#/components/schemas/Todo"
+                }
+              }
+            },
+            "required": ["sessionID", "todos"]
+          }
+        },
+        "required": ["type", "properties"]
+      },
       "Event.tui.prompt.append": {
       "Event.tui.prompt.append": {
         "type": "object",
         "type": "object",
         "properties": {
         "properties": {
@@ -6764,6 +6843,31 @@
         },
         },
         "required": ["type", "properties"]
         "required": ["type", "properties"]
       },
       },
+      "PermissionAction": {
+        "type": "string",
+        "enum": ["allow", "deny", "ask"]
+      },
+      "PermissionRule": {
+        "type": "object",
+        "properties": {
+          "permission": {
+            "type": "string"
+          },
+          "pattern": {
+            "type": "string"
+          },
+          "action": {
+            "$ref": "#/components/schemas/PermissionAction"
+          }
+        },
+        "required": ["permission", "pattern", "action"]
+      },
+      "PermissionRuleset": {
+        "type": "array",
+        "items": {
+          "$ref": "#/components/schemas/PermissionRule"
+        }
+      },
       "Session": {
       "Session": {
         "type": "object",
         "type": "object",
         "properties": {
         "properties": {
@@ -6835,6 +6939,9 @@
             },
             },
             "required": ["created", "updated"]
             "required": ["created", "updated"]
           },
           },
+          "permission": {
+            "$ref": "#/components/schemas/PermissionRuleset"
+          },
           "revert": {
           "revert": {
             "type": "object",
             "type": "object",
             "properties": {
             "properties": {
@@ -7202,25 +7309,25 @@
             "$ref": "#/components/schemas/Event.message.part.removed"
             "$ref": "#/components/schemas/Event.message.part.removed"
           },
           },
           {
           {
-            "$ref": "#/components/schemas/Event.permission.updated"
+            "$ref": "#/components/schemas/Event.permission.asked"
           },
           },
           {
           {
             "$ref": "#/components/schemas/Event.permission.replied"
             "$ref": "#/components/schemas/Event.permission.replied"
           },
           },
           {
           {
-            "$ref": "#/components/schemas/Event.file.edited"
+            "$ref": "#/components/schemas/Event.session.status"
           },
           },
           {
           {
-            "$ref": "#/components/schemas/Event.todo.updated"
+            "$ref": "#/components/schemas/Event.session.idle"
           },
           },
           {
           {
-            "$ref": "#/components/schemas/Event.session.status"
+            "$ref": "#/components/schemas/Event.session.compacted"
           },
           },
           {
           {
-            "$ref": "#/components/schemas/Event.session.idle"
+            "$ref": "#/components/schemas/Event.file.edited"
           },
           },
           {
           {
-            "$ref": "#/components/schemas/Event.session.compacted"
+            "$ref": "#/components/schemas/Event.todo.updated"
           },
           },
           {
           {
             "$ref": "#/components/schemas/Event.tui.prompt.append"
             "$ref": "#/components/schemas/Event.tui.prompt.append"
@@ -7805,6 +7912,89 @@
         },
         },
         "additionalProperties": false
         "additionalProperties": false
       },
       },
+      "PermissionActionConfig": {
+        "type": "string",
+        "enum": ["ask", "allow", "deny"]
+      },
+      "PermissionObjectConfig": {
+        "type": "object",
+        "propertyNames": {
+          "type": "string"
+        },
+        "additionalProperties": {
+          "$ref": "#/components/schemas/PermissionActionConfig"
+        }
+      },
+      "PermissionRuleConfig": {
+        "anyOf": [
+          {
+            "$ref": "#/components/schemas/PermissionActionConfig"
+          },
+          {
+            "$ref": "#/components/schemas/PermissionObjectConfig"
+          }
+        ]
+      },
+      "PermissionConfig": {
+        "anyOf": [
+          {
+            "type": "object",
+            "properties": {
+              "read": {
+                "$ref": "#/components/schemas/PermissionRuleConfig"
+              },
+              "edit": {
+                "$ref": "#/components/schemas/PermissionRuleConfig"
+              },
+              "glob": {
+                "$ref": "#/components/schemas/PermissionRuleConfig"
+              },
+              "grep": {
+                "$ref": "#/components/schemas/PermissionRuleConfig"
+              },
+              "list": {
+                "$ref": "#/components/schemas/PermissionRuleConfig"
+              },
+              "bash": {
+                "$ref": "#/components/schemas/PermissionRuleConfig"
+              },
+              "task": {
+                "$ref": "#/components/schemas/PermissionRuleConfig"
+              },
+              "external_directory": {
+                "$ref": "#/components/schemas/PermissionRuleConfig"
+              },
+              "todowrite": {
+                "$ref": "#/components/schemas/PermissionActionConfig"
+              },
+              "todoread": {
+                "$ref": "#/components/schemas/PermissionActionConfig"
+              },
+              "webfetch": {
+                "$ref": "#/components/schemas/PermissionActionConfig"
+              },
+              "websearch": {
+                "$ref": "#/components/schemas/PermissionActionConfig"
+              },
+              "codesearch": {
+                "$ref": "#/components/schemas/PermissionActionConfig"
+              },
+              "lsp": {
+                "$ref": "#/components/schemas/PermissionRuleConfig"
+              },
+              "doom_loop": {
+                "$ref": "#/components/schemas/PermissionActionConfig"
+              }
+            },
+            "additionalProperties": {
+              "$ref": "#/components/schemas/PermissionRuleConfig"
+            }
+          },
+          {
+            "$ref": "#/components/schemas/PermissionActionConfig"
+          }
+        ]
+      },
       "AgentConfig": {
       "AgentConfig": {
         "type": "object",
         "type": "object",
         "properties": {
         "properties": {
@@ -7821,6 +8011,7 @@
             "type": "string"
             "type": "string"
           },
           },
           "tools": {
           "tools": {
+            "description": "@deprecated Use 'permission' field instead",
             "type": "object",
             "type": "object",
             "propertyNames": {
             "propertyNames": {
               "type": "string"
               "type": "string"
@@ -7840,73 +8031,32 @@
             "type": "string",
             "type": "string",
             "enum": ["subagent", "primary", "all"]
             "enum": ["subagent", "primary", "all"]
           },
           },
+          "options": {
+            "type": "object",
+            "propertyNames": {
+              "type": "string"
+            },
+            "additionalProperties": {}
+          },
           "color": {
           "color": {
             "description": "Hex color code for the agent (e.g., #FF5733)",
             "description": "Hex color code for the agent (e.g., #FF5733)",
             "type": "string",
             "type": "string",
             "pattern": "^#[0-9a-fA-F]{6}$"
             "pattern": "^#[0-9a-fA-F]{6}$"
           },
           },
-          "maxSteps": {
+          "steps": {
             "description": "Maximum number of agentic iterations before forcing text-only response",
             "description": "Maximum number of agentic iterations before forcing text-only response",
             "type": "integer",
             "type": "integer",
             "exclusiveMinimum": 0,
             "exclusiveMinimum": 0,
             "maximum": 9007199254740991
             "maximum": 9007199254740991
           },
           },
+          "maxSteps": {
+            "description": "@deprecated Use 'steps' field instead.",
+            "type": "integer",
+            "exclusiveMinimum": 0,
+            "maximum": 9007199254740991
+          },
           "permission": {
           "permission": {
-            "type": "object",
-            "properties": {
-              "edit": {
-                "type": "string",
-                "enum": ["ask", "allow", "deny"]
-              },
-              "bash": {
-                "anyOf": [
-                  {
-                    "type": "string",
-                    "enum": ["ask", "allow", "deny"]
-                  },
-                  {
-                    "type": "object",
-                    "propertyNames": {
-                      "type": "string"
-                    },
-                    "additionalProperties": {
-                      "type": "string",
-                      "enum": ["ask", "allow", "deny"]
-                    }
-                  }
-                ]
-              },
-              "skill": {
-                "anyOf": [
-                  {
-                    "type": "string",
-                    "enum": ["ask", "allow", "deny"]
-                  },
-                  {
-                    "type": "object",
-                    "propertyNames": {
-                      "type": "string"
-                    },
-                    "additionalProperties": {
-                      "type": "string",
-                      "enum": ["ask", "allow", "deny"]
-                    }
-                  }
-                ]
-              },
-              "webfetch": {
-                "type": "string",
-                "enum": ["ask", "allow", "deny"]
-              },
-              "doom_loop": {
-                "type": "string",
-                "enum": ["ask", "allow", "deny"]
-              },
-              "external_directory": {
-                "type": "string",
-                "enum": ["ask", "allow", "deny"]
-              }
-            }
+            "$ref": "#/components/schemas/PermissionConfig"
           }
           }
         },
         },
         "additionalProperties": {}
         "additionalProperties": {}
@@ -8601,61 +8751,7 @@
             "$ref": "#/components/schemas/LayoutConfig"
             "$ref": "#/components/schemas/LayoutConfig"
           },
           },
           "permission": {
           "permission": {
-            "type": "object",
-            "properties": {
-              "edit": {
-                "type": "string",
-                "enum": ["ask", "allow", "deny"]
-              },
-              "bash": {
-                "anyOf": [
-                  {
-                    "type": "string",
-                    "enum": ["ask", "allow", "deny"]
-                  },
-                  {
-                    "type": "object",
-                    "propertyNames": {
-                      "type": "string"
-                    },
-                    "additionalProperties": {
-                      "type": "string",
-                      "enum": ["ask", "allow", "deny"]
-                    }
-                  }
-                ]
-              },
-              "skill": {
-                "anyOf": [
-                  {
-                    "type": "string",
-                    "enum": ["ask", "allow", "deny"]
-                  },
-                  {
-                    "type": "object",
-                    "propertyNames": {
-                      "type": "string"
-                    },
-                    "additionalProperties": {
-                      "type": "string",
-                      "enum": ["ask", "allow", "deny"]
-                    }
-                  }
-                ]
-              },
-              "webfetch": {
-                "type": "string",
-                "enum": ["ask", "allow", "deny"]
-              },
-              "doom_loop": {
-                "type": "string",
-                "enum": ["ask", "allow", "deny"]
-              },
-              "external_directory": {
-                "type": "string",
-                "enum": ["ask", "allow", "deny"]
-              }
-            }
+            "$ref": "#/components/schemas/PermissionConfig"
           },
           },
           "tools": {
           "tools": {
             "type": "object",
             "type": "object",
@@ -9471,9 +9567,6 @@
           "hidden": {
           "hidden": {
             "type": "boolean"
             "type": "boolean"
           },
           },
-          "default": {
-            "type": "boolean"
-          },
           "topP": {
           "topP": {
             "type": "number"
             "type": "number"
           },
           },
@@ -9484,46 +9577,7 @@
             "type": "string"
             "type": "string"
           },
           },
           "permission": {
           "permission": {
-            "type": "object",
-            "properties": {
-              "edit": {
-                "type": "string",
-                "enum": ["ask", "allow", "deny"]
-              },
-              "bash": {
-                "type": "object",
-                "propertyNames": {
-                  "type": "string"
-                },
-                "additionalProperties": {
-                  "type": "string",
-                  "enum": ["ask", "allow", "deny"]
-                }
-              },
-              "skill": {
-                "type": "object",
-                "propertyNames": {
-                  "type": "string"
-                },
-                "additionalProperties": {
-                  "type": "string",
-                  "enum": ["ask", "allow", "deny"]
-                }
-              },
-              "webfetch": {
-                "type": "string",
-                "enum": ["ask", "allow", "deny"]
-              },
-              "doom_loop": {
-                "type": "string",
-                "enum": ["ask", "allow", "deny"]
-              },
-              "external_directory": {
-                "type": "string",
-                "enum": ["ask", "allow", "deny"]
-              }
-            },
-            "required": ["edit", "bash", "skill"]
+            "$ref": "#/components/schemas/PermissionRuleset"
           },
           },
           "model": {
           "model": {
             "type": "object",
             "type": "object",
@@ -9540,15 +9594,6 @@
           "prompt": {
           "prompt": {
             "type": "string"
             "type": "string"
           },
           },
-          "tools": {
-            "type": "object",
-            "propertyNames": {
-              "type": "string"
-            },
-            "additionalProperties": {
-              "type": "boolean"
-            }
-          },
           "options": {
           "options": {
             "type": "object",
             "type": "object",
             "propertyNames": {
             "propertyNames": {
@@ -9556,13 +9601,13 @@
             },
             },
             "additionalProperties": {}
             "additionalProperties": {}
           },
           },
-          "maxSteps": {
+          "steps": {
             "type": "integer",
             "type": "integer",
             "exclusiveMinimum": 0,
             "exclusiveMinimum": 0,
             "maximum": 9007199254740991
             "maximum": 9007199254740991
           }
           }
         },
         },
-        "required": ["name", "mode", "permission", "tools", "options"]
+        "required": ["name", "mode", "permission", "options"]
       },
       },
       "MCPStatusConnected": {
       "MCPStatusConnected": {
         "type": "object",
         "type": "object",
@@ -9751,6 +9796,3 @@
     }
     }
   }
   }
 }
 }
-=======
-{}
->>>>>>> 4f732c838 (feat: add command-aware permission request system for granular tool approval)