MCPcopy
hub / github.com/anomalyco/opencode / extract

Function extract

packages/opencode/src/session/instruction.ts:17–32  ·  view source on GitHub ↗
(messages: SessionV1.WithParts[])

Source from the content-addressed store, hash-verified

15import type { MessageID } from "./schema"
16
17function extract(messages: SessionV1.WithParts[]) {
18 const paths = new Set<string>()
19 for (const msg of messages) {
20 for (const part of msg.parts) {
21 if (part.type === "tool" && part.tool === "read" && part.state.status === "completed") {
22 if (part.state.time.compacted) continue
23 const loaded = part.state.metadata?.loaded
24 if (!loaded || !Array.isArray(loaded)) continue
25 for (const p of loaded) {
26 if (typeof p === "string") paths.add(p)
27 }
28 }
29 }
30 }
31 return paths
32}
33
34export interface Interface {
35 readonly clear: (messageID: MessageID) => Effect.Effect<void>

Callers 3

binary.tsFile · 0.85
instruction.tsFile · 0.85
loadedFunction · 0.85

Calls 1

addMethod · 0.65

Tested by

no test coverage detected