ソースを参照

chore: generate

opencode-agent[bot] 2 ヶ月 前
コミット
6dd4d1473c

+ 5 - 2
packages/opencode/src/cli/cmd/debug/file.ts

@@ -40,8 +40,11 @@ const FileReadCommand = effectCmd({
   handler: Effect.fn("Cli.debug.file.read")(function* (args) {
     const file = yield* filesystem(FileSystem.Service.use((svc) => svc.read({ path: RelativePath.make(args.path) })))
     process.stdout.write(
-      JSON.stringify({ content: Buffer.from(file.content).toString("base64"), encoding: "base64", mime: file.mime }, null, 2) +
-        EOL,
+      JSON.stringify(
+        { content: Buffer.from(file.content).toString("base64"), encoding: "base64", mime: file.mime },
+        null,
+        2,
+      ) + EOL,
     )
   }),
 })

+ 5 - 45
packages/sdk/openapi.json

@@ -12463,7 +12463,7 @@
         ]
       }
     },
-    "/api/fs/read": {
+    "/api/fs/read/*": {
       "get": {
         "tags": ["filesystem"],
         "operationId": "v2.fs.read",
@@ -12486,14 +12486,6 @@
             "required": false,
             "style": "deepObject",
             "explode": true
-          },
-          {
-            "name": "path",
-            "in": "query",
-            "schema": {
-              "type": "string"
-            },
-            "required": true
           }
         ],
         "security": [],
@@ -12501,19 +12493,10 @@
           "200": {
             "description": "Success",
             "content": {
-              "application/json": {
+              "application/octet-stream": {
                 "schema": {
-                  "type": "object",
-                  "properties": {
-                    "location": {
-                      "$ref": "#/components/schemas/LocationInfo"
-                    },
-                    "data": {
-                      "$ref": "#/components/schemas/FileSystemContent"
-                    }
-                  },
-                  "required": ["location", "data"],
-                  "additionalProperties": false
+                  "type": "string",
+                  "format": "binary"
                 }
               }
             }
@@ -12539,7 +12522,7 @@
             }
           }
         },
-        "description": "Read one file relative to the requested location.",
+        "description": "Serve one file relative to the requested location.",
         "summary": "Read file",
         "x-codeSamples": [
           {
@@ -26560,29 +26543,6 @@
         "required": ["id", "projectID", "action", "resource"],
         "additionalProperties": false
       },
-      "FileSystemContent": {
-        "type": "object",
-        "properties": {
-          "uri": {
-            "type": "string"
-          },
-          "name": {
-            "type": "string"
-          },
-          "content": {
-            "type": "string"
-          },
-          "encoding": {
-            "type": "string",
-            "enum": ["utf8", "base64"]
-          },
-          "mime": {
-            "type": "string"
-          }
-        },
-        "required": ["uri", "content", "encoding", "mime"],
-        "additionalProperties": false
-      },
       "FileSystemEntry": {
         "type": "object",
         "properties": {

+ 3 - 1
packages/server/src/handlers/fs.ts

@@ -12,7 +12,9 @@ export const FileSystemHandler = HttpApiBuilder.group(Api, "server.fs", (handler
       .handleRaw("fs.read", (ctx) =>
         Effect.gen(function* () {
           const file = yield* (yield* FileSystem.Service).read({
-            path: RelativePath.make(decodeURIComponent(new URL(ctx.request.url, "http://localhost").pathname.slice(13))),
+            path: RelativePath.make(
+              decodeURIComponent(new URL(ctx.request.url, "http://localhost").pathname.slice(13)),
+            ),
           })
           return HttpServerResponse.uint8Array(file.content, { contentType: file.mime })
         }),