Skip to content

Commit 01ac846

Browse files
committed
Support for Claude and Codex AI Assistant vscode extensions
1 parent e12ca8e commit 01ac846

5 files changed

Lines changed: 449 additions & 23 deletions

File tree

src/constants.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ export const COMMON_AI_EXTENSIONS: AIExtension[] = [
1212
{
1313
name: 'copilot',
1414
extensionIds: ['github.copilot', 'github.copilot-chat'],
15+
transcriptLogGlobs: ['~/.copilot/session-state/*.jsonl'],
16+
},
17+
{
18+
name: 'gemini',
19+
extensionIds: [],
1520
transcriptLogGlobs: [],
1621
},
1722
{
@@ -44,6 +49,24 @@ export const COMMON_AI_EXTENSIONS: AIExtension[] = [
4449
extensionIds: ['ms-vscode.vscode-ai-toolkit'],
4550
transcriptLogGlobs: [],
4651
},
52+
{
53+
name: 'factory',
54+
extensionIds: [],
55+
transcriptLogGlobs: ['~/.factory/sessions/**/*.jsonl', '~/.factory/projects/**/*.jsonl'],
56+
},
57+
{
58+
name: 'opencode',
59+
extensionIds: [],
60+
transcriptLogGlobs: ['~/.local/share/opencode/storage/session/ses_*.json'],
61+
},
62+
{
63+
name: 'openclaw',
64+
extensionIds: [],
65+
transcriptLogGlobs: [
66+
'~/.openclaw/agents/**/sessions/*.jsonl',
67+
'~/.clawdbot/agents/**/sessions/*.jsonl',
68+
],
69+
},
4770
];
4871

4972
export const COMMAND_API_KEY = 'wakatime.apikey';
@@ -66,6 +89,8 @@ export enum LogLevel {
6689
export const AI_RECENT_PASTES_TIME_MS = 500;
6790
export const TIME_BETWEEN_HEARTBEATS_MS = 120000;
6891
export const SEND_BUFFER_SECONDS = 30;
92+
export const TRANSCRIPT_POLL_INTERVAL = 15; // seconds
93+
export const TRANSCRIPT_ACTIVITY_TIMEOUT = 3600; // seconds
6994

7095
export interface Heartbeat {
7196
time: number;
@@ -82,6 +107,7 @@ export interface Heartbeat {
82107
category?: 'debugging' | 'ai coding' | 'building' | 'code reviewing';
83108
ai_line_changes?: number;
84109
human_line_changes?: number;
110+
agent?: string;
85111
is_unsaved_entity?: boolean;
86112
}
87113

src/desktop.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import * as fs from 'fs';
2-
import * as vscode from 'vscode';
32
import * as os from 'os';
43
import * as child_process from 'child_process';
54
import { StdioOptions } from 'child_process';
65
import { AIExtension, COMMON_AI_EXTENSIONS } from './constants';
7-
import { Utils } from './utils';
86

97
export class Desktop {
108
public static isWindows(): boolean {
@@ -35,21 +33,15 @@ export class Desktop {
3533
return options;
3634
}
3735

38-
public static getInstalledAIAssistantExtensions(): AIExtension[] {
39-
const installedExtensionIds = new Set(Utils.getInstalledExtensionIds());
36+
public static getAIExtensionsWithTranscriptLogs(): AIExtension[] {
4037
const home = Desktop.getHomeDirectory().replace(/\/$/, '');
41-
42-
return COMMON_AI_EXTENSIONS.filter((assistant) =>
43-
assistant.extensionIds.some((id) => {
44-
if (!installedExtensionIds.has(id.toLowerCase())) return false;
45-
const extension = vscode.extensions.getExtension(id);
46-
return extension && extension.isActive;
38+
return COMMON_AI_EXTENSIONS.filter((assistant) => assistant.transcriptLogGlobs.length > 0).map(
39+
(assistant) => ({
40+
...assistant,
41+
transcriptLogGlobs: assistant.transcriptLogGlobs.map((glob) =>
42+
glob.replace(/~/g, home).replace(/\$HOME/g, home),
43+
),
4744
}),
48-
).map((assistant) => ({
49-
...assistant,
50-
transcriptLogGlobs: assistant.transcriptLogGlobs.map((glob) =>
51-
glob.replace(/~/g, home).replace(/\$HOME/g, home),
52-
),
53-
}));
45+
);
5446
}
5547
}

0 commit comments

Comments
 (0)