File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { EOL } from "os"
2+ import { Effect } from "effect"
3+ import { AppRuntime } from "@/effect/app-runtime"
24import { Skill } from "../../../skill"
35import { bootstrap } from "../../bootstrap"
46import { cmd } from "../cmd"
@@ -9,7 +11,12 @@ export const SkillCommand = cmd({
911 builder : ( yargs ) => yargs ,
1012 async handler ( ) {
1113 await bootstrap ( process . cwd ( ) , async ( ) => {
12- const skills = await Skill . all ( )
14+ const skills = await AppRuntime . runPromise (
15+ Effect . gen ( function * ( ) {
16+ const skill = yield * Skill . Service
17+ return yield * skill . all ( )
18+ } ) ,
19+ )
1320 process . stdout . write ( JSON . stringify ( skills , null , 2 ) + EOL )
1421 } )
1522 } ,
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import { ProviderRoutes } from "./provider"
2424import { EventRoutes } from "./event"
2525import { WorkspaceRouterMiddleware } from "./middleware"
2626import { AppRuntime } from "@/effect/app-runtime"
27+ import { Effect } from "effect"
2728
2829export const InstanceRoutes = ( upgrade : UpgradeWebSocket ) : Hono =>
2930 new Hono ( )
@@ -215,7 +216,12 @@ export const InstanceRoutes = (upgrade: UpgradeWebSocket): Hono =>
215216 } ,
216217 } ) ,
217218 async ( c ) => {
218- const skills = await Skill . all ( )
219+ const skills = await AppRuntime . runPromise (
220+ Effect . gen ( function * ( ) {
221+ const skill = yield * Skill . Service
222+ return yield * skill . all ( )
223+ } ) ,
224+ )
219225 return c . json ( skills )
220226 } ,
221227 )
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import { NamedError } from "@opencode-ai/util/error"
77import type { Agent } from "@/agent/agent"
88import { Bus } from "@/bus"
99import { InstanceState } from "@/effect/instance-state"
10- import { makeRuntime } from "@/effect/run-service"
1110import { Flag } from "@/flag/flag"
1211import { Global } from "@/global"
1312import { Permission } from "@/permission"
@@ -262,22 +261,4 @@ export namespace Skill {
262261 . map ( ( skill ) => `- **${ skill . name } **: ${ skill . description } ` ) ,
263262 ] . join ( "\n" )
264263 }
265-
266- const { runPromise } = makeRuntime ( Service , defaultLayer )
267-
268- export async function get ( name : string ) {
269- return runPromise ( ( skill ) => skill . get ( name ) )
270- }
271-
272- export async function all ( ) {
273- return runPromise ( ( skill ) => skill . all ( ) )
274- }
275-
276- export async function dirs ( ) {
277- return runPromise ( ( skill ) => skill . dirs ( ) )
278- }
279-
280- export async function available ( agent ?: Agent . Info ) {
281- return runPromise ( ( skill ) => skill . available ( agent ) )
282- }
283264}
You can’t perform that action at this time.
0 commit comments