Skip to content

Skill: use forkScoped + Fiber.join for lazy init#18282

Draft
kitlangton wants to merge 7 commits intodevfrom
kit/skill-lazy-init
Draft

Skill: use forkScoped + Fiber.join for lazy init#18282
kitlangton wants to merge 7 commits intodevfrom
kit/skill-lazy-init

Conversation

@kitlangton
Copy link
Contributor

Summary

  • Replace the ensure() / Effect.promise lazy-init pattern in Skill with forkScoped + Fiber.join
  • Removes the Cache type, State.task field, and create helper function
  • Skill scanning is forked during layer construction and joined on first method call — same laziness semantics, more idiomatic Effect

Test plan

  • bun run typecheck passes
  • bun run test passes
  • Verify skills load correctly on first /skill invocation

Constrain BusEvent.define to ZodObject instead of ZodType so TS knows
event properties are always a record. Type GlobalBus payload as
{ type: string; properties: Record<string, unknown> } instead of any.

Refactor watcher test to use Bus.subscribe instead of raw GlobalBus
listener, removing hand-rolled event types and unnecessary casts.
…operations

Convert add/scan/load from async functions wrapped in Effect.promise to
proper Effect.fn generators using AppFileSystem.Service for isDir, glob,
and up operations. This eliminates the nested Effect.runPromise call for
discovery.pull and enables concurrent skill file processing.
# ------------------------ >8 ------------------------
# Do not modify or remove the line above.
# Everything below it will be ignored.
#
# Conflicts:
#	packages/opencode/src/skill/skill.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant