GeezerVison is showing github.com — refactor(core): separate out location node functionality and integrat… · koji/opencode@ecdfff5
File treeExpand file treeCollapse file tree Open diff view settings server/routes/instance/httpapi
Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/core/package.json +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 16 | 16 | "opencode": "./bin/opencode" | 17 | 17 | }, | 18 | 18 | "exports": { | | 19 | + "./effect/layer-node": "./src/effect/layer-node/index.ts", | | 20 | + "./effect/node": "./src/effect/node.ts", | 19 | 21 | "./session/runner": "./src/session/runner/index.ts", | 20 | 22 | "./system-context": "./src/system-context/index.ts", | 21 | 23 | "./*": "./src/*.ts" | |
Collapse file Copy file name to clipboardExpand all lines: packages/core/src/agent.ts +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | export * as AgentV2 from "./agent" | 2 | 2 |
| | 3 | +import { makeLocationNode } from "./effect/node" | 3 | 4 | import { Array, Context, Effect, Layer, Types } from "effect" | 4 | 5 | import { Agent } from "@opencode-ai/schema/agent" | 5 | 6 | import { State } from "./state" | @@ -106,3 +107,5 @@ export const layer = Layer.effect( | 106 | 107 | ) | 107 | 108 |
| 108 | 109 | export const locationLayer = layer | | 110 | + | | 111 | +export const node = makeLocationNode({ service: Service, layer, deps: [] }) |
Collapse file Copy file name to clipboardExpand all lines: packages/core/src/aisdk.ts +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | export * as AISDK from "./aisdk" | 2 | 2 |
| | 3 | +import { makeLocationNode } from "./effect/node" | 3 | 4 | import type { LanguageModelV3 } from "@ai-sdk/provider" | 4 | 5 | import { Cause, Context, Effect, Layer, Schema, Scope } from "effect" | 5 | 6 | import { ModelV2 } from "./model" | @@ -231,4 +232,6 @@ export const locationLayer = Layer.effect( | 231 | 232 | }), | 232 | 233 | ) | 233 | 234 |
| | 235 | +export const node = makeLocationNode({ service: Service, layer: locationLayer, deps: [] }) | | 236 | + | 234 | 237 | export const defaultLayer = locationLayer |
Collapse file Copy file name to clipboardExpand all lines: packages/core/src/background-job.ts +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2,6 +2,7 @@ export * as BackgroundJob from "./background-job" | 2 | 2 |
| 3 | 3 | import { Cause, Clock, Context, Deferred, Effect, Exit, Layer, Scope, SynchronizedRef } from "effect" | 4 | 4 | import { Identifier } from "./id/id" | | 5 | +import { makeGlobalNode } from "./effect/node" | 5 | 6 |
| 6 | 7 | export type Status = "running" | "completed" | "error" | "cancelled" | 7 | 8 |
| @@ -362,3 +363,5 @@ export const make = Effect.gen(function* () { | 362 | 363 | export const layer = Layer.effect(Service, make) | 363 | 364 |
| 364 | 365 | export const defaultLayer = layer | | 366 | + | | 367 | +export const node = makeGlobalNode({ service: Service, layer, deps: [] }) |
Collapse file Copy file name to clipboardExpand all lines: packages/core/src/catalog.ts +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | export * as Catalog from "./catalog" | 2 | 2 |
| | 3 | +import { makeLocationNode } from "./effect/node" | 3 | 4 | import { Array, Context, Effect, Layer, Option, Order, pipe, Schema } from "effect" | 4 | 5 | import { Catalog } from "@opencode-ai/schema/catalog" | 5 | 6 | import { ModelV2 } from "./model" | @@ -296,3 +297,5 @@ export const locationLayer = layer.pipe( | 296 | 297 | Layer.provideMerge(Integration.locationLayer), | 297 | 298 | Layer.provideMerge(Policy.locationLayer), | 298 | 299 | ) | | 300 | + | | 301 | +export const node = makeLocationNode({ service: Service, layer, deps: [EventV2.node, Policy.node, Integration.node] }) |
Collapse file Copy file name to clipboardExpand all lines: packages/core/src/command.ts +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | export * as CommandV2 from "./command" | 2 | 2 |
| | 3 | +import { makeLocationNode } from "./effect/node" | 3 | 4 | import { Context, Effect, Layer, Types } from "effect" | 4 | 5 | import { Command } from "@opencode-ai/schema/command" | 5 | 6 | import { State } from "./state" | @@ -59,3 +60,5 @@ export const layer = Layer.effect( | 59 | 60 | ) | 60 | 61 |
| 61 | 62 | export const locationLayer = layer | | 63 | + | | 64 | +export const node = makeLocationNode({ service: Service, layer, deps: [] }) |
Collapse file Copy file name to clipboardExpand all lines: packages/core/src/config.ts +7Lines changed: 7 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | export * as Config from "./config" | 2 | 2 |
| | 3 | +import { makeLocationNode } from "./effect/node" | 3 | 4 | import path from "path" | 4 | 5 | import { type ParseError, parse } from "jsonc-parser" | 5 | 6 | import { Context, Effect, Layer, Option, Schema } from "effect" | @@ -218,3 +219,9 @@ export const layer = Layer.effect( | 218 | 219 | ) | 219 | 220 |
| 220 | 221 | export const locationLayer = layer.pipe(Layer.provideMerge(Policy.locationLayer)) | | 222 | + | | 223 | +export const node = makeLocationNode({ | | 224 | + service: Service, | | 225 | + layer, | | 226 | + deps: [FSUtil.node, Global.node, Location.node, Policy.node], | | 227 | +}) |
Collapse file Copy file name to clipboardExpand all lines: packages/core/src/credential.ts +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -5,6 +5,7 @@ import { Context, Effect, Layer, Schema } from "effect" | 5 | 5 | import { Credential } from "@opencode-ai/schema/credential" | 6 | 6 | import { Integration } from "@opencode-ai/schema/integration" | 7 | 7 | import { Database } from "./database/database" | | 8 | +import { makeGlobalNode } from "./effect/node" | 8 | 9 | import { CredentialTable } from "./credential/sql" | 9 | 10 |
| 10 | 11 | export const ID = Credential.ID | @@ -135,3 +136,5 @@ export const layer = Layer.effect( | 135 | 136 | ) | 136 | 137 |
| 137 | 138 | export const defaultLayer = layer.pipe(Layer.provide(Database.defaultLayer)) | | 139 | + | | 140 | +export const node = makeGlobalNode({ service: Service, layer, deps: [Database.node] }) |
Collapse file Copy file name to clipboardExpand all lines: packages/core/src/cross-spawn-spawner.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -24,7 +24,7 @@ import { | 24 | 24 | import * as NodeChildProcess from "node:child_process" | 25 | 25 | import { PassThrough } from "node:stream" | 26 | 26 | import launch from "cross-spawn" | 27 | | -import { LayerNode } from "./effect/layer-node" | | 27 | +import { makeGlobalNode } from "./effect/node" | 28 | 28 | import { filesystem, path } from "./effect/layer-node-platform" | 29 | 29 |
| 30 | 30 | const toError = (err: unknown): Error => (err instanceof globalThis.Error ? err : new globalThis.Error(String(err))) | @@ -503,6 +503,6 @@ export const layer: Layer.Layer<ChildProcessSpawner, never, FileSystem.FileSyste | 503 | 503 | ) | 504 | 504 |
| 505 | 505 | export const defaultLayer = layer.pipe(Layer.provide(NodeFileSystem.layer), Layer.provide(NodePath.layer)) | 506 | | -export const node = LayerNode.make({ service: ChildProcessSpawner, layer, deps: [filesystem, path] }) | | 506 | +export const node = makeGlobalNode({ service: ChildProcessSpawner, layer, deps: [filesystem, path] }) | 507 | 507 |
| 508 | 508 | export * as CrossSpawnSpawner from "./cross-spawn-spawner" |
Collapse file Copy file name to clipboardExpand all lines: packages/core/src/database/database.ts +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -8,7 +8,7 @@ import { Flag } from "../flag/flag" | 8 | 8 | import { isAbsolute, join } from "path" | 9 | 9 | import { DatabaseMigration } from "./migration" | 10 | 10 | import { InstallationChannel } from "../installation/version" | 11 | | -import { LayerNode } from "../effect/layer-node" | | 11 | +import { makeGlobalNode } from "../effect/node" | 12 | 12 |
| 13 | 13 | const makeDatabase = EffectDrizzleSqlite.makeWithDefaults() | 14 | 14 | type DatabaseShape = Effect.Success<typeof makeDatabase> | @@ -60,4 +60,4 @@ export const defaultLayer = Layer.unwrap( | 60 | 60 | }), | 61 | 61 | ).pipe(Layer.provide(Global.defaultLayer)) | 62 | 62 |
| 63 | | -export const node = LayerNode.make({ service: Service, layer: layerFromPath(path()), deps: [] }) | | 63 | +export const node = makeGlobalNode({ service: Service, layer: layerFromPath(path()), deps: [] }) |
|