opencode-agent[bot] 2 mesi fa
parent
commit
c939aa04fe

+ 16 - 13
packages/opencode/test/effect/app-graph-types.test.ts

@@ -19,23 +19,26 @@ class NetworkError {
 }
 
 const aImplementation = Layer.succeed(A, A.of({ value: "a" }))
-const bImplementation = Layer.effect(B, Effect.gen(function* () {
-  yield* A
-  return B.of({ value: "b" })
-}))
-const cImplementation = Layer.effect(C, Effect.gen(function* () {
-  yield* A
-  yield* B
-  return C.of({ value: "c" })
-}))
+const bImplementation = Layer.effect(
+  B,
+  Effect.gen(function* () {
+    yield* A
+    return B.of({ value: "b" })
+  }),
+)
+const cImplementation = Layer.effect(
+  C,
+  Effect.gen(function* () {
+    yield* A
+    yield* B
+    return C.of({ value: "c" })
+  }),
+)
 const failingAImplementation = Layer.effect(A, Effect.fail(new LayerError()))
 const notFoundAImplementation = Layer.effect(A, Effect.fail(new NotFoundError()))
 const diskAImplementation = Layer.effect(A, Effect.fail(new DiskError()))
 const networkAImplementation = Layer.effect(A, Effect.fail(new NetworkError()))
