MCPcopy Create free account
hub / github.com/apache/maka / addSerializedBytes

Function addSerializedBytes

packages/code-mode/src/index.ts:135–147  ·  view source on GitHub ↗
(budget: SerializedByteBudget, bytes: number)

Source from the content-addressed store, hash-verified

133}
134
135function addSerializedBytes(budget: SerializedByteBudget, bytes: number): boolean {
136 if (budget.bytes > Number.MAX_SAFE_INTEGER - bytes) {
137 budget.bytes = Number.POSITIVE_INFINITY;
138 return false;
139 }
140 if (budget.bytes + bytes > budget.limit) {
141 budget.bytes =
142 budget.limit < Number.MAX_SAFE_INTEGER ? budget.limit + 1 : Number.POSITIVE_INFINITY;
143 return false;
144 }
145 budget.bytes += bytes;
146 return true;
147}
148
149export interface CodeModeLimits {
150 maxSourceBytes: number;

Callers 2

countSerializedValueFunction · 0.85
countJsonStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected