-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add User-Agent tracking for analytics #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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 PR SummarySummary: Adds a Changes:
🤖 Was this summary useful? React with 👍 or 👎 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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$/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| function getVersion(): string { | ||
| if (cachedVersion === null) { | ||
| const require = createRequire(import.meta.url); | ||
| const pkg = require('../../package.json'); |
There was a problem hiding this comment.
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.
🤖 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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
Add
clientUserAgentsupport to identify context-connectors usage in Augment backend analytics. This enables tracking:User-Agent Format
Interface Types
ctxc searchcli-searchcontext-connectors/0.1.3 via:cli-searchsdk-searchcontext-connectors/0.1.3 via:sdk-searchctxc indexcli-indexcontext-connectors/0.1.3 via:cli-indexsdk-indexcontext-connectors/0.1.3 via:sdk-indexctxc mcpmcpcontext-connectors/0.1.3 via:mcpctxc agentcli-agentcontext-connectors/0.1.3 via:cli-agentsdk-agent-providercontext-connectors/0.1.3 via:sdk-agent-providerChanges
buildClientUserAgent()utility insrc/core/utils.tsclientUserAgentoption toIndexer,SearchClient,MultiIndexRunner,CLIAgentclientUserAgenttoDirectContextandAugmentLanguageModelClientInterfaceandMCPClientInfotypesbuildClientUserAgentDependencies
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:
package.jsonto require the new versionTesting
buildClientUserAgentaddedPull Request opened by Augment Code with guidance from the PR author