singularity-forge/packages
Mikael Hugo a49ea1da87 feat(sf/prompts): Phase 4 — cache_control breakpoints at static/dynamic boundary
Split reorderForCaching into a structured reorderAndSplitForCaching that
returns {before, after} at the semi-static→dynamic section boundary.

- prompt-ordering.js: export reorderAndSplitForCaching — returns null if no
  dynamic sections, otherwise {before: static+semi-static, after: dynamic}
- auto.js: import and wire reorderAndSplitForCaching into deps
- phases-unit.js: use split function; pass promptParts to runUnit when split
  succeeds; fall back to flat reorderForCaching when null
- run-unit.js: when promptParts is present, send a two-block content array
  [{type:text, text:before, cache_control:{type:ephemeral}}, {type:text, text:after}]
  so Anthropic-compatible providers cache the stable prefix
- openai-completions.ts: preserve cache_control on text parts in convertMessages;
  skip maybeAddOpenRouterAnthropicCacheControl if any part already has cache_control

Tests: 5 new contract tests for reorderAndSplitForCaching; all 4502 unit tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-13 01:36:22 +02:00
..
agent-core fix(lint): fix all pre-existing lint failures 2026-05-11 04:02:31 +02:00
ai feat(sf/prompts): Phase 4 — cache_control breakpoints at static/dynamic boundary 2026-05-13 01:36:22 +02:00
coding-agent fix(bash): add 120s default timeout to prevent autonomous mode hangs 2026-05-11 19:12:33 +02:00
daemon build: switch full build pipeline to TypeScript 7 native (tsgo) 2026-05-10 11:58:58 +02:00
google-gemini-cli-provider fix(lint): fix all pre-existing lint failures 2026-05-11 04:02:31 +02:00
native build: switch full build pipeline to TypeScript 7 native (tsgo) 2026-05-10 11:58:58 +02:00
rpc-client build: switch full build pipeline to TypeScript 7 native (tsgo) 2026-05-10 11:58:58 +02:00
tui fix(lint): fix all pre-existing lint failures 2026-05-11 04:02:31 +02:00