Skip to content

chore: patch security advisories, report non-cached input tokens (#146), refresh model data - #147

Merged
justin-carper merged 5 commits into
mainfrom
maintenance-security
Oct 27, 2026
Merged

justin-carper merged 5 commits into
mainfrom
maintenance-security

Conversation

@justin-carper

Copy link
Copy Markdown
Collaborator

Summary

Patches the open security advisories, fixes the missing non-cached input tokens from #146, and regenerates the model data so the weekly drift check passes again. Supersedes Dependabot PRs #139, #143 and #144.

Security (npm audit: 10 findings → 0)

  • @cursor/sdk 1.0.32 → 1.1.0, @connectrpc/connect-node → 2.3.0
  • @opencode-ai/plugin + @opencode-ai/sdk → 1.19.4
  • vitest → 5.0.5 (vite 8.3.5, @vitest/mocker 5.0.5), which clears the vite / launch-editor / mocker advisories
  • source-map-js → 1.2.2, through a postcss refresh
  • New overrides:
  • Dropped the undici override: nothing in the tree depends on undici any more.
  • @cursor/sdk's peer range for zod is ^3.25.0 || ^4.0.0, so it now dedupes to zod 4.6.7.
  • Consumers are still exposed: npm doesn't publish overrides. People who install this package still get zod 4.1.8 and toml 4.x from @opencode-ai/plugin's pinned versions until upstream bumps them.
  • Skipped on purpose: tsup 9, TypeScript 7, @ai-sdk/provider 4.

Fix: non-cached input tokens (#146)

opencode showed 0 input tokens for Cursor models, so that input was never priced. The cause differs from the one in the issue:

  • Cursor's inputTokens already includes cache reads and writes. @cursor/sdk's toTokenUsage computes totalTokens = inputTokens + outputTokens, and Cursor staff confirmed the same for hook payloads. So inputTokens.total was already correct.
  • noCache was left undefined. opencode 2.x reads it directly as the non-cached input, so input came out as 0.
  • Now noCache = inputTokens − cacheRead − cacheWrite, clamped at 0. The turn's optional reasoningTokens passes through addUsage to outputTokens.reasoning.

Model data

Regenerated src/model-limits.ts with npm run sync:model-limits, because the scheduled drift check was failing on main:

  • claude-sonnet-5-5 cache read $0.2 → $0.1
  • gemini-3.7-flash and gemini-3.8-flash output $3.5 → $3.75

Test fix

test/mcp-config.test.ts failed 6 tests on main on any machine with global skills installed. The config hook's skill mirror read the real home directory, and its warning crashed pluginLog on the fake client. The test now mocks homedir to a temp dir, the same way plugin-skill-mirror.test.ts does.

Verification

  • npm run prepublishOnly: typecheck clean, 42 files / 646 tests pass, build OK
  • npm audit: 0 vulnerabilities
  • npm run sync:model-limits -- --check: up to date
  • Not run: a live opencode + Cursor turn. The usage mapping is covered by unit tests and a doStream test with a fake agent.

Closes #146

…t from real home

- @cursor/sdk ^1.1.0, @opencode-ai/plugin + sdk ^1.19.4, vitest ^5.0.5
  (vite 8.3.5, @vitest/mocker 5.0.5), postcss -> source-map-js 1.2.2
- overrides: zod ^4.6.6 under @opencode-ai/plugin, toml ^5.0.1; drop the
  undici override (no longer in the tree)
- mcp-config test: mock homedir so the config hook's skill mirror does not
  read the developer's real skills (crashed pluginLog on machines with skills)
…146)

Cursor's inputTokens already includes cache reads/writes, so it stays the
V3 inputTokens.total. noCache was left undefined; opencode 2.x reads it
directly, so input showed as 0 and was never priced. Derive it as
inputTokens - cacheRead - cacheWrite (clamped at 0) and pass the turn's
reasoningTokens through as outputTokens.reasoning.
Weekly drift check failed on main. claude-sonnet-5-5 cache read 0.2 -> 0.1;
gemini-3.7/3.8-flash output 3.5 -> 3.75.
@justin-carper
justin-carper merged commit 85c99fa into main Oct 27, 2026
8 checks passed
@justin-carper
justin-carper deleted the maintenance-security branch October 27, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Non-cached input tokens are dropped from usage, so input is always 0 and cost is under-reported

1 participant