fix: hotfix vscode extension 0.4.1. update document links, fix data.json migration, and update anonymous usage tracking client properties. (#434)

release-0.2 v0.1.0-rc.0
Zhiming Ma 2023-09-12 13:25:20 +08:00 committed by GitHub
parent 682c21e536
commit 3af32c8c7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 55 additions and 16 deletions

View File

@ -10,6 +10,6 @@
"devDependencies": { "devDependencies": {
"cpy-cli": "^4.2.0", "cpy-cli": "^4.2.0",
"rimraf": "^5.0.1", "rimraf": "^5.0.1",
"tabby-agent": "0.1.0" "tabby-agent": "0.1.1"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "tabby-agent", "name": "tabby-agent",
"version": "0.1.0", "version": "0.1.1",
"description": "Generic client agent for Tabby AI coding assistant IDE extensions.", "description": "Generic client agent for Tabby AI coding assistant IDE extensions.",
"repository": "https://github.com/TabbyML/tabby", "repository": "https://github.com/TabbyML/tabby",
"main": "./dist/index.js", "main": "./dist/index.js",

View File

@ -10,6 +10,7 @@ import { AgentConfig, PartialAgentConfig } from "./AgentConfig";
export type AgentInitOptions = Partial<{ export type AgentInitOptions = Partial<{
config: PartialAgentConfig; config: PartialAgentConfig;
client: string; client: string;
clientProperties: Record<string, any>;
}>; }>;
export type ServerHealthState = HealthState; export type ServerHealthState = HealthState;

View File

@ -253,10 +253,16 @@ export class TabbyAgent extends EventEmitter implements Agent {
private healthCheck(): Promise<any> { private healthCheck(): Promise<any> {
return this.callApi(this.api.v1.health, {}) return this.callApi(this.api.v1.health, {})
.then((healthState) => { .then((healthState) => {
if (
typeof healthState === "object" &&
healthState["model"] !== undefined &&
healthState["device"] !== undefined
) {
this.serverHealthState = healthState; this.serverHealthState = healthState;
if (this.status === "ready") { if (this.status === "ready") {
this.anonymousUsageLogger.uniqueEvent("AgentConnected", healthState); this.anonymousUsageLogger.uniqueEvent("AgentConnected", healthState);
} }
}
}) })
.catch(() => {}); .catch(() => {});
} }
@ -276,11 +282,11 @@ export class TabbyAgent extends EventEmitter implements Agent {
} }
public async initialize(options: AgentInitOptions): Promise<boolean> { public async initialize(options: AgentInitOptions): Promise<boolean> {
if (options.client) { if (options.client || options.clientProperties) {
// Client info is only used in logging for now // Client info is only used in logging for now
// `pino.Logger.setBindings` is not present in the browser // `pino.Logger.setBindings` is not present in the browser
allLoggers.forEach((logger) => logger.setBindings?.({ client: options.client })); allLoggers.forEach((logger) => logger.setBindings?.({ client: options.client, ...options.clientProperties }));
this.anonymousUsageLogger.addProperties({ client: options.client }); this.anonymousUsageLogger.addProperties({ client: options.client, ...options.clientProperties });
} }
if (userAgentConfig) { if (userAgentConfig) {
await userAgentConfig.load(); await userAgentConfig.load();

View File

@ -19,10 +19,23 @@ export const dataStore: DataStore = isBrowser
return { return {
data: {}, data: {},
load: async function () { load: async function () {
await this.migrateFrom_0_3_0();
this.data = (await fs.readJson(dataFile, { throws: false })) || {}; this.data = (await fs.readJson(dataFile, { throws: false })) || {};
}, },
save: async function () { save: async function () {
await fs.outputJson(dataFile, this.data); await fs.outputJson(dataFile, this.data);
}, },
migrateFrom_0_3_0: async function () {
const dataFile_0_3_0 = require("path").join(require("os").homedir(), ".tabby", "agent", "data.json");
const migratedFlag = require("path").join(require("os").homedir(), ".tabby", "agent", ".data_json_migrated");
if (
(await fs.pathExists(dataFile_0_3_0)) &&
!(await fs.pathExists(migratedFlag))
) {
const data = await fs.readJson(dataFile_0_3_0);
await fs.outputJson(dataFile, data);
await fs.outputFile(migratedFlag, "");
}
},
}; };
})(); })();

View File

@ -19,6 +19,8 @@ const stream =
export const rootLogger = !!stream ? pino(stream) : pino(); export const rootLogger = !!stream ? pino(stream) : pino();
if (isTest && testLogDebug) { if (isTest && testLogDebug) {
rootLogger.level = "debug"; rootLogger.level = "debug";
} else {
rootLogger.level = "silent";
} }
export const allLoggers = [rootLogger]; export const allLoggers = [rootLogger];

View File

@ -10,6 +10,6 @@
"devDependencies": { "devDependencies": {
"cpy-cli": "^4.2.0", "cpy-cli": "^4.2.0",
"rimraf": "^5.0.1", "rimraf": "^5.0.1",
"tabby-agent": "0.1.0" "tabby-agent": "0.1.1"
} }
} }

View File

@ -1,3 +1,10 @@
## 0.4.1
Fixes:
- Updated expired links in the documentation.
- Migrated Tabby cloud authorization tokens and anonymous usage tracking id from the old data directory to the new one.
## 0.4.0 ## 0.4.0
Features: Features:

View File

@ -14,9 +14,9 @@ If you encounter any problem or have any suggestion, please [open an issue](http
## Demo ## Demo
Try our online demo [here](https://tabbyml.github.io/tabby/playground). Try our online demo [here](https://tabby.tabbyml.com/playground).
![Demo](https://tabbyml.github.io/tabby/img/demo.gif) ![Demo](https://tabby.tabbyml.com/img/demo.gif)
## Get Started ## Get Started

View File

@ -4,7 +4,7 @@
Tabby will show inline suggestions when you stop typing, and you can accept suggestions by just pressing the `Tab` key. Tabby will show inline suggestions when you stop typing, and you can accept suggestions by just pressing the `Tab` key.
![Demo](https://tabbyml.github.io/tabby/img/demo.gif) ![Demo](https://tabby.tabbyml.com/img/demo.gif)
## Cycling Through Choices ## Cycling Through Choices

View File

@ -9,4 +9,4 @@ You can get a Tabby Cloud account [here](https://app.tabbyml.com). Once you crea
## Self-Hosting ## Self-Hosting
Tabby is an open-source project and supports self-hosting. For more details, please refer to our [self-hosting guide](https://tabbyml.github.io/tabby/docs/self-hosting/) and visit our [Github repository](https://github.com/tabbyml/tabby). Tabby is an open-source project and supports self-hosting. For more details, please refer to our [self-hosting guide](https://tabby.tabbyml.com/docs/installation/) and visit our [Github repository](https://github.com/tabbyml/tabby).

View File

@ -3,11 +3,11 @@
"publisher": "TabbyML", "publisher": "TabbyML",
"displayName": "Tabby", "displayName": "Tabby",
"description": "Tabby is a self-hosted AI coding assistant that can suggest multi-line code or full functions in real-time.", "description": "Tabby is a self-hosted AI coding assistant that can suggest multi-line code or full functions in real-time.",
"homepage": "https://tabbyml.github.io/tabby", "homepage": "https://tabby.tabbyml.com/",
"repository": "https://github.com/TabbyML/tabby", "repository": "https://github.com/TabbyML/tabby",
"bugs": "https://github.com/TabbyML/tabby/issues", "bugs": "https://github.com/TabbyML/tabby/issues",
"license": "Apache-2.0", "license": "Apache-2.0",
"version": "0.4.0", "version": "0.4.1",
"keywords": [ "keywords": [
"ai", "ai",
"autocomplete", "autocomplete",
@ -197,6 +197,6 @@
}, },
"dependencies": { "dependencies": {
"@xstate/fsm": "^2.0.1", "@xstate/fsm": "^2.0.1",
"tabby-agent": "0.1.0" "tabby-agent": "0.1.1"
} }
} }

View File

@ -41,6 +41,16 @@ export async function createAgentInstance(context: ExtensionContext): Promise<Ta
const initPromise = agent.initialize({ const initPromise = agent.initialize({
config: getWorkspaceConfiguration(), config: getWorkspaceConfiguration(),
client: `${env.appName} ${env.appHost} ${version}, ${context.extension.id} ${context.extension.packageJSON.version}`, client: `${env.appName} ${env.appHost} ${version}, ${context.extension.id} ${context.extension.packageJSON.version}`,
clientProperties: {
ide: {
name: `${env.appName} ${env.appHost}`,
version: version,
},
tabby_plugin: {
name: context.extension.id,
version: context.extension.packageJSON.version,
},
},
}); });
workspace.onDidChangeConfiguration(async (event) => { workspace.onDidChangeConfiguration(async (event) => {
await initPromise; await initPromise;