Skip to content

v1.1.6: Merge pull request #11 from Max-Samson/pr-10

Choose a tag to compare

@Max-Samson Max-Samson released this 19 Sep 05:21
· 24 commits to main since this release
45d0671

Summary

Fixes a bug where custom pricing.json file overrides were never applied and the file change watcher never fired (PR #10), and bumps the release
version to 1.1.6:

  • User-visible change:

    • Restores custom pricing configuration: previously, /dsh-usage-chart/pricing reported source: "builtin" for every model even when a custom pricing.json was present and valid, and file edits
      never triggered automatic recalculation.
    • Fixes Cordis lifecycle timing in src/index.ts: ctx.effect(() => fileSource.dispose(), ...) invoked dispose() synchronously at plugin registration time while the fiber was being created and
      registered undefined as the disposer. This prematurely killed filePricingSource before its initial async read resolved and closed the directory watcher. Changing this to return a disposer function
      (ctx.effect(() => () => fileSource.dispose(), ...)) ensures the file source remains active throughout the fiber lifecycle and is released only when the plugin is unloaded.
    • Aligns test mocks in tests/core.test.mjs, tests/pricing.test.mjs, and tests/rounds.test.mjs with Cordis lifecycle semantics (collecting disposers and running them in after()).
    • Adds a dedicated regression test covering the /pricing route with user pricing.json overrides enabled.
    • Bumps version to 1.1.6 across package.json, package-lock.json, README.md, README_ZH.md, CHANGELOG.md, and CHANGELOG_ZH.md.
  • Why it belongs in this plugin:

    • Accurate token cost accounting relies on the single-source-of-truth resolution hierarchy: User pricing.json override → Built-in official pricing → Conservative fallback. Premature disposal
      broke the first and highest-priority tier entirely for users configuring custom or enterprise rates.