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

Function turn

packages/app/e2e/smoke/session-timeline.fixture.ts:183–223  ·  view source on GitHub ↗
(index: number)

Source from the content-addressed store, hash-verified

181}
182
183function turn(index: number): Message[] {
184 const diff = index % 9 === 0 ? [fileDiff(`src/generated/summary-${index}.ts`, index)] : []
185 const user = userMessage(targetID, index, 100 + (index % 4) * 80, diff)
186 const parts = [
187 ...(index % 5 === 0 ? [reasoningPart(index, 0, 420)] : []),
188 ...(index % 3 === 0
189 ? [
190 toolPart(index, 0, "read", { filePath: `src/generated/file-${index}.ts`, offset: 0, limit: 80 }, 220),
191 toolPart(index, 5, "glob", { path: directory, pattern: `**/*sample-${index}*.ts` }, 140),
192 toolPart(index, 1, "grep", { path: directory, pattern: `sample-${index}`, include: "*.ts" }, 180),
193 toolPart(index, 6, "list", { path: `src/generated/${index}` }, 120),
194 ]
195 : []),
196 textPart(index, 2, 160 + (index % 6) * 90),
197 ...(index % 4 === 0 ? [toolPart(index, 3, "edit", { filePath: `src/generated/file-${index}.ts` }, 700)] : []),
198 ...(index % 6 === 0
199 ? [toolPart(index, 7, "write", { filePath: `src/generated/write-${index}.ts`, content: code(index, 28) }, 560)]
200 : []),
201 ...(index % 8 === 0
202 ? [toolPart(index, 8, "apply_patch", { files: [`src/generated/patch-${index}.ts`] }, 620)]
203 : []),
204 ...(index % 7 === 0 ? [toolPart(index, 4, "bash", { command: "bun typecheck" }, 620)] : []),
205 ...(index % 10 === 0 ? [toolPart(index, 9, "webfetch", { url: "https://example.com/docs/sample" }, 120)] : []),
206 ...(index % 11 === 0 ? [toolPart(index, 10, "websearch", { query: "sample movement notes" }, 240)] : []),
207 ...(index % 13 === 0
208 ? [
209 toolPart(
210 index,
211 11,
212 "question",
213 { questions: [{ question: "Use generated fixture?" }, { question: "Keep same row shape?" }] },
214 120,
215 ),
216 ]
217 : []),
218 ...(index % 17 === 0
219 ? [toolPart(index, 12, "task", { description: "Inspect generated fixture", subagent_type: "explore" }, 160)]
220 : []),
221 ]
222 return [user, assistantMessage(targetID, index, user.info.id, parts)]
223}
224
225const targetMessages = Array.from({ length: 72 }, (_, index) => turn(index)).flat()
226const sourceMessages = Array.from({ length: 12 }, (_, index) => [

Callers 2

SessionTodoDockFunction · 0.50

Calls 7

fileDiffFunction · 0.70
userMessageFunction · 0.70
reasoningPartFunction · 0.70
toolPartFunction · 0.70
textPartFunction · 0.70
codeFunction · 0.70
assistantMessageFunction · 0.70

Tested by

no test coverage detected