@sema-agent/core
Version:
Stateless, task-oriented AI agent core
11 lines (10 loc) • 382 B
JavaScript
import { DEFAULT_CHARS_PER_TOKEN } from "../internal/harness.js";
export function contextUsageSections(sections) {
if (sections === undefined || sections.length === 0)
return undefined;
return sections.map((s) => ({
id: s.id,
tokens: Math.ceil(s.chars / DEFAULT_CHARS_PER_TOKEN),
...(s.band !== undefined ? { kind: s.band } : {}),
}));
}