Skip to content

Commit 5691f36

Browse files
authored
refactor(core): remove tool layer exports (#34622)
1 parent 74e7a37 commit 5691f36

18 files changed

Lines changed: 19 additions & 40 deletions

‎packages/core/src/tool-output-store.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ const lineCount = (text: string) => {
109109
return count
110110
}
111111

112-
export const layer = Layer.effect(
112+
const layer = Layer.effect(
113113
Service,
114114
Effect.gen(function* () {
115115
const fs = yield* FSUtil.Service
@@ -192,8 +192,6 @@ export const layer = Layer.effect(
192192
}),
193193
)
194194

195-
export const defaultLayer = layer.pipe(Layer.provide(FSUtil.defaultLayer), Layer.provide(Global.defaultLayer))
196-
197195
export const node = makeLocationNode({ service: Service, layer, deps: [FSUtil.node, Global.node, Config.node] })
198196

199197
export const nodeWithoutConfig = makeLocationNode({ service: Service, layer, deps: [FSUtil.node, Global.node] })

‎packages/core/src/tool/application-tools.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface Interface {
2727

2828
export class Service extends Context.Service<Service, Interface>()("@opencode/ApplicationTools") {}
2929

30-
export const layer = Layer.effect(
30+
const layer = Layer.effect(
3131
Service,
3232
Effect.gen(function* () {
3333
const state = State.create<Data, Draft>({

‎packages/core/src/tool/apply-patch.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ type Prepared =
5656
readonly after: string
5757
})
5858

59-
export const layer = Layer.effectDiscard(
59+
const layer = Layer.effectDiscard(
6060
Effect.gen(function* () {
6161
const tools = yield* Tools.Service
6262
const mutation = yield* LocationMutation.Service

‎packages/core/src/tool/bash.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const externalCommandDirectories = (command: string, cwd: string) => {
9090
return [...directories]
9191
}
9292

93-
export const layer = Layer.effectDiscard(
93+
const layer = Layer.effectDiscard(
9494
Effect.gen(function* () {
9595
const tools = yield* Tools.Service
9696
const mutation = yield* LocationMutation.Service

‎packages/core/src/tool/builtins.ts‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { GlobTool } from "./glob"
99
import { GrepTool } from "./grep"
1010
import { QuestionTool } from "./question"
1111
import { ReadTool } from "./read"
12-
import { ReadToolFileSystem } from "./read-filesystem"
1312
import { SkillTool } from "./skill"
1413
import { TodoWriteTool } from "./todowrite"
1514
import { WebFetchTool } from "./webfetch"
@@ -29,21 +28,6 @@ import { WriteTool } from "./write"
2928
* repo_clone, repo_overview, plan_exit, and Rune/code mode. Keep MCP and plugin
3029
* transforms separate from this static built-in list.
3130
*/
32-
export const locationLayer = Layer.mergeAll(
33-
ApplyPatchTool.layer,
34-
BashTool.layer,
35-
EditTool.layer,
36-
GlobTool.layer,
37-
GrepTool.layer,
38-
QuestionTool.layer,
39-
ReadTool.layer.pipe(Layer.provide(ReadToolFileSystem.layer)),
40-
SkillTool.layer,
41-
TodoWriteTool.layer,
42-
WebFetchTool.layer,
43-
WebSearchTool.layer.pipe(Layer.provide(WebSearchTool.defaultConfigLayer)),
44-
WriteTool.layer,
45-
)
46-
4731
export const node = makeLocationNode({
4832
name: "built-in-tools",
4933
layer: Layer.empty,

‎packages/core/src/tool/edit.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export const toModelOutput = (output: Output, oldString: string, newString: stri
8787
// TODO: Add snapshots / undo after design exists.
8888
// TODO: Add LSP notification and diagnostics after V2 LSP runtime exists.
8989

90-
export const layer = Layer.effectDiscard(
90+
const layer = Layer.effectDiscard(
9191
Effect.gen(function* () {
9292
const tools = yield* Tools.Service
9393
const mutation = yield* LocationMutation.Service

‎packages/core/src/tool/glob.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const toModelOutput = (output: ModelOutput) => {
3535
}
3636

3737
/** Glob leaf that defaults its filesystem root to the active Location. */
38-
export const layer = Layer.effectDiscard(
38+
const layer = Layer.effectDiscard(
3939
Effect.gen(function* () {
4040
const tools = yield* Tools.Service
4141
const ripgrep = yield* Ripgrep.Service

‎packages/core/src/tool/grep.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const toModelOutput = (output: ModelOutput) => {
5050
}
5151

5252
/** Grep leaf that defaults its filesystem root to the active Location. */
53-
export const layer = Layer.effectDiscard(
53+
const layer = Layer.effectDiscard(
5454
Effect.gen(function* () {
5555
const tools = yield* Tools.Service
5656
const fs = yield* FSUtil.Service

‎packages/core/src/tool/question.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const toModelOutput = (
4444
return `User has answered your questions: ${formatted}. You can now continue with the user's answers in mind.`
4545
}
4646

47-
export const layer = Layer.effectDiscard(
47+
const layer = Layer.effectDiscard(
4848
Effect.gen(function* () {
4949
const tools = yield* Tools.Service
5050
const question = yield* QuestionV2.Service

‎packages/core/src/tool/read-filesystem.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ export const list = Effect.fn("ReadTool.list")(function* (fs: FSUtil.Interface,
351351
return new ListPage({ entries: selected, truncated, ...(truncated ? { next: offset + selected.length } : {}) })
352352
})
353353

354-
export const layer = Layer.effect(
354+
const layer = Layer.effect(
355355
Service,
356356
Effect.gen(function* () {
357357
const fs = yield* FSUtil.Service

0 commit comments

Comments
 (0)