chore: generate
This commit is contained in:
@@ -272,13 +272,15 @@ export function compile<A, E, const Items extends Replacements = readonly []>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function replacementMapFrom(replacements?: Replacements) {
|
function replacementMapFrom(replacements?: Replacements) {
|
||||||
return replacements?.reduce((map, [source, replacement]) => {
|
return (
|
||||||
const normalized = rewriteReplacementDependencies(replacementNode(source, replacement), map)
|
replacements?.reduce((map, [source, replacement]) => {
|
||||||
const current = new Map([[source.name, normalized]])
|
const normalized = rewriteReplacementDependencies(replacementNode(source, replacement), map)
|
||||||
for (const [name, node] of map) map.set(name, rewriteReplacementDependencies(node, current))
|
const current = new Map([[source.name, normalized]])
|
||||||
map.set(source.name, normalized)
|
for (const [name, node] of map) map.set(name, rewriteReplacementDependencies(node, current))
|
||||||
return map
|
map.set(source.name, normalized)
|
||||||
}, new Map<string, AnyNode>()) ?? new Map<string, AnyNode>()
|
return map
|
||||||
|
}, new Map<string, AnyNode>()) ?? new Map<string, AnyNode>()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function rewriteReplacementDependencies(root: AnyNode, replacements: ReadonlyMap<string, AnyNode>) {
|
function rewriteReplacementDependencies(root: AnyNode, replacements: ReadonlyMap<string, AnyNode>) {
|
||||||
|
|||||||
@@ -44,9 +44,7 @@ function provide(directory: string, vcs?: Location.Interface["vcs"]) {
|
|||||||
AppNodeBuilder.build(Watcher.node, [
|
AppNodeBuilder.build(Watcher.node, [
|
||||||
[Config.node, configLayer],
|
[Config.node, configLayer],
|
||||||
[Location.node, locationLayer],
|
[Location.node, locationLayer],
|
||||||
]).pipe(
|
]).pipe(Layer.provide(flagsLayer)),
|
||||||
Layer.provide(flagsLayer),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,9 +17,11 @@ import { testEffect } from "./lib/effect"
|
|||||||
|
|
||||||
const it = testEffect(Layer.empty)
|
const it = testEffect(Layer.empty)
|
||||||
|
|
||||||
const instructionLayer = (
|
const instructionLayer = (input: {
|
||||||
input: { config: string; locationServiceLayer: Layer.Layer<Location.Service>; filesystemLayer?: Layer.Layer<FSUtil.Service> },
|
config: string
|
||||||
) =>
|
locationServiceLayer: Layer.Layer<Location.Service>
|
||||||
|
filesystemLayer?: Layer.Layer<FSUtil.Service>
|
||||||
|
}) =>
|
||||||
AppNodeBuilder.build(LayerNode.group([SystemContextRegistry.node, InstructionContext.node]), [
|
AppNodeBuilder.build(LayerNode.group([SystemContextRegistry.node, InstructionContext.node]), [
|
||||||
[Global.node, Global.layerWith({ config: input.config })],
|
[Global.node, Global.layerWith({ config: input.config })],
|
||||||
[Location.node, input.locationServiceLayer],
|
[Location.node, input.locationServiceLayer],
|
||||||
@@ -305,7 +307,10 @@ describe("InstructionContext", () => {
|
|||||||
locationServiceLayer: Layer.succeed(
|
locationServiceLayer: Layer.succeed(
|
||||||
Location.Service,
|
Location.Service,
|
||||||
Location.Service.of(
|
Location.Service.of(
|
||||||
location({ directory: AbsolutePath.make("/outside") }, { projectDirectory: AbsolutePath.make("/repo") }),
|
location(
|
||||||
|
{ directory: AbsolutePath.make("/outside") },
|
||||||
|
{ projectDirectory: AbsolutePath.make("/repo") },
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -25,7 +25,14 @@ const current = Layer.succeed(
|
|||||||
)
|
)
|
||||||
const it = testEffect(
|
const it = testEffect(
|
||||||
AppNodeBuilder.build(
|
AppNodeBuilder.build(
|
||||||
LayerNode.group([Database.node, EventV2.node, SessionStore.node, PermissionSaved.node, AgentV2.node, PermissionV2.node]),
|
LayerNode.group([
|
||||||
|
Database.node,
|
||||||
|
EventV2.node,
|
||||||
|
SessionStore.node,
|
||||||
|
PermissionSaved.node,
|
||||||
|
AgentV2.node,
|
||||||
|
PermissionV2.node,
|
||||||
|
]),
|
||||||
[[Location.node, current]],
|
[[Location.node, current]],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,10 +11,11 @@ import { host } from "./host"
|
|||||||
|
|
||||||
const directory = AbsolutePath.make("/repo/packages/app")
|
const directory = AbsolutePath.make("/repo/packages/app")
|
||||||
const project = AbsolutePath.make("/repo")
|
const project = AbsolutePath.make("/repo")
|
||||||
const locationLayer = Layer.succeed(Location.Service, Location.Service.of(location({ directory }, { projectDirectory: project })))
|
const locationLayer = Layer.succeed(
|
||||||
const it = testEffect(
|
Location.Service,
|
||||||
AppNodeBuilder.build(CommandV2.node, [[Location.node, locationLayer]]),
|
Location.Service.of(location({ directory }, { projectDirectory: project })),
|
||||||
)
|
)
|
||||||
|
const it = testEffect(AppNodeBuilder.build(CommandV2.node, [[Location.node, locationLayer]]))
|
||||||
|
|
||||||
describe("CommandPlugin.Plugin", () => {
|
describe("CommandPlugin.Plugin", () => {
|
||||||
it.effect("registers built-in init and review commands", () =>
|
it.effect("registers built-in init and review commands", () =>
|
||||||
|
|||||||
@@ -9,7 +9,10 @@ import { testEffect } from "./lib/effect"
|
|||||||
|
|
||||||
const it = testEffect(
|
const it = testEffect(
|
||||||
AppNodeBuilder.build(Policy.node, [
|
AppNodeBuilder.build(Policy.node, [
|
||||||
[Location.node, Layer.succeed(Location.Service, Location.Service.of(location({ directory: AbsolutePath.make("test") })))],
|
[
|
||||||
|
Location.node,
|
||||||
|
Layer.succeed(Location.Service, Location.Service.of(location({ directory: AbsolutePath.make("test") }))),
|
||||||
|
],
|
||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -36,10 +36,13 @@ const projects = Layer.succeed(
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
const it = testEffect(
|
const it = testEffect(
|
||||||
AppNodeBuilder.build(LayerNode.group([Database.node, EventV2.node, SessionProjector.node, SessionStore.node, SessionV2.node]), [
|
AppNodeBuilder.build(
|
||||||
[ProjectV2.node, projects],
|
LayerNode.group([Database.node, EventV2.node, SessionProjector.node, SessionStore.node, SessionV2.node]),
|
||||||
[SessionExecution.node, SessionExecution.noopLayer],
|
[
|
||||||
]),
|
[ProjectV2.node, projects],
|
||||||
|
[SessionExecution.node, SessionExecution.noopLayer],
|
||||||
|
],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
const location = Location.Ref.make({ directory: AbsolutePath.make("/project") })
|
const location = Location.Ref.make({ directory: AbsolutePath.make("/project") })
|
||||||
const id = SessionV2.ID.create()
|
const id = SessionV2.ID.create()
|
||||||
|
|||||||
@@ -24,10 +24,13 @@ const projects = Layer.succeed(
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
const it = testEffect(
|
const it = testEffect(
|
||||||
AppNodeBuilder.build(LayerNode.group([Database.node, EventV2.node, SessionProjector.node, SessionStore.node, SessionV2.node]), [
|
AppNodeBuilder.build(
|
||||||
[ProjectV2.node, projects],
|
LayerNode.group([Database.node, EventV2.node, SessionProjector.node, SessionStore.node, SessionV2.node]),
|
||||||
[SessionExecution.node, SessionExecution.noopLayer],
|
[
|
||||||
]),
|
[ProjectV2.node, projects],
|
||||||
|
[SessionExecution.node, SessionExecution.noopLayer],
|
||||||
|
],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
const location = Location.Ref.make({ directory: AbsolutePath.make("/project") })
|
const location = Location.Ref.make({ directory: AbsolutePath.make("/project") })
|
||||||
|
|
||||||
|
|||||||
@@ -43,9 +43,10 @@ const execution = Layer.succeed(
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
const it = testEffect(
|
const it = testEffect(
|
||||||
AppNodeBuilder.build(LayerNode.group([Database.node, EventV2.node, SessionProjector.node, SessionStore.node, SessionV2.node]), [
|
AppNodeBuilder.build(
|
||||||
[SessionExecution.node, execution],
|
LayerNode.group([Database.node, EventV2.node, SessionProjector.node, SessionStore.node, SessionV2.node]),
|
||||||
]),
|
[[SessionExecution.node, execution]],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
const sessionID = SessionV2.ID.make("ses_prompt_test")
|
const sessionID = SessionV2.ID.make("ses_prompt_test")
|
||||||
const messageID = SessionMessage.ID.create()
|
const messageID = SessionMessage.ID.create()
|
||||||
|
|||||||
@@ -32,7 +32,9 @@ const outputStore = Layer.mock(ToolOutputStore.Service, {
|
|||||||
const registryLayer = AppNodeBuilder.build(ToolRegistry.node, [[ToolOutputStore.node, outputStore]])
|
const registryLayer = AppNodeBuilder.build(ToolRegistry.node, [[ToolOutputStore.node, outputStore]])
|
||||||
const it = testEffect(registryLayer)
|
const it = testEffect(registryLayer)
|
||||||
const integrated = testEffect(
|
const integrated = testEffect(
|
||||||
AppNodeBuilder.build(LayerNode.group([ApplicationTools.node, ToolRegistry.node]), [[ToolOutputStore.node, outputStore]]),
|
AppNodeBuilder.build(LayerNode.group([ApplicationTools.node, ToolRegistry.node]), [
|
||||||
|
[ToolOutputStore.node, outputStore],
|
||||||
|
]),
|
||||||
)
|
)
|
||||||
const identity = {
|
const identity = {
|
||||||
agent: AgentV2.ID.make("build"),
|
agent: AgentV2.ID.make("build"),
|
||||||
|
|||||||
@@ -114,7 +114,9 @@ describe("Snapshot", () => {
|
|||||||
const projectID = yield* Effect.gen(function* () {
|
const projectID = yield* Effect.gen(function* () {
|
||||||
return (yield* Location.Service).project.id
|
return (yield* Location.Service).project.id
|
||||||
}).pipe(
|
}).pipe(
|
||||||
Effect.provide(AppNodeBuilder.build(Location.boundNode(Location.Ref.make({ directory: AbsolutePath.make(project) })))),
|
Effect.provide(
|
||||||
|
AppNodeBuilder.build(Location.boundNode(Location.Ref.make({ directory: AbsolutePath.make(project) }))),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
expect(
|
expect(
|
||||||
yield* Effect.promise(() => fs.stat(path.join(tmp.path, "snapshot", projectID, Hash.fast(project)))),
|
yield* Effect.promise(() => fs.stat(path.join(tmp.path, "snapshot", projectID, Hash.fast(project)))),
|
||||||
@@ -165,13 +167,10 @@ describe("Snapshot", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
function snapshotLayer(data: string, directory: string) {
|
function snapshotLayer(data: string, directory: string) {
|
||||||
return AppNodeBuilder.build(
|
return AppNodeBuilder.build(Snapshot.node, [
|
||||||
Snapshot.node,
|
[Location.node, Location.boundNode(Location.Ref.make({ directory: AbsolutePath.make(directory) }))],
|
||||||
[
|
[Global.node, Global.layerWith({ data, config: path.join(data, "config") })],
|
||||||
[Location.node, Location.boundNode(Location.Ref.make({ directory: AbsolutePath.make(directory) }))],
|
])
|
||||||
[Global.node, Global.layerWith({ data, config: path.join(data, "config") })],
|
|
||||||
],
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function read(file: string) {
|
function read(file: string) {
|
||||||
|
|||||||
@@ -96,7 +96,13 @@ const withTool = <A, E, R>(directory: string, body: (registry: ToolRegistry.Inte
|
|||||||
}).pipe(
|
}).pipe(
|
||||||
Effect.provide(
|
Effect.provide(
|
||||||
AppNodeBuilder.build(
|
AppNodeBuilder.build(
|
||||||
LayerNode.group([ToolRegistry.node, ToolRegistry.toolsNode, LocationMutation.node, FileMutation.node, ApplyPatchTool.node]),
|
LayerNode.group([
|
||||||
|
ToolRegistry.node,
|
||||||
|
ToolRegistry.toolsNode,
|
||||||
|
LocationMutation.node,
|
||||||
|
FileMutation.node,
|
||||||
|
ApplyPatchTool.node,
|
||||||
|
]),
|
||||||
[
|
[
|
||||||
[FSUtil.node, filesystem],
|
[FSUtil.node, filesystem],
|
||||||
[Location.node, activeLocation],
|
[Location.node, activeLocation],
|
||||||
|
|||||||
@@ -110,13 +110,16 @@ const withTool = <A, E, R>(
|
|||||||
return yield* body(yield* ToolRegistry.Service)
|
return yield* body(yield* ToolRegistry.Service)
|
||||||
}).pipe(
|
}).pipe(
|
||||||
Effect.provide(
|
Effect.provide(
|
||||||
AppNodeBuilder.build(LayerNode.group([ToolRegistry.node, ToolRegistry.toolsNode, LocationMutation.node, BashTool.node]), [
|
AppNodeBuilder.build(
|
||||||
[Location.node, activeLocation],
|
LayerNode.group([ToolRegistry.node, ToolRegistry.toolsNode, LocationMutation.node, BashTool.node]),
|
||||||
[PermissionV2.node, permission],
|
[
|
||||||
[AppProcess.node, processLayer],
|
[Location.node, activeLocation],
|
||||||
[Config.node, config],
|
[PermissionV2.node, permission],
|
||||||
[ToolOutputStore.node, ToolOutputStore.nodeWithoutConfig],
|
[AppProcess.node, processLayer],
|
||||||
]),
|
[Config.node, config],
|
||||||
|
[ToolOutputStore.node, ToolOutputStore.nodeWithoutConfig],
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,12 +85,21 @@ const withTool = <A, E, R>(directory: string, body: (registry: ToolRegistry.Inte
|
|||||||
return yield* body(yield* ToolRegistry.Service)
|
return yield* body(yield* ToolRegistry.Service)
|
||||||
}).pipe(
|
}).pipe(
|
||||||
Effect.provide(
|
Effect.provide(
|
||||||
AppNodeBuilder.build(LayerNode.group([ToolRegistry.node, ToolRegistry.toolsNode, LocationMutation.node, FileMutation.node, EditTool.node]), [
|
AppNodeBuilder.build(
|
||||||
[FSUtil.node, filesystem],
|
LayerNode.group([
|
||||||
[Location.node, activeLocation],
|
ToolRegistry.node,
|
||||||
[PermissionV2.node, permission],
|
ToolRegistry.toolsNode,
|
||||||
[ToolOutputStore.node, ToolOutputStore.nodeWithoutConfig],
|
LocationMutation.node,
|
||||||
]),
|
FileMutation.node,
|
||||||
|
EditTool.node,
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
[FSUtil.node, filesystem],
|
||||||
|
[Location.node, activeLocation],
|
||||||
|
[PermissionV2.node, permission],
|
||||||
|
[ToolOutputStore.node, ToolOutputStore.nodeWithoutConfig],
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,12 +124,15 @@ const websearchConfig = Layer.succeed(
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
const it = testEffect(
|
const it = testEffect(
|
||||||
AppNodeBuilder.build(LayerNode.group([ToolRegistry.node, ToolRegistry.toolsNode, WebSearchTool.configNode, WebSearchTool.node]), [
|
AppNodeBuilder.build(
|
||||||
[PermissionV2.node, permission],
|
LayerNode.group([ToolRegistry.node, ToolRegistry.toolsNode, WebSearchTool.configNode, WebSearchTool.node]),
|
||||||
[LayerNodePlatform.httpClient, http],
|
[
|
||||||
[WebSearchTool.configNode, websearchConfig],
|
[PermissionV2.node, permission],
|
||||||
[ToolOutputStore.node, ToolOutputStore.nodeWithoutConfig],
|
[LayerNodePlatform.httpClient, http],
|
||||||
]),
|
[WebSearchTool.configNode, websearchConfig],
|
||||||
|
[ToolOutputStore.node, ToolOutputStore.nodeWithoutConfig],
|
||||||
|
],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
describe("WebSearchTool registration", () => {
|
describe("WebSearchTool registration", () => {
|
||||||
|
|||||||
@@ -69,12 +69,21 @@ const withTool = <A, E, R>(directory: string, body: (registry: ToolRegistry.Inte
|
|||||||
return yield* body(yield* ToolRegistry.Service)
|
return yield* body(yield* ToolRegistry.Service)
|
||||||
}).pipe(
|
}).pipe(
|
||||||
Effect.provide(
|
Effect.provide(
|
||||||
AppNodeBuilder.build(LayerNode.group([ToolRegistry.node, ToolRegistry.toolsNode, LocationMutation.node, FileMutation.node, WriteTool.node]), [
|
AppNodeBuilder.build(
|
||||||
[FSUtil.node, filesystem],
|
LayerNode.group([
|
||||||
[Location.node, activeLocation],
|
ToolRegistry.node,
|
||||||
[PermissionV2.node, permission],
|
ToolRegistry.toolsNode,
|
||||||
[ToolOutputStore.node, ToolOutputStore.nodeWithoutConfig],
|
LocationMutation.node,
|
||||||
]),
|
FileMutation.node,
|
||||||
|
WriteTool.node,
|
||||||
|
]),
|
||||||
|
[
|
||||||
|
[FSUtil.node, filesystem],
|
||||||
|
[Location.node, activeLocation],
|
||||||
|
[PermissionV2.node, permission],
|
||||||
|
[ToolOutputStore.node, ToolOutputStore.nodeWithoutConfig],
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user