fix: derive the model maxlength and document the frame-focus cases

maxlength was hard-coded to 200 in the markup while MAX_MODEL_CHARS lives
in lib/defaults.js; lowering the constant would have left the input
accepting values mergeSettings() silently discards. It is now set from the
constant at render time.

Also records the hasFocus() gate's four manual frame cases in AGENTS.md,
including the findbar trade-off, and notes that fitToBudget()'s budget
guarantee assumes mergeSettings-validated input.
This commit is contained in:
golem
2026-08-01 23:21:45 -06:00
parent 8fcc93c541
commit 17bccc1ade
4 changed files with 27 additions and 6 deletions
+3
View File
@@ -56,6 +56,9 @@ function lastWhitespaceIndex(text) {
}
// Returns the longest prefix of `prompt` whose finished URL fits the budget.
// The guarantee assumes `settings` came through mergeSettings(): only `q` is
// ever trimmed, so a model longer than MAX_MODEL_CHARS could blow the budget on
// its own and leave no room for `q` at all. Every real caller goes via load().
// Slicing happens by CODE POINT on the decoded string, so a surrogate pair can
// never be split and a percent-escape can never be severed (encoding happens
// afterwards, via URLSearchParams).