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

Function startTool

packages/opencode/src/cli/cmd/run/demo.ts:451–475  ·  view source on GitHub ↗
(state: State, ref: Ref, metadata: Record<string, unknown> = {})

Source from the content-addressed store, hash-verified

449}
450
451function startTool(state: State, ref: Ref, metadata: Record<string, unknown> = {}): void {
452 feed(state, {
453 type: "message.part.updated",
454 properties: {
455 sessionID: state.id,
456 time: Date.now(),
457 part: {
458 id: ref.part,
459 sessionID: state.id,
460 messageID: ref.msg,
461 type: "tool",
462 callID: ref.call,
463 tool: ref.tool,
464 state: {
465 status: "running",
466 input: ref.input,
467 metadata,
468 time: {
469 start: ref.start,
470 },
471 },
472 },
473 },
474 } as Event)
475}
476
477function askPermission(state: State, item: Permit): void {
478 startTool(state, item.ref)

Callers 3

askPermissionFunction · 0.70
emitBashFunction · 0.70
emitQuestionFunction · 0.70

Calls 1

feedFunction · 0.70

Tested by

no test coverage detected