MCPcopy Create free account
hub / github.com/anomalyco/opencode / taskSession

Function taskSession

packages/session-ui/src/components/message-part.tsx:543–558  ·  view source on GitHub ↗
(
  input: Record<string, any>,
  path: string,
  sessions: Session[] | undefined,
  agents?: readonly { name: string; color?: string }[],
)

Source from the content-addressed store, hash-verified

541}
542
543function taskSession(
544 input: Record<string, any>,
545 path: string,
546 sessions: Session[] | undefined,
547 agents?: readonly { name: string; color?: string }[],
548) {
549 const parentID = currentSession(path)
550 if (!parentID) return
551 const description = typeof input.description === "string" ? input.description : ""
552 const agent = taskAgent(input.subagent_type, agents).name
553 return (sessions ?? [])
554 .filter((session) => session.parentID === parentID && !session.time?.archived)
555 .filter((session) => (description ? session.title.startsWith(description) : true))
556 .filter((session) => (agent ? session.title.includes(`@${agent}`) : true))
557 .sort((a, b) => (b.time.created ?? 0) - (a.time.created ?? 0))[0]?.id
558}
559
560const CONTEXT_GROUP_TOOLS = new Set(["read", "glob", "grep", "list"])
561const HIDDEN_TOOLS = new Set(["todowrite"])

Callers 1

renderFunction · 0.85

Calls 2

currentSessionFunction · 0.85
taskAgentFunction · 0.85

Tested by

no test coverage detected