فهرست منبع

chore: generate

opencode-agent[bot] 4 ماه پیش
والد
کامیت
a9ccb0804f

+ 2 - 4
packages/opencode/src/server/routes/instance/httpapi/middleware/error.ts

@@ -36,9 +36,7 @@ export const errorLayer = HttpRouter.middleware<{ handles: unknown }>()((effect)
     }),
     Effect.map(normalizeEmptyBadRequest),
     Effect.catchCause((cause) => {
-      const schemaError = cause.reasons
-        .filter(Cause.isDieReason)
-        .find((reason) => HttpApiSchemaError.is(reason.defect))
+      const schemaError = cause.reasons.filter(Cause.isDieReason).find((reason) => HttpApiSchemaError.is(reason.defect))
       if (schemaError) return Effect.succeed(badRequestResponse())
 
       const defect = cause.reasons.filter(Cause.isDieReason).find((reason) => {
@@ -63,7 +61,7 @@ export const errorLayer = HttpRouter.middleware<{ handles: unknown }>()((effect)
               return 500
             }),
           }),
-)
+        )
       }
       if (error instanceof Session.BusyError) {
         return Effect.succeed(

+ 8 - 2
packages/opencode/test/server/httpapi-instance.test.ts

@@ -137,8 +137,14 @@ describe("instance HttpApi", () => {
         )
       const [permission, questionReply, questionReject] = yield* Effect.all(
         [
-          request("/permission/invalid-permission-id/reply", { method: "POST", body: JSON.stringify({ reply: "once" }) }),
-          request("/question/invalid-question-id/reply", { method: "POST", body: JSON.stringify({ answers: [["Yes"]] }) }),
+          request("/permission/invalid-permission-id/reply", {
+            method: "POST",
+            body: JSON.stringify({ reply: "once" }),
+          }),
+          request("/question/invalid-question-id/reply", {
+            method: "POST",
+            body: JSON.stringify({ answers: [["Yes"]] }),
+          }),
           request("/question/invalid-question-id/reject", { method: "POST" }),
         ],
         { concurrency: "unbounded" },

+ 10 - 5
packages/sdk/openapi.json

@@ -9057,7 +9057,8 @@
         "type": "object",
         "properties": {
           "id": {
-            "type": "string"
+            "type": "string",
+            "pattern": "^per"
           },
           "sessionID": {
             "type": "string"
@@ -9355,7 +9356,8 @@
         "type": "object",
         "properties": {
           "id": {
-            "type": "string"
+            "type": "string",
+            "pattern": "^que"
           },
           "sessionID": {
             "type": "string"
@@ -9387,7 +9389,8 @@
             "type": "string"
           },
           "requestID": {
-            "type": "string"
+            "type": "string",
+            "pattern": "^que"
           },
           "answers": {
             "type": "array",
@@ -9406,7 +9409,8 @@
             "type": "string"
           },
           "requestID": {
-            "type": "string"
+            "type": "string",
+            "pattern": "^que"
           }
         },
         "required": ["sessionID", "requestID"],
@@ -15815,7 +15819,8 @@
                 "type": "string"
               },
               "requestID": {
-                "type": "string"
+                "type": "string",
+                "pattern": "^per"
               },
               "reply": {
                 "type": "string",