chore: generate
This commit is contained in:
@@ -208,7 +208,11 @@ export const defaultLayer = layer.pipe(
|
|||||||
Layer.provide(InstanceStore.defaultLayer),
|
Layer.provide(InstanceStore.defaultLayer),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const loaderNode = LayerNode.make({ service: Loader, layer: loaderLayer, deps: [Provider.node, Agent.node, Command.node, InstanceStore.node] })
|
export const loaderNode = LayerNode.make({
|
||||||
|
service: Loader,
|
||||||
|
layer: loaderLayer,
|
||||||
|
deps: [Provider.node, Agent.node, Command.node, InstanceStore.node],
|
||||||
|
})
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer, deps: [loaderNode] })
|
export const node = LayerNode.make({ service: Service, layer, deps: [loaderNode] })
|
||||||
|
|
||||||
|
|||||||
@@ -17,9 +17,10 @@ import { Skill } from "../../src/skill"
|
|||||||
import { Truncate } from "../../src/tool/truncate"
|
import { Truncate } from "../../src/tool/truncate"
|
||||||
|
|
||||||
const agentLayer = (flags: Partial<RuntimeFlags.Info> = {}) =>
|
const agentLayer = (flags: Partial<RuntimeFlags.Info> = {}) =>
|
||||||
LayerNode.compile(LayerNode.group([Agent.node, Plugin.node, Provider.node, Auth.node, Config.node, Skill.node, RuntimeFlags.node]), [
|
LayerNode.compile(
|
||||||
[RuntimeFlags.node, RuntimeFlags.layer(flags)],
|
LayerNode.group([Agent.node, Plugin.node, Provider.node, Auth.node, Config.node, Skill.node, RuntimeFlags.node]),
|
||||||
])
|
[[RuntimeFlags.node, RuntimeFlags.layer(flags)]],
|
||||||
|
)
|
||||||
|
|
||||||
const it = testEffect(agentLayer())
|
const it = testEffect(agentLayer())
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ import { CrossSpawnSpawner } from "@opencode-ai/core/cross-spawn-spawner"
|
|||||||
import { Format } from "../../src/format"
|
import { Format } from "../../src/format"
|
||||||
import * as Formatter from "../../src/format/formatter"
|
import * as Formatter from "../../src/format/formatter"
|
||||||
|
|
||||||
const it = testEffect(Layer.mergeAll(LayerNode.compile(LayerNode.group([Format.node, CrossSpawnSpawner.node])), NodeFileSystem.layer))
|
const it = testEffect(
|
||||||
|
Layer.mergeAll(LayerNode.compile(LayerNode.group([Format.node, CrossSpawnSpawner.node])), NodeFileSystem.layer),
|
||||||
|
)
|
||||||
|
|
||||||
describe("Format", () => {
|
describe("Format", () => {
|
||||||
it.instance("status() returns empty list when no formatters are configured", () =>
|
it.instance("status() returns empty list when no formatters are configured", () =>
|
||||||
@@ -107,7 +109,11 @@ describe("Format", () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
testEffect(
|
testEffect(
|
||||||
Layer.mergeAll(LayerNode.compile(LayerNode.group([Format.node, CrossSpawnSpawner.node])), NodeFileSystem.layer, testInstanceStoreLayer),
|
Layer.mergeAll(
|
||||||
|
LayerNode.compile(LayerNode.group([Format.node, CrossSpawnSpawner.node])),
|
||||||
|
NodeFileSystem.layer,
|
||||||
|
testInstanceStoreLayer,
|
||||||
|
),
|
||||||
).live("status() initializes formatter state per directory", () =>
|
).live("status() initializes formatter state per directory", () =>
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const a = yield* provideTmpdirInstance(() => Format.use.status(), {
|
const a = yield* provideTmpdirInstance(() => Format.use.status(), {
|
||||||
|
|||||||
@@ -55,7 +55,11 @@ function testLayer(
|
|||||||
httpHandler: (request: HttpClientRequest.HttpClientRequest) => Response,
|
httpHandler: (request: HttpClientRequest.HttpClientRequest) => Response,
|
||||||
spawnHandler?: (cmd: string, args: readonly string[]) => string | { code: number; stdout?: string; stderr?: string },
|
spawnHandler?: (cmd: string, args: readonly string[]) => string | { code: number; stdout?: string; stderr?: string },
|
||||||
) {
|
) {
|
||||||
const spawnerNode = makeGlobalNode({ service: ChildProcessSpawner.ChildProcessSpawner, layer: mockSpawner(spawnHandler), deps: [] })
|
const spawnerNode = makeGlobalNode({
|
||||||
|
service: ChildProcessSpawner.ChildProcessSpawner,
|
||||||
|
layer: mockSpawner(spawnHandler),
|
||||||
|
deps: [],
|
||||||
|
})
|
||||||
const appProcessNode = makeGlobalNode({ service: AppProcess.Service, layer: AppProcess.layer, deps: [spawnerNode] })
|
const appProcessNode = makeGlobalNode({ service: AppProcess.Service, layer: AppProcess.layer, deps: [spawnerNode] })
|
||||||
return LayerNode.compile(Installation.node, [
|
return LayerNode.compile(Installation.node, [
|
||||||
[httpClient, mockHttpClient(httpHandler)],
|
[httpClient, mockHttpClient(httpHandler)],
|
||||||
|
|||||||
@@ -156,7 +156,9 @@ const { FSUtil } = await import("@opencode-ai/core/fs-util")
|
|||||||
const { CrossSpawnSpawner } = await import("@opencode-ai/core/cross-spawn-spawner")
|
const { CrossSpawnSpawner } = await import("@opencode-ai/core/cross-spawn-spawner")
|
||||||
|
|
||||||
const mcpTest = testEffect(
|
const mcpTest = testEffect(
|
||||||
LayerNode.compile(LayerNode.group([MCP.node, McpAuth.node, EventV2Bridge.node, Config.node, CrossSpawnSpawner.node, FSUtil.node])),
|
LayerNode.compile(
|
||||||
|
LayerNode.group([MCP.node, McpAuth.node, EventV2Bridge.node, Config.node, CrossSpawnSpawner.node, FSUtil.node]),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
const config = (name: string) => ({
|
const config = (name: string) => ({
|
||||||
|
|||||||
@@ -123,7 +123,9 @@ const { McpOAuthCallback } = await import("../../src/mcp/oauth-callback")
|
|||||||
const { FSUtil } = await import("@opencode-ai/core/fs-util")
|
const { FSUtil } = await import("@opencode-ai/core/fs-util")
|
||||||
const { CrossSpawnSpawner } = await import("@opencode-ai/core/cross-spawn-spawner")
|
const { CrossSpawnSpawner } = await import("@opencode-ai/core/cross-spawn-spawner")
|
||||||
const mcpTest = testEffect(
|
const mcpTest = testEffect(
|
||||||
LayerNode.compile(LayerNode.group([MCP.node, McpAuth.node, EventV2Bridge.node, Config.node, CrossSpawnSpawner.node, FSUtil.node])),
|
LayerNode.compile(
|
||||||
|
LayerNode.group([MCP.node, McpAuth.node, EventV2Bridge.node, Config.node, CrossSpawnSpawner.node, FSUtil.node]),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
const service = MCP.Service as unknown as Effect.Effect<MCPNS.Interface, never, never>
|
const service = MCP.Service as unknown as Effect.Effect<MCPNS.Interface, never, never>
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ afterEach(async () => {
|
|||||||
await disposeAllInstances()
|
await disposeAllInstances()
|
||||||
})
|
})
|
||||||
|
|
||||||
const it = testEffect(Layer.mergeAll(LayerNode.compile(LayerNode.group([CrossSpawnSpawner.node, FSUtil.node])), testInstanceStoreLayer))
|
const it = testEffect(
|
||||||
|
Layer.mergeAll(LayerNode.compile(LayerNode.group([CrossSpawnSpawner.node, FSUtil.node])), testInstanceStoreLayer),
|
||||||
|
)
|
||||||
|
|
||||||
function withTmp<T, A, E, R>(
|
function withTmp<T, A, E, R>(
|
||||||
init: (dir: string) => Promise<T>,
|
init: (dir: string) => Promise<T>,
|
||||||
|
|||||||
@@ -59,7 +59,16 @@ afterEach(async () => {
|
|||||||
|
|
||||||
const providerLayer = (flags: Partial<RuntimeFlags.Info> = {}) =>
|
const providerLayer = (flags: Partial<RuntimeFlags.Info> = {}) =>
|
||||||
LayerNode.compile(
|
LayerNode.compile(
|
||||||
LayerNode.group([Provider.node, FSUtil.node, Env.node, Config.node, Auth.node, Plugin.node, ModelsDev.node, RuntimeFlags.node]),
|
LayerNode.group([
|
||||||
|
Provider.node,
|
||||||
|
FSUtil.node,
|
||||||
|
Env.node,
|
||||||
|
Config.node,
|
||||||
|
Auth.node,
|
||||||
|
Plugin.node,
|
||||||
|
ModelsDev.node,
|
||||||
|
RuntimeFlags.node,
|
||||||
|
]),
|
||||||
[[RuntimeFlags.node, RuntimeFlags.layer(flags)]],
|
[[RuntimeFlags.node, RuntimeFlags.layer(flags)]],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,11 @@ afterEach(async () => {
|
|||||||
const noopBootstrap = Layer.succeed(InstanceBootstrap.Service, InstanceBootstrap.Service.of({ run: Effect.void }))
|
const noopBootstrap = Layer.succeed(InstanceBootstrap.Service, InstanceBootstrap.Service.of({ run: Effect.void }))
|
||||||
const testInstanceStore = LayerNode.compile(InstanceStore.node, [[InstanceBootstrap.node, noopBootstrap]])
|
const testInstanceStore = LayerNode.compile(InstanceStore.node, [[InstanceBootstrap.node, noopBootstrap]])
|
||||||
const it = testEffect(
|
const it = testEffect(
|
||||||
Layer.mergeAll(LayerNode.compile(LayerNode.group([FSUtil.node, Database.node, Snapshot.node])), testInstanceStore, httpApiLayer),
|
Layer.mergeAll(
|
||||||
|
LayerNode.compile(LayerNode.group([FSUtil.node, Database.node, Snapshot.node])),
|
||||||
|
testInstanceStore,
|
||||||
|
httpApiLayer,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
function request(directory: string, url: string, init: RequestInit = {}) {
|
function request(directory: string, url: string, init: RequestInit = {}) {
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ afterEach(async () => {
|
|||||||
const noopBootstrap = Layer.succeed(InstanceBootstrap.Service, InstanceBootstrap.Service.of({ run: Effect.void }))
|
const noopBootstrap = Layer.succeed(InstanceBootstrap.Service, InstanceBootstrap.Service.of({ run: Effect.void }))
|
||||||
const testInstanceStore = LayerNode.compile(InstanceStore.node, [[InstanceBootstrap.node, noopBootstrap]])
|
const testInstanceStore = LayerNode.compile(InstanceStore.node, [[InstanceBootstrap.node, noopBootstrap]])
|
||||||
|
|
||||||
const it = testEffect(Layer.mergeAll(LayerNode.compile(LayerNode.group([FSUtil.node, Snapshot.node])), testInstanceStore, httpApiLayer))
|
const it = testEffect(
|
||||||
|
Layer.mergeAll(LayerNode.compile(LayerNode.group([FSUtil.node, Snapshot.node])), testInstanceStore, httpApiLayer),
|
||||||
|
)
|
||||||
|
|
||||||
function request(directory: string, url: string, init: RequestInit = {}) {
|
function request(directory: string, url: string, init: RequestInit = {}) {
|
||||||
return requestInDirectory(url, directory, init)
|
return requestInDirectory(url, directory, init)
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ import {
|
|||||||
} from "../fixture/fixture"
|
} from "../fixture/fixture"
|
||||||
import { testEffect } from "../lib/effect"
|
import { testEffect } from "../lib/effect"
|
||||||
|
|
||||||
const it = testEffect(Layer.mergeAll(LayerNode.compile(LayerNode.group([Snapshot.node, FSUtil.node])), testInstanceStoreLayer))
|
const it = testEffect(
|
||||||
|
Layer.mergeAll(LayerNode.compile(LayerNode.group([Snapshot.node, FSUtil.node])), testInstanceStoreLayer),
|
||||||
|
)
|
||||||
// Windows forbids both * and : in directory names.
|
// Windows forbids both * and : in directory names.
|
||||||
const nonWindowsIt = process.platform === "win32" ? it.live.skip : it.live
|
const nonWindowsIt = process.platform === "win32" ? it.live.skip : it.live
|
||||||
|
|
||||||
@@ -79,7 +81,8 @@ const bootstrapScoped = Effect.fn("SnapshotTest.bootstrapScoped")(function* () {
|
|||||||
return { path: dir, extra: yield* initialize(dir) }
|
return { path: dir, extra: yield* initialize(dir) }
|
||||||
})
|
})
|
||||||
|
|
||||||
const scopedGitTmpdir = () => tmpdirScoped({ git: true }).pipe(Effect.provide(LayerNode.compile(CrossSpawnSpawner.node)))
|
const scopedGitTmpdir = () =>
|
||||||
|
tmpdirScoped({ git: true }).pipe(Effect.provide(LayerNode.compile(CrossSpawnSpawner.node)))
|
||||||
|
|
||||||
const cleanupWorktree = (repo: string, worktree: string, files: string[] = []) =>
|
const cleanupWorktree = (repo: string, worktree: string, files: string[] = []) =>
|
||||||
Effect.promise(async () => {
|
Effect.promise(async () => {
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ import { SessionID, MessageID } from "../../src/session/schema"
|
|||||||
import { testEffect } from "../lib/effect"
|
import { testEffect } from "../lib/effect"
|
||||||
|
|
||||||
const it = testEffect(
|
const it = testEffect(
|
||||||
LayerNode.compile(LayerNode.group([LSP.node, FSUtil.node, Format.node, EventV2Bridge.node, Truncate.node, Agent.node])),
|
LayerNode.compile(
|
||||||
|
LayerNode.group([LSP.node, FSUtil.node, Format.node, EventV2Bridge.node, Truncate.node, Agent.node]),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
const baseCtx = {
|
const baseCtx = {
|
||||||
|
|||||||
@@ -31,7 +31,9 @@ afterEach(async () => {
|
|||||||
await disposeAllInstances()
|
await disposeAllInstances()
|
||||||
})
|
})
|
||||||
|
|
||||||
const layer = LayerNode.compile(LayerNode.group([LSP.node, FSUtil.node, Format.node, EventV2Bridge.node, Truncate.node, Agent.node]))
|
const layer = LayerNode.compile(
|
||||||
|
LayerNode.group([LSP.node, FSUtil.node, Format.node, EventV2Bridge.node, Truncate.node, Agent.node]),
|
||||||
|
)
|
||||||
|
|
||||||
const it = testEffect(layer)
|
const it = testEffect(layer)
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ import { Permission } from "../../src/permission"
|
|||||||
import type * as Tool from "../../src/tool/tool"
|
import type * as Tool from "../../src/tool/tool"
|
||||||
|
|
||||||
const toolLayer = (flags: Partial<RuntimeFlags.Info> = {}) =>
|
const toolLayer = (flags: Partial<RuntimeFlags.Info> = {}) =>
|
||||||
LayerNode.compile(LayerNode.group([CrossSpawnSpawner.node, FSUtil.node, Ripgrep.node, Truncate.node, Agent.node, Git.node]))
|
LayerNode.compile(
|
||||||
|
LayerNode.group([CrossSpawnSpawner.node, FSUtil.node, Ripgrep.node, Truncate.node, Agent.node, Git.node]),
|
||||||
|
)
|
||||||
|
|
||||||
const it = testEffect(toolLayer())
|
const it = testEffect(toolLayer())
|
||||||
const full = (p: string) => (process.platform === "win32" ? Filesystem.normalizePath(p) : p)
|
const full = (p: string) => (process.platform === "win32" ? Filesystem.normalizePath(p) : p)
|
||||||
|
|||||||
@@ -23,7 +23,9 @@ import { Git } from "@/git"
|
|||||||
import { Filesystem } from "@/util/filesystem"
|
import { Filesystem } from "@/util/filesystem"
|
||||||
|
|
||||||
const toolLayer = (flags: Partial<RuntimeFlags.Info> = {}) =>
|
const toolLayer = (flags: Partial<RuntimeFlags.Info> = {}) =>
|
||||||
LayerNode.compile(LayerNode.group([CrossSpawnSpawner.node, FSUtil.node, Ripgrep.node, Truncate.node, Agent.node, Git.node]))
|
LayerNode.compile(
|
||||||
|
LayerNode.group([CrossSpawnSpawner.node, FSUtil.node, Ripgrep.node, Truncate.node, Agent.node, Git.node]),
|
||||||
|
)
|
||||||
|
|
||||||
const it = testEffect(toolLayer())
|
const it = testEffect(toolLayer())
|
||||||
const rooted = testEffect(Layer.mergeAll(toolLayer(), testInstanceStoreLayer))
|
const rooted = testEffect(Layer.mergeAll(toolLayer(), testInstanceStoreLayer))
|
||||||
|
|||||||
@@ -46,7 +46,15 @@ const ctx = {
|
|||||||
|
|
||||||
const readLayer = (flags: Partial<RuntimeFlags.Info> = {}) =>
|
const readLayer = (flags: Partial<RuntimeFlags.Info> = {}) =>
|
||||||
LayerNode.compile(
|
LayerNode.compile(
|
||||||
LayerNode.group([Agent.node, FSUtil.node, CrossSpawnSpawner.node, Instruction.node, LSP.node, Ripgrep.node, Truncate.node]),
|
LayerNode.group([
|
||||||
|
Agent.node,
|
||||||
|
FSUtil.node,
|
||||||
|
CrossSpawnSpawner.node,
|
||||||
|
Instruction.node,
|
||||||
|
LSP.node,
|
||||||
|
Ripgrep.node,
|
||||||
|
Truncate.node,
|
||||||
|
]),
|
||||||
)
|
)
|
||||||
|
|
||||||
const it = testEffect(Layer.mergeAll(readLayer(), testInstanceStoreLayer))
|
const it = testEffect(Layer.mergeAll(readLayer(), testInstanceStoreLayer))
|
||||||
|
|||||||
@@ -33,7 +33,15 @@ afterEach(async () => {
|
|||||||
|
|
||||||
const it = testEffect(
|
const it = testEffect(
|
||||||
LayerNode.compile(
|
LayerNode.compile(
|
||||||
LayerNode.group([LSP.node, FSUtil.node, EventV2Bridge.node, Format.node, CrossSpawnSpawner.node, Truncate.node, Agent.node]),
|
LayerNode.group([
|
||||||
|
LSP.node,
|
||||||
|
FSUtil.node,
|
||||||
|
EventV2Bridge.node,
|
||||||
|
Format.node,
|
||||||
|
CrossSpawnSpawner.node,
|
||||||
|
Truncate.node,
|
||||||
|
Agent.node,
|
||||||
|
]),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user