Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
Repair the reservation workflow across stock.ts, requests.ts and allocate.ts. Preserve exported types/functions. Stock SKU and request ID/SKU are trimmed, case-sensitive strings and must be nonempty. Stock units must be a nonnegative integer; request quantity must be a positive integer. Reject any invalid record with RangeError before allocation; validate duplicates too. Combine duplicate stock SKUs by adding units. Deduplicate request IDs after trimming: first occurrence wins, ignoring later valid duplicates. Process requests in their original order. Accept a request only if its complete quantity is available; rejected requests consume no stock. Unknown SKU rejection reason is unknown-sku; insufficient quantity reason is insufficient-stock. reserve returns {accepted: string[], rejected: {id,reason}[], remaining: Record<string,number>}; preserve request order in accepted/rejected and sort remaining keys using code-point order. Include untouched stock SKUs in remaining, including zero. Do not mutate inputs. Only the three source files may change. Read all three and acceptance.test.ts, then run node --test acceptance.test.ts. Do not change tests.