MCPcopy Index your code
hub / github.com/Opencode-DCP/opencode-dynamic-context-pruning / buildMessages

Function buildMessages

tests/compress-range.test.ts:80–125  ·  view source on GitHub ↗
(sessionID: string)

Source from the content-addressed store, hash-verified

78}
79
80function buildMessages(sessionID: string): WithParts[] {
81 return [
82 {
83 info: {
84 id: "msg-subagent-prompt",
85 role: "user",
86 sessionID,
87 agent: "codebase-analyzer",
88 model: {
89 providerID: "anthropic",
90 modelID: "claude-test",
91 },
92 time: { created: 1 },
93 } as WithParts["info"],
94 parts: [textPart("msg-subagent-prompt", sessionID, "part-1", "Investigate the issue")],
95 },
96 {
97 info: {
98 id: "msg-assistant-1",
99 role: "assistant",
100 sessionID,
101 agent: "codebase-analyzer",
102 time: { created: 2 },
103 } as WithParts["info"],
104 parts: [
105 textPart("msg-assistant-1", sessionID, "part-2", "I found the relevant code path"),
106 ],
107 },
108 {
109 info: {
110 id: "msg-user-2",
111 role: "user",
112 sessionID,
113 agent: "codebase-analyzer",
114 model: {
115 providerID: "anthropic",
116 modelID: "claude-test",
117 },
118 time: { created: 3 },
119 } as WithParts["info"],
120 parts: [
121 textPart("msg-user-2", sessionID, "part-3", "Please compress the initial findings"),
122 ],
123 },
124 ]
125}
126
127test("compress range rebuilds subagent message refs after session state was reset", async () => {
128 const sessionID = `ses_subagent_compress_${Date.now()}`

Callers 1

Calls 1

textPartFunction · 0.70

Tested by

no test coverage detected