Skip to content

Conversation

@richhankins
Copy link
Contributor

Summary

Add clientUserAgent support to identify context-connectors usage in Augment backend analytics. This enables tracking:

  • Which product is calling (context-connectors vs other SDK consumers)
  • Which interface is being used (CLI, SDK, MCP, agent)
  • For MCP: which client is connecting (prepared for future use)

User-Agent Format

context-connectors/{version} via:{interface}
context-connectors/{version} via:mcp client:{name}/{version}  // with MCP client info

Interface Types

Scenario Interface ID Example
ctxc search cli-search context-connectors/0.1.3 via:cli-search
SDK search sdk-search context-connectors/0.1.3 via:sdk-search
ctxc index cli-index context-connectors/0.1.3 via:cli-index
SDK index sdk-index context-connectors/0.1.3 via:sdk-index
ctxc mcp mcp context-connectors/0.1.3 via:mcp
ctxc agent cli-agent context-connectors/0.1.3 via:cli-agent
Agent provider sdk-agent-provider context-connectors/0.1.3 via:sdk-agent-provider

Changes

  • Add buildClientUserAgent() utility in src/core/utils.ts
  • Add clientUserAgent option to Indexer, SearchClient, MultiIndexRunner, CLIAgent
  • Pass clientUserAgent to DirectContext and AugmentLanguageModel
  • Set appropriate interface IDs in CLI commands
  • Export ClientInterface and MCPClientInfo types
  • Add unit tests for buildClientUserAgent

Dependencies

Requires auggie-sdk >= 0.1.15 - PR #47 was merged (https://github.com/augmentcode/auggie-sdk-typescript/pull/47), awaiting npm release.

Once the new auggie-sdk version is published:

  1. Update package.json to require the new version
  2. Build will pass

Testing

  • ✅ Tested with linked local auggie-sdk build (from main branch)
  • ✅ All 168 tests pass
  • ✅ New unit tests for buildClientUserAgent added

Pull Request opened by Augment Code with guidance from the PR author

Add clientUserAgent support to identify context-connectors usage in
Augment backend analytics. This enables tracking:
- Which product is calling (context-connectors vs other SDK consumers)
- Which interface is being used (CLI, SDK, MCP, agent)
- For MCP: which client is connecting (prepared for future use)

User-Agent format: context-connectors/{version} via:{interface}

Changes:
- Add buildClientUserAgent() utility in src/core/utils.ts
- Add clientUserAgent option to Indexer, SearchClient, MultiIndexRunner, CLIAgent
- Pass clientUserAgent to DirectContext and AugmentLanguageModel
- Set appropriate interface IDs in CLI commands (cli-search, cli-index, cli-agent, mcp)
- Export ClientInterface and MCPClientInfo types
- Add unit tests for buildClientUserAgent

Requires auggie-sdk >= 0.1.15 (PR #47 merged, awaiting npm release)

Agent-Id: agent-0d00d75b-1ac5-4e85-a310-90e1af295ee3
@augment-app-staging
Copy link

🤖 Augment PR Summary

Summary: Adds a clientUserAgent signal so Augment backend analytics can attribute Context Connectors usage by interface.

Changes:

  • Introduced `buildClientUserAgent()` plus exported `ClientInterface`/`MCPClientInfo` types.
  • CLI commands (`ctxc search`, `ctxc index`, `ctxc agent`) now generate interface-specific User-Agent strings.
  • `Indexer`, `SearchClient`, and `MultiIndexRunner` accept/propagate `clientUserAgent` into `DirectContext.create()` / `DirectContext.import()`.
  • `CLIAgent` forwards `clientUserAgent` into `AugmentLanguageModel` options (Augment provider only).
  • MCP server mode sets `via:mcp` and threads the UA through the shared runner.
  • Added unit tests validating UA formatting and interface coverage.
Technical Notes: Requires an `@augmentcode/auggie-sdk` version that supports the `clientUserAgent` option for API requests.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augment-app-staging augment-app-staging bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

describe("buildClientUserAgent", () => {
it("should build basic user agent for cli-search", () => {
const ua = buildClientUserAgent("cli-search");
expect(ua).toMatch(/^context-connectors\/\d+\.\d+\.\d+ via:cli-search$/);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These assertions only accept strict x.y.z; if package.json ever uses pre-release/build metadata (e.g. 0.1.3-beta.1) the tests will fail even though buildClientUserAgent() is behaving correctly.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

function getVersion(): string {
if (cachedVersion === null) {
const require = createRequire(import.meta.url);
const pkg = require('../../package.json');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getVersion() assumes ../../package.json is always readable at runtime; in bundled/packaged environments where package.json isn’t present this will throw and make buildClientUserAgent() crash callers. It may be worth making the version lookup resilient so UA building can’t break normal execution.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

mcpClientInfo?: MCPClientInfo
): string {
let ua = `context-connectors/${getVersion()} via:${clientInterface}`;
if (mcpClientInfo) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buildClientUserAgent() appends client:{name}/{version} whenever mcpClientInfo is provided, even if clientInterface isn’t mcp, which could produce misleading analytics strings if misused.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

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.

2 participants