fix(core): publish skill source updates
This commit is contained in:
parent
0eaa75ec0f
commit
aca3b7813d
2 changed files with 18 additions and 0 deletions
|
|
@ -92,6 +92,7 @@ const layer = Layer.effect(
|
|||
},
|
||||
list: () => draft.sources as Source[],
|
||||
}),
|
||||
finalize: () => events.publish(Event.Updated, {}).pipe(Effect.asVoid),
|
||||
})
|
||||
|
||||
const load = Effect.fn("SkillV2.load")(function* (source: Source) {
|
||||
|
|
|
|||
|
|
@ -54,6 +54,23 @@ function waitForSkillUpdate() {
|
|||
}
|
||||
|
||||
describe("SkillV2", () => {
|
||||
it.live("publishes updates when skill sources change", () =>
|
||||
Effect.gen(function* () {
|
||||
const skill = yield* SkillV2.Service
|
||||
|
||||
yield* Effect.acquireUseRelease(
|
||||
waitForSkillUpdate(),
|
||||
({ deferred }) =>
|
||||
skill
|
||||
.transform((editor) =>
|
||||
editor.source({ type: "directory", path: AbsolutePath.make("/tmp/opencode-skills") }),
|
||||
)
|
||||
.pipe(Effect.andThen(Deferred.await(deferred)), Effect.timeout("1 second")),
|
||||
({ fiber }) => Fiber.interrupt(fiber),
|
||||
)
|
||||
}),
|
||||
)
|
||||
|
||||
it.live("registers sources and resolves later source precedence", () =>
|
||||
Effect.acquireRelease(
|
||||
Effect.promise(() => tmpdir()),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue