npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vscode-tas-client

v0.1.86

Published

vscode-tas-client is a package for querying and storing experiment information from the Treatment Assignment Service (TAS).

Downloads

236,680

Readme

vscode-tas-client

vscode-tas-client is a package for querying and storing experiment information from the Treatment Assignment Service (TAS).

Usage

Initialization

Get an IExperimentationService instance by calling getExperimentationService(extensionName: string, extensionVersion: string, targetPopulation: TargetPopulation, telemetry: IExperimentationTelemetry, memento: vscode.Memento).

extensionName, extensionVersion, and targetPopulation are used to set traffic filter values.

It's recommended that you get extensionName and extensionVersion from your extension's package.json.

targetPopulation is the ring the user belongs to - Team, Internal, Insiders, or Public. Most extensions determine what group a user belongs to based on a VS Code setting or a settings file.

telemetry is used to send telemetry for counterfactual logging purposes and to attach common properties to all telemetry events, which enables the computation of an experiment scorecard. The extension sends an event query-expfeature the first time a given flight or treatment variable is requested and attaches the common properties vscode.abexp.features and abexp.assignmentcontext to all events.

note: all the telemetry events sent by the extension and common properties have already been GDPR classified.

memento is the VS Code memento storage for your extension, which can be accessed via context.globalState, where context is the vscode.ExtensionContext that VS Code passes your extension on activation. It's used to cache info from the TAS.

There's also a getExperimentationServiceAsync function that behaves identically to getExperimentationService except it awaits the returned IExperimentationService's initializePromise before returning. This ensures that cached info from the TAS is loaded. Since this simply involves reading VS Code memento storage, it usually takes <10ms.

Use

Once you have an instance of IExperimentationService you can call getTreatmentVariable(configId: string, name: string) to get the value of a treatment variable. configId is always vscode and name is the name of the treatment variable that you defined in control tower when you set up your experiment.

note: if you haven't awaited the IExperimentationService's initializePromise, or, equivallently, used getExperimentationServiceAsync to get the IExperimentationService instance, you need to use getTreatmentVariableAsync.

Details

Telemetry

vscode-tas-client will handle sending all needed telemetry to analyze your experiment. Specifically, it sends an event query-expfeature the first time a given flight or treatment variable is requested (for counterfactual logging purposes) and attaches the common properties vscode.abexp.features - a list of treatment variables - and abexp.assignmentcontext - a list of flight names - to all telemetry events your extension sends.

Background refresh of treatment variables

The vscode-tas-client package makes an HTTP request to the TAS when you first call getExperimentationService, and then every 30 minutes after that. The new information from the TAS is cached in VS Code memento storage.

When treatment variables are updated

To avoid changing the user experience mid-session, after requesting the value of a treatment variable, future calls to getTreatmentVariable will use the same data that was used to service the first call, unless a call to getTreatmentVariableAsync is used, which sends a new request to the TAS and waits on the response.

A few examples to clarify:

  • Your extension calls getExperimentationServiceAsync and then immediately after calls getTreatmentVariable. Later in the session, you call getTreatmentVariable again. vscode-tas-client will make a request to the TAS as soon as you call getExperimentationServiceAsync. However, this request usually takes 1-5s to complete, so the call to getTreatmentVariable is made before it does. This means that the getTreatmentVariable request will be serviced using cached data from the last request to the TAS. Because this data was used to service the first request, it will also be used to service the second request, even though the HTTP request to the TAS has returned by this time. However, the new data from the TAS isn't thrown away, it's used to update the cache so that the next VS Code session will use the updated data, even with the same sequence of events.
  • Your extension calls getExperimentationServiceAsync and then immediately after calls getTreatmentVariable. Later in the session, you call getTreatmentVariableAsync. vscode-tas-client will make a request to the TAS as soon as you call getExperimentationServiceAsync. However, this request usually takes 1-5s to complete, so the call to getTreatmentVariable is made before it does. This means that the getTreatmentVariable request will be serviced using cached data from the last request to the TAS. The second request, getTreatmentVariableAsync will result in waiting on an HTTP request to the TAS. The updated data will be used to service the request and the cache will be updated. Note this means the user could change flights, or become part of a new flight, mid-session.
  • Your extension calls getExperimentationServiceAsync and then ~1 minute later calls getTreatmentVariable. vscode-tas-client will make a request to the TAS as soon as you call getExperimentationServiceAsync. Because this request completes before the call to getExperimentationService, the freshly fetched data is used.