Repository navigation
Conversation
validateConfigTypes was about 440 lines of typeof checks, one branch per config key, beside a hand maintained 44 entry list of dotted key strings that had to stay in sync with the interfaces, the defaults and the JSON schema by hand. It is a declarative rule table now, and the set of known keys is derived from defaultConfig rather than restated. The three keys that are valid but absent from the defaults are listed separately. Five merge functions plus deepCloneConfig became one recursive merge over structuredClone. getConfigPaths lost three copies of the same existsSync ternary.
loadPruneMessagesState revalidated every field of a file the same module had just written. Shared guards and one block deserializer replace the per field checks. The explicit restore of activeBlockIds and activeByAnchorMessageId is gone. The final loop already repopulates both from block.active, which is where serialization reads them from, so the restore was redundant. loadSessionState validated and deduped three anchor sets with three near identical blocks. One loop over the key names now, with the same log text. PersistedPruneMessagesState was declared verbatim in two files. It lives in types.ts now, which both already import from, avoiding a cycle since persistence.ts imports a function from utils.ts. buildSessionState duplicated the hydration in ensureSessionInitialized. The two had already drifted: the TUI copy never picked up currentTurn or live turn nudge anchors. It calls the shared path now. resetSessionState restated about 25 field assignments from createSessionState. It derives from a fresh state and carries over idFormat, compressionTiming and the two cached maps so external references to them stay valid.
pruneToolOutputs, pruneToolInputs and pruneToolErrors were three loops differing by a status check, a tool name check and a replacement string. One function takes them as arguments. pruneFullTool is gone. Its only call site was commented out. applyAnchoredNudges made six near identical calls, three per compression mode, differing only in the anchor set and the prompt text. It loops over a table now. injectMessageIds and injectAnchoredNudge shared a seven line tail that placed a synthetic text part before the first tool part. That is prependSyntheticPart now. The two functions stay separate: the user path uses all text parts and the assistant path uses tool parts, so folding them together would need parameterization longer than what it removes. extractParameterKey merged the glob and grep branches, and the websearch and codesearch branches, which had identical bodies and identical fall through. The single field tools now share one lookup.
iteration-nudge.ts, turn-nudge.ts and context-limit-nudge.ts each held one template string. They are constants in store.ts now. PROMPT_KEYS restated the same seven keys that PROMPT_DEFINITIONS already carries. It derives from the definitions.
.npmignore does nothing next to the files array in package.json. When both are present files wins, and the files array is the one that runs. report() in lib/v2/index.ts was a stub the V2 entry point never called on a path that reaches a log. reportToLog does the same write directly.
amnesiaof
force-pushed
the
fix/sdk-media-asset-and-dedup
branch
from
October 3, 2026 08:25
a12daae to
ae1cbb8
Compare
This was referenced Oct 3, 2026
Author
|
@Tarquinen whenever you have a moment, could you take a look? This collapses duplicated helpers. Best merged after #651. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Result: 16 files, +442 -1154. Pure internal consolidation, no dependency changes and no dependency-related lockfile churn:
package.jsonandpackage-lock.jsonare byte-identical tomasterhere.Everything is derived from a
ponytail-auditpass overlib/. Each commit reverts on its own.Duplication removed
validateConfigTypeswas a 440 linetypeofladder next to a 44 entry list of config keys kept in sync by hand with the interfaces, the defaults and the JSON schema. It is a rule table now, and the set of known keys is derived fromdefaultConfig.Five config merge functions plus
deepCloneConfigbecame one recursive merge overstructuredClone.pruneToolOutputs,pruneToolInputsandpruneToolErrorswere three loops differing by a status check, a tool name check and a replacement string. They are one function now.loadPruneMessagesStaterevalidated every field of a file the same module had just written. Shared guards and one block deserializer replace the per field checks.PersistedPruneMessagesStatewas declared verbatim in two files.applyAnchoredNudgesmade six near identical calls, three per compression mode. It loops over a table now.buildSessionStateduplicated the hydration inensureSessionInitialized, and the two had already drifted.extractParameterKeyhad identical glob and grep branches, and identical websearch and codesearch branches.Three prompt files held one template string each.
PROMPT_KEYSrestated seven keysPROMPT_DEFINITIONSalready carries. Both are gone now that the templates and the key list live with the definitions.Behavior changes
Unknown nested keys in
dcp.jsonnow reach the merged config instead of being dropped. The unknown key warning still fires.TUI session state also picks up
currentTurnand live turn nudge anchors, which the duplicated path never had.resetSessionStatenow derives from a fresh state and carries overidFormat,compressionTimingand the two cached maps, so external references to those maps stay valid.Also removed
.npmignoredoes nothing next tofilesinpackage.json. When both are presentfileswins, andfilesis the one that runs.pruneFullToolhad one call site, commented out.report()inlib/v2/index.tswas a stub nothing called.reportToLogdoes the same write directly.Verification
bun test: 122 pass / 2 fail, identical tomaster, and both failures pre-date this branch (V2 range compression resolves block IDs...,relay preserves text/binary frames...)tsc --noEmit: cleantsc --emitDeclarationOnly: cleantsupbuild: successscripts/verify-package.mjs: passed, 230 tarball entriesprettier --checkis clean on every changed file when line endings are normalized. Note for anyone re-running it on Windows:core.autocrlfleaves the working tree on CRLF while the committed blobs are LF, so prettier reports style issues in files this branch never touched.tsconfig.jsonandtui.tsxare byte-identical tomasterand still get flagged.Not in this PR
The
@opencode/pluginbump and the OpenTUI / solid-js peer move were split out into #651, together with theAssetfix they force. Keeping them separate matters here because #627 edits those same dependency lines in the opposite direction.So the sequence is #648 (anywhere), then #651, then this one.