File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import chalk from "chalk";
2
2
import type { ChatHistoryItem } from "core/index.js" ;
3
3
import express , { Request , Response } from "express" ;
4
4
5
+ import { posthogService } from "src/telemetry/posthogService.js" ;
6
+
5
7
import { getAccessToken , getAssistantSlug } from "../auth/workos.js" ;
6
8
import { runEnvironmentInstallSafe } from "../environment/environmentHandler.js" ;
7
9
import { processCommandFlags } from "../flags/flagProcessor.js" ;
@@ -42,6 +44,8 @@ interface ServeOptions extends ExtendedCommandOptions {
42
44
43
45
// eslint-disable-next-line max-statements
44
46
export async function serve ( prompt ?: string , options : ServeOptions = { } ) {
47
+ await posthogService . capture ( "sessionStart" , { } ) ;
48
+
45
49
// Check if prompt should come from stdin instead of parameter
46
50
let actualPrompt = prompt ;
47
51
if ( ! prompt ) {
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import node_machine_id from "node-machine-id";
5
5
import type { PostHog as PostHogType } from "posthog-node" ;
6
6
7
7
import { isAuthenticatedConfig , loadAuthConfig } from "../auth/workos.js" ;
8
- import { isHeadlessMode } from "../util/cli.js" ;
8
+ import { isHeadlessMode , isServe } from "../util/cli.js" ;
9
9
import { isGitHubActions } from "../util/git.js" ;
10
10
import { logger } from "../util/logger.js" ;
11
11
import { getVersion } from "../version.js" ;
@@ -95,6 +95,7 @@ export class PosthogService {
95
95
ideType : "cli" ,
96
96
isHeadless : isHeadlessMode ( ) ,
97
97
isGitHubCI : isGitHubActions ( ) ,
98
+ isServe : isServe ( ) ,
98
99
} ;
99
100
const payload = {
100
101
distinctId : this . uniqueId ,
Original file line number Diff line number Diff line change @@ -9,3 +9,7 @@ export function isHeadlessMode(): boolean {
9
9
const args = process . argv . slice ( 2 ) ;
10
10
return args . includes ( "-p" ) || args . includes ( "--print" ) ;
11
11
}
12
+
13
+ export function isServe ( ) : boolean {
14
+ return process . argv ?. includes ( "serve" ) ?? false ;
15
+ }
You can’t perform that action at this time.
0 commit comments