Skip to content

Identify the plugin and its version to the API#10

Merged
alex-w-99 merged 2 commits into
mainfrom
feat/plugin-user-agent
Jul 27, 2026
Merged

Identify the plugin and its version to the API#10
alex-w-99 merged 2 commits into
mainfrom
feat/plugin-user-agent

Conversation

@alex-w-99

Copy link
Copy Markdown
Contributor

Summary

The SDK announces itself in the User-Agent and accepts a caller token ahead of its own, but the plugin never set one, so its requests were indistinguishable from any other TypeScript SDK caller. There was no way to tell which plugin, or which version of it, a given agent was running.

This is the opencode half of a fleet-wide change; the other four plugins carry the same change alongside an inbound-email fix. This repo does not need that fix — its email path already reads message.received's body field (src/gateway/dispatch.ts), so only the User-Agent and version work applies here.

What's here

  • pluginUserAgent() yields inkbox-opencode/<version>, passed as userAgentPrefix where the client is constructed, producing inkbox-opencode/<version> inkbox-typescript/<sdk version>.
  • The version is read from package.json at runtime via createRequire, not hardcoded, so the token cannot drift from the declared version. tsc emits to dist/, so the relative path resolves from both the build output and the source tree.
  • This adds no new data channel: the User-Agent header is already sent on every request. It fills in a field that was previously blank.

Version

Realigned to 0.2.5, the shared number across the plugin fleet. Previously each repo counted independently (0.2.4 / 0.2.2 / 0.1.4 / 0.1.3 / 0.1.0), so a version told you nothing about which fleet release you were on. 0.2.5 is one above the previous fleet maximum, so every repo moves strictly up and no version number is reused for different content. This is the largest jump of the five (0.1.0 to 0.2.5) purely because this repo counted from the lowest starting point; it carries no implication about the size of this change.

Tests

tests/user-agent.test.ts asserts the token matches the package version and is stable across calls. Full suite: 644 passed, tsc --noEmit clean.

The SDK announces itself in the User-Agent and accepts a caller token
ahead of its own, but the plugin never set one, so an inbound request
was indistinguishable from any other TypeScript SDK caller. Without that
there is no way to tell which plugin, or which version of it, a given
agent is running.

Pass userAgentPrefix where the client is constructed, sourced from
package.json at runtime so it cannot drift from the declared version.

Version is realigned to 0.2.5, the shared number across the plugin
fleet, so the token identifies a fleet release rather than a per-repo
count.
@alex-w-99
alex-w-99 force-pushed the feat/plugin-user-agent branch from 946de49 to 5623fe7 Compare July 27, 2026 02:35
@alex-w-99
alex-w-99 marked this pull request as ready for review July 27, 2026 02:40
@alex-w-99
alex-w-99 merged commit f0c4c4e into main Jul 27, 2026
10 checks passed
@alex-w-99
alex-w-99 deleted the feat/plugin-user-agent branch July 27, 2026 03:05
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.

1 participant