mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #8748] [MERGED] feat(capabilities): a package call can ask for a 1-hour cache on its marked prompt (API 1.815) #8782
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#8782
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8748
Author: @SpicyMarinara
Created: 11/3/2026
Status: ✅ Merged
Merged: 11/3/2026
Merged by: @SpicyMarinara
Base:
staging← Head:feat/capability-cache-ttl📝 Commits (2)
e0bcc7afeat(capabilities): a package call can ask for a 1-hour cache on its marked prompt (API 1.815)7d58c4cMerge branch 'staging' into feat/capability-cache-ttl📊 Changes
6 files changed (+58 additions, -5 deletions)
View changed files
📝
docs/development/optional-agent-packages.md(+12 -0)📝
packages/server/src/services/capability-packages/capability-language-model.service.ts(+3 -2)📝
packages/shared/src/schemas/capability-package.schema.ts(+4 -1)📝
packages/shared/src/types/capability-runtime.ts(+6 -0)📝
scripts/regressions/capability-language-model-prompt-cache.regression.ts(+31 -0)📝
scripts/regressions/capability-package-lifecycle.regression.ts(+2 -2)📄 Description
Linked issue
Closes #8746
Why this change
Otome Hearth marks its story context for caching (1.814), but the cache time comes from the connection: 5 minutes unless "Extended token caching (1 hour)" is on. A scene is written when the player reaches the previous one, usually more than 5 minutes apart, so the cached context expired between scenes and every scene paid the cache-write price again. The maintainer's Anthropic usage on 2026-11-03 showed about 534k cache-write tokens against 30k cache reads in four hours. The maintainer asked for the 1-hour cache in Otome Hearth on Anthropic connections; this is the Engine side of that.
What changed
CapabilityLanguageModelCompletionOptions.cacheTtl?: "5m" | "1h"(packages/shared/src/types/capability-runtime.ts), withsupportedCapabilityApibumped to{1, 815}and its history line.capability-language-model.service.ts: for a call with marked messages,anthropicExtendedCacheTtlfollows the call'scacheTtlwhen it has one, and otherwise the connection's switch, as before.docs/development/optional-agent-packages.md. The translated packs are tracked in a[docs-i18n]follow-up issue.Validation
pnpm checkpasses locallyCONTRIBUTING.mdWhat the agent ran:
pnpm checkpasses (exit 0). The 12 existing client lint warnings are in files this PR doesn't touch.scripts/regressions/capability-language-model-prompt-cache.regression.ts(real Anthropic request bodies against a loopback fixture) now covers:ttl: "1h"on its marked blocks;cacheTtlout keeps the connection's 1 hour;cache_control.It fails without the service change.
node ./scripts/run-regressions.mjs --filter capability: 29/29 pass. The lifecycle regression now pins 1.815.Manual verification notes
cacheTtl: "1h"on an Anthropic connection whose 1-hour cache is off: Anthropic's usage shows "Cache write (1h)" for those calls, and reads on calls within the hour.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.