-const notFoundOrDiskAImplementation = Layer.effect(
-  A,
-  Effect.fail(new NotFoundError() as NotFoundError | DiskError),
-)
+const notFoundOrDiskAImplementation = Layer.effect(A, Effect.fail(new NotFoundError() as NotFoundError | DiskError))
 
 type Equal<A, B> = (<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2 ? true : false
 type Assert<T extends true> = T

+ 4 - 5
packages/opencode/test/effect/app-graph.test.ts

@@ -141,10 +141,7 @@ describe("app graph", () => {
     class ReplacementConfig extends Context.Service<ReplacementConfig, { readonly value: string }>()(
       "test/ReplacementConfig",
     ) {}
-    const replacementConfig = node(
-      Layer.succeed(ReplacementConfig, ReplacementConfig.of({ value: "replacement" })),
-      [],
-    )
+    const replacementConfig = node(Layer.succeed(ReplacementConfig, ReplacementConfig.of({ value: "replacement" })), [])
     const replacement = node(
       Layer.effect(
         Value,
@@ -175,7 +172,9 @@ describe("app graph", () => {
       [],
     )
 
-    await Effect.runPromise(Effect.provide(Greeting, build(greeting, { replacements: [replace(unreachable, replacement)] })))
+    await Effect.runPromise(
+      Effect.provide(Greeting, build(greeting, { replacements: [replace(unreachable, replacement)] })),
+    )
 
     expect(acquisitions).toBe(0)
   })

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

@@ -79,13 +79,13 @@ export type Event =
   | EventCommandExecuted
   | EventProjectDirectoriesUpdated
   | EventProjectUpdated
+  | EventVcsBranchUpdated
   | EventQuestionAsked
   | EventQuestionReplied
   | EventQuestionRejected
   | EventSessionStatus
   | EventSessionIdle
   | EventSessionCompacted
-  | EventVcsBranchUpdated
   | EventWorktreeReady
   | EventWorktreeFailed
   | EventWorkspaceReady
@@ -1522,6 +1522,13 @@ export type GlobalEvent = {
           sandboxes: Array<string>
         }
       }
+    | {
+        id: string
+        type: "vcs.branch.updated"
+        properties: {
+          branch?: string
+        }
+      }
     | {
         id: string
         type: "question.asked"
@@ -1574,13 +1581,6 @@ export type GlobalEvent = {
           sessionID: string
         }
       }
-    | {
-        id: string
-        type: "vcs.branch.updated"
-        properties: {
-          branch?: string
-        }
-      }
     | {
         id: string
         type: "worktree.ready"
@@ -5103,6 +5103,14 @@ export type EventProjectUpdated = {
   }
 }
 
+export type EventVcsBranchUpdated = {
+  id: string
+  type: "vcs.branch.updated"
+  properties: {
+    branch?: string
+  }
+}
+
 export type EventQuestionAsked = {
   id: string
   type: "question.asked"
@@ -5161,14 +5169,6 @@ export type EventSessionCompacted = {
   }
 }
 
-export type EventVcsBranchUpdated = {
-  id: string
-  type: "vcs.branch.updated"
-  properties: {
-    branch?: string
-  }
-}
-
 export type EventWorktreeReady = {
   id: string
   type: "worktree.ready"

+ 51 - 51
packages/sdk/openapi.json

@@ -12481,6 +12481,9 @@
           {
             "$ref": "#/components/schemas/EventProjectUpdated"
           },
+          {
+            "$ref": "#/components/schemas/EventVcsBranchUpdated"
+          },
           {
             "$ref": "#/components/schemas/EventQuestionAsked"
           },
@@ -12499,9 +12502,6 @@
           {
             "$ref": "#/components/schemas/EventSessionCompacted"
           },
-          {
-            "$ref": "#/components/schemas/EventVcsBranchUpdated"
-          },
           {
             "$ref": "#/components/schemas/EventWorktreeReady"
           },
@@ -17104,6 +17104,30 @@
                 "required": ["id", "type", "properties"],
                 "additionalProperties": false
               },
+              {
+                "type": "object",
+                "properties": {
+                  "id": {
+                    "type": "string",
+                    "pattern": "^evt_"
+                  },
+                  "type": {
+                    "type": "string",
+                    "enum": ["vcs.branch.updated"]
+                  },
+                  "properties": {
+                    "type": "object",
+                    "properties": {
+                      "branch": {
+                        "type": "string"
+                      }
+                    },
+                    "additionalProperties": false
+                  }
+                },
+                "required": ["id", "type", "properties"],
+                "additionalProperties": false
+              },
               {
                 "type": "object",
                 "properties": {
@@ -17291,30 +17315,6 @@
                 "required": ["id", "type", "properties"],
                 "additionalProperties": false
               },
-              {
-                "type": "object",
-                "properties": {
-                  "id": {
-                    "type": "string",
-                    "pattern": "^evt_"
-                  },
-                  "type": {
-                    "type": "string",
-                    "enum": ["vcs.branch.updated"]
-                  },
-                  "properties": {
-                    "type": "object",
-                    "properties": {
-                      "branch": {
-                        "type": "string"
-                      }
-                    },
-                    "additionalProperties": false
-                  }
-                },
-                "required": ["id", "type", "properties"],
-                "additionalProperties": false
-              },
               {
                 "type": "object",
                 "properties": {
@@ -28341,6 +28341,30 @@
         "required": ["id", "type", "properties"],
         "additionalProperties": false
       },
+      "EventVcsBranchUpdated": {
+        "type": "object",
+        "properties": {
+          "id": {
+            "type": "string",
+            "pattern": "^evt_"
+          },
+          "type": {
+            "type": "string",
+            "enum": ["vcs.branch.updated"]
+          },
+          "properties": {
+            "type": "object",
+            "properties": {
+              "branch": {
+                "type": "string"
+              }
+            },
+            "additionalProperties": false
+          }
+        },
+        "required": ["id", "type", "properties"],
+        "additionalProperties": false
+      },
       "EventQuestionAsked": {
         "type": "object",
         "properties": {
@@ -28528,30 +28552,6 @@
         "required": ["id", "type", "properties"],
         "additionalProperties": false
       },
-      "EventVcsBranchUpdated": {
-        "type": "object",
-        "properties": {
-          "id": {
-            "type": "string",
-            "pattern": "^evt_"
-          },
-          "type": {
-            "type": "string",
-            "enum": ["vcs.branch.updated"]
-          },
-          "properties": {
-            "type": "object",
-            "properties": {
-              "branch": {
-                "type": "string"
-              }
-            },
-            "additionalProperties": false
-          }
-        },
-        "required": ["id", "type", "properties"],
-        "additionalProperties": false
-      },
       "EventWorktreeReady": {
         "type": "object",
         "properties": {