# nodes

kind: Function
name: sendNavigationRequest
qualified_name: server/lib/teslaClient.ts::sendNavigationRequest
file_path: server/lib/teslaClient.ts
language: typescript
params: ( token: string, vehicleId: string, args: { lat: number; lng: number; name?: string }, )
signature:
def sendNavigationRequest((
  token: string,
  vehicleId: string,
  args: { lat: number; lng: number; name?: string },
))


kind: Type
name: TripInput
qualified_name: server/lib/tripStore.ts::TripInput
file_path: server/lib/tripStore.ts
language: typescript
signature:
type_alias_declaration type TripInput = Omit<Trip, 'id' | 'createdAt' | 'updatedAt' | 'shareSlug'> & {


kind: Class
name: ChatMessage
qualified_name: server/services/llm/GrokHeadlessClient.ts::ChatMessage
file_path: server/services/llm/GrokHeadlessClient.ts
language: typescript
signature:
interface_declaration interface ChatMessage { role: 'user' | 'assistant' | 'system'; content: string; }


kind: Class
name: GrokResponse
qualified_name: server/services/llm/GrokHeadlessClient.ts::GrokResponse
file_path: server/services/llm/GrokHeadlessClient.ts
language: typescript
signature:
interface_declaration interface GrokResponse { text: string; updatedItinerary?: any; variants?: any[]; selectedVariant?: string; }


kind: Function
name: buildPrompt
qualified_name: server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::buildPrompt
file_path: server/services/llm/GrokHeadlessClient.ts
language: typescript
parent_name: server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient
params:
(messages: ChatMessage[], itinerary: any, vehicle: VehicleInput, selectedVariant: string = 'fast', opts: { origin?: string; destination?: string; travelDates?: { outbound?: string | null; return?: string | null; travellers?: number } } = {})

signature:
def buildPrompt((messages: ChatMessage[], itinerary: any, vehicle: VehicleInput, selectedVariant: string = 'fast', opts: { origin?: string; destination?: string; travelDates?: { outbound?: string | null; return?: string | null; travellers?: number } } = {}))


kind: Function
name: chat
qualified_name: server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::chat
file_path: server/services/llm/GrokHeadlessClient.ts
language: typescript
parent_name: server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient
params:
(messages: ChatMessage[], itinerary: any, vehicle: VehicleInput, selectedVariant: string = 'fast', opts: { origin?: string; destination?: string; travelDates?: { outbound?: string | null; return?: string | null; travellers?: number } } = {})

signature:
def chat((messages: ChatMessage[], itinerary: any, vehicle: VehicleInput, selectedVariant: string = 'fast', opts: { origin?: string; destination?: string; travelDates?: { outbound?: string | null; return?: string | null; travellers?: number } } = {}))


kind: Function
name: chatStream
qualified_name: server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::chatStream
file_path: server/services/llm/GrokHeadlessClient.ts
language: typescript
parent_name: server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient
params:
(messages: ChatMessage[], itinerary: any, vehicle: VehicleInput, selectedVariant: string = 'fast', opts: { origin?: string; destination?: string; travelDates?: { outbound?: string | null; return?: string | null; travellers?: number } } = {})

signature:
def chatStream((messages: ChatMessage[], itinerary: any, vehicle: VehicleInput, selectedVariant: string = 'fast', opts: { origin?: string; destination?: string; travelDates?: { outbound?: string | null; return?: string | null; travellers?: number } } = {}))


kind: Function
name: callXaiApi
qualified_name: server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::callXaiApi
file_path: server/services/llm/GrokHeadlessClient.ts
language: typescript
parent_name: server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient
params:
(messages: ChatMessage[], itinerary: any, vehicle: VehicleInput, requestId: string, selectedVariant: string = 'fast', opts: { origin?: string; destination?: string; travelDates?: { outbound?: string | null; return?: string | null; travellers?: number } } = {})

signature:
def callXaiApi((messages: ChatMessage[], itinerary: any, vehicle: VehicleInput, requestId: string, selectedVariant: string = 'fast', opts: { origin?: string; destination?: string; travelDates?: { outbound?: string | null; return?: string | null; travellers?: number } } = {}))


kind: Function
name: computeBatteryPlan
qualified_name: client/src/lib/batteryPlan.ts::computeBatteryPlan
file_path: client/src/lib/batteryPlan.ts
language: typescript
params: ( stops: BPStop[], legs: BPLeg[], startSoC: number, effectiveRangeKm: number, )
signature:
def computeBatteryPlan((
  stops: BPStop[],
  legs: BPLeg[],
  startSoC: number,
  effectiveRangeKm: number,
))


# flows

name: set
entry_point: server/lib/teslaTokenStore.ts::set
path:
["server/lib/teslaTokenStore.ts::set","server/lib/teslaTokenStore.ts::load","server/lib/teslaTokenStore.ts::persist","mkdir","catch","chmod","readFile","parse","info","keys","warn","String","then","writeFile","stringify","rename"]


name: remove
entry_point: server/lib/teslaTokenStore.ts::remove
path:
["server/lib/teslaTokenStore.ts::remove","server/lib/teslaTokenStore.ts::load","server/lib/teslaTokenStore.ts::persist","mkdir","catch","chmod","readFile","parse","info","keys","warn","String","then","writeFile","stringify","rename"]


name: getAppToken
entry_point: server/lib/teslaClient.ts::getAppToken
path:
["server/lib/teslaClient.ts::getAppToken","server/lib/teslaClient.ts::tokenRequest","fetch","text","error","slice","json"]


name: ownerIdFromRequest
entry_point: server/lib/ownerAuth.ts::ownerIdFromRequest
path:
["server/lib/ownerAuth.ts::ownerIdFromRequest","server/lib/ownerAuth.ts::isOwnerAuthenticated","server/lib/ownerAuth.ts::expectedCookieValue","timingSafeEqual","from","digest","update","createHmac"]


name: requireOwner
entry_point: server/lib/ownerAuth.ts::requireOwner
path:
["server/lib/ownerAuth.ts::requireOwner","server/lib/ownerAuth.ts::isOwnerAuthenticated","next","json","status","server/lib/ownerAuth.ts::expectedCookieValue","timingSafeEqual","from","digest","update","createHmac"]


name: getAccessToken
entry_point: server/lib/teslaClient.ts::getAccessToken
path:
["server/lib/teslaClient.ts::getAccessToken","get","now","server/lib/teslaClient.ts::refreshTokens","set","warn","String","server/lib/teslaClient.ts::tokenRequest","fetch","text","error","slice","json"]


name: get
entry_point: server/lib/teslaTokenStore.ts::get
path:
["server/lib/teslaTokenStore.ts::get","server/lib/teslaTokenStore.ts::load","mkdir","catch","chmod","readFile","parse","info","keys","warn","String"]


name: setOwnerCookie
entry_point: server/lib/ownerAuth.ts::setOwnerCookie
path:
["server/lib/ownerAuth.ts::setOwnerCookie","cookie","server/lib/ownerAuth.ts::expectedCookieValue","digest","update","createHmac"]


name: exchangeCodeForTokens
entry_point: server/lib/teslaClient.ts::exchangeCodeForTokens
path:
["server/lib/teslaClient.ts::exchangeCodeForTokens","server/lib/teslaClient.ts::tokenRequest","fetch","text","error","slice","json"]


name: SwNotifier
entry_point: client/src/components/SwNotifier.tsx::SwNotifier
path:
["client/src/components/SwNotifier.tsx::SwNotifier","useState","detectInCar","useEffect","registerSW","setUpdateSW","success","setEvent","toast","updateSW","dismiss","stopPropagation"]


name: computeBatteryPlan
entry_point: client/src/lib/batteryPlan.ts::computeBatteryPlan
path:
["client/src/lib/batteryPlan.ts::computeBatteryPlan","set","get","client/src/lib/batteryPlan.ts::chargeRatePctPerMin","min","max","push"]


name: useTesla
entry_point: client/src/lib/tesla.ts::useTesla
path:
["client/src/lib/tesla.ts::useTesla","useState","useRef","useEffect","all","client/src/lib/tesla.ts::fetchTeslaStatus","client/src/lib/tesla.ts::fetchOwnerStatus","setStatus","setOwner","clearInterval","setState","setStateLoading","client/src/lib/tesla.ts::fetchTeslaState","tick","setInterval","isMockEnabled","getMockStatus","fetch","json","getMockState"]


name: isMockEnabled
entry_point: client/src/lib/teslaMock.ts::isMockEnabled
path:
["client/src/lib/teslaMock.ts::isMockEnabled","client/src/lib/teslaMock.ts::getMockScenario","get","removeItem","client/src/lib/teslaMock.ts::isValidScenario","setItem","getItem"]


name: getMockStatus
entry_point: client/src/lib/teslaMock.ts::getMockStatus
path:
["client/src/lib/teslaMock.ts::getMockStatus","client/src/lib/teslaMock.ts::getMockScenario","now","slice","get","removeItem","client/src/lib/teslaMock.ts::isValidScenario","setItem","getItem"]


name: getMockState
entry_point: client/src/lib/teslaMock.ts::getMockState
path:
["client/src/lib/teslaMock.ts::getMockState","client/src/lib/teslaMock.ts::getMockScenario","slice","now","max","round","get","removeItem","client/src/lib/teslaMock.ts::isValidScenario","setItem","getItem"]


name: listVehicles
entry_point: server/lib/teslaClient.ts::listVehicles
path:
["server/lib/teslaClient.ts::listVehicles","server/lib/teslaClient.ts::fleetGet","isArray","fetch","text","slice","json"]


name: getVehicleData
entry_point: server/lib/teslaClient.ts::getVehicleData
path:
["server/lib/teslaClient.ts::getVehicleData","join","server/lib/teslaClient.ts::fleetGet","fetch","text","slice","json"]


name: wakeVehicle
entry_point: server/lib/teslaClient.ts::wakeVehicle
path:
["server/lib/teslaClient.ts::wakeVehicle","server/lib/teslaClient.ts::fleetPost","fetch","stringify","text","slice","json"]


name: sendNavigationRequest
entry_point: server/lib/teslaClient.ts::sendNavigationRequest
path:
["server/lib/teslaClient.ts::sendNavigationRequest","server/lib/teslaClient.ts::fleetPost","fetch","stringify","text","slice","json"]


name: registerPartnerAccount
entry_point: server/lib/teslaClient.ts::registerPartnerAccount
path:
["server/lib/teslaClient.ts::registerPartnerAccount","server/lib/teslaClient.ts::fleetPost","fetch","stringify","text","slice","json"]


name: chat
entry_point: server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::chat
path:
["server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::chat","slice","randomUUID","info","server/services/llm/GrokHeadlessClient.ts::vehicleName","server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::getActiveProvider","server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::callXaiApi","server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::dumbFallback","server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::buildPrompt","mkdtemp","join","tmpdir","spawn","on","resolve","error","reject","parse","server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::parseGrokResponse","String","catch","rm","access","fetch","stringify","text","json","toLowerCase","some","toUpperCase","map","trim","replace","isArray","warn","server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::extractItineraryUpdate","indexOf","substring"]


name: chatStream
entry_point: server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::chatStream
path:
["server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::chatStream","slice","randomUUID","info","server/services/llm/GrokHeadlessClient.ts::vehicleName","server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::getActiveProvider","server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::callXaiApi","server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::dumbFallback","server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::buildPrompt","mkdtemp","join","tmpdir","spawn","setEncoding","parse","push","w","warn","on","toString","indexOf","trim","pushLine","error","String","resolve","waitForLine","shift","server/services/llm/GrokHeadlessClient.ts::tryPartialJsonParse","isArray","reduce","filter","debug","lastIndexOf","replace","server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::parseGrokResponse","kill","catch","rm","access","fetch","stringify","text","json","toLowerCase","some","toUpperCase","map","pop","server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::extractItineraryUpdate","substring"]


name: update
entry_point: server/lib/tripStore.ts::MemoryTripStore::update
path:
["server/lib/tripStore.ts::MemoryTripStore::update","server/lib/tripStore.ts::MemoryTripStore::get","set"]


name: remove
entry_point: server/lib/tripStore.ts::MemoryTripStore::remove
path:
["server/lib/tripStore.ts::MemoryTripStore::remove","server/lib/tripStore.ts::MemoryTripStore::get","delete"]


name: constructor
entry_point: server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::constructor
path:
["server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::constructor","server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::resolveInitialProvider","info"]


name: getStatus
entry_point: server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::getStatus
path:
["server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::getStatus","server/services/llm/GrokHeadlessClient.ts::GrokHeadlessClient::localBinaryExists","access"]


