MCPcopy Index your code
hub / github.com/anomalyco/opencode / define

Function define

packages/opencode/src/tool/tool.ts:151–169  ·  view source on GitHub ↗
(
  id: ID,
  init: Effect.Effect<Init<Parameters, Result>, never, R>,
)

Source from the content-addressed store, hash-verified

149}
150
151export function define<
152 Parameters extends Schema.Decoder<unknown>,
153 Result extends Metadata,
154 R,
155 ID extends string = string,
156>(
157 id: ID,
158 init: Effect.Effect<Init<Parameters, Result>, never, R>,
159): Effect.Effect<Info<Parameters, Result>, never, R | Truncate.Service | Agent.Service> & { id: ID } {
160 return Object.assign(
161 Effect.gen(function* () {
162 const resolved = yield* init
163 const truncate = yield* Truncate.Service
164 const agents = yield* Agent.Service
165 return { id, init: wrap(id, resolved, truncate, agents) }
166 }),
167 { id },
168 )
169}
170
171export function init<P extends Schema.Decoder<unknown>, M extends Metadata>(
172 info: Info<P, M>,

Callers

nothing calls this directly

Calls 1

wrapFunction · 0.70

Tested by

no test coverage detected