MCPcopy Create free account
hub / github.com/cortexkit/magic-context / ballast

Method ballast

packages/e2e-tests/src/harness.ts:212–230  ·  view source on GitHub ↗

* Generate ~`tokens` tokens of varied, realistic prose ballast. * * The protected-tail boundary (v3) is SIZE-based: it measures the true-raw * token content of the session, not the mock's fabricated usage numbers. * Tests that fake pressure (90K `input_tokens` on a session whose

(tokens: number)

Source from the content-addressed store, hash-verified

210 * stable ~4 chars/token so the size math holds.
211 */
212 ballast(tokens: number): string {
213 const words = [
214 "boundary", "historian", "compartment", "schedule", "pressure",
215 "tokens", "window", "publish", "transform", "session", "marker",
216 "budget", "eligible", "protected", "ordinal", "snapshot", "replay",
217 "decision", "threshold", "baseline", "measure", "archive", "deliver",
218 ];
219 const target = Math.max(0, Math.round(tokens * 4)); // ~4 chars/token
220 const parts: string[] = [];
221 let length = 0;
222 let i = 0;
223 while (length < target) {
224 const w = words[i % words.length];
225 parts.push(`${w}${i % 17 === 0 ? "." : ""}`);
226 length += w.length + 1;
227 i += 1;
228 }
229 return parts.join(" ");
230 }
231
232 async sendPrompt(
233 sessionId: string,

Calls

no outgoing calls

Tested by

no test coverage detected