d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
188 lines
6.3 KiB
TypeScript
188 lines
6.3 KiB
TypeScript
import { getPostHogAppBaseUrl } from '@/tools/posthog/utils'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export interface PostHogGetProjectParams {
|
|
projectId: string
|
|
apiKey: string
|
|
region?: 'us' | 'eu'
|
|
host?: string
|
|
}
|
|
|
|
interface PostHogProjectDetail {
|
|
id: number
|
|
uuid: string
|
|
organization: string
|
|
api_token: string
|
|
app_urls: string[]
|
|
name: string
|
|
slack_incoming_webhook: string
|
|
created_at: string
|
|
updated_at: string
|
|
anonymize_ips: boolean
|
|
completed_snippet_onboarding: boolean
|
|
ingested_event: boolean
|
|
test_account_filters: any[]
|
|
is_demo: boolean
|
|
timezone: string
|
|
data_attributes: string[]
|
|
person_display_name_properties: string[]
|
|
correlation_config: {
|
|
excluded_person_property_names?: string[]
|
|
excluded_event_names?: string[]
|
|
excluded_event_property_names?: string[]
|
|
}
|
|
autocapture_opt_out: boolean
|
|
autocapture_exceptions_opt_in: boolean
|
|
session_recording_opt_in: boolean
|
|
capture_console_log_opt_in: boolean
|
|
capture_performance_opt_in: boolean
|
|
}
|
|
|
|
export interface PostHogGetProjectResponse {
|
|
success: boolean
|
|
output: {
|
|
project: PostHogProjectDetail
|
|
}
|
|
error?: string
|
|
}
|
|
|
|
export const getProjectTool: ToolConfig<PostHogGetProjectParams, PostHogGetProjectResponse> = {
|
|
id: 'posthog_get_project',
|
|
name: 'PostHog Get Project',
|
|
description:
|
|
'Get detailed information about a specific project by ID. Returns comprehensive project configuration, settings, and feature flags.',
|
|
version: '1.0.0',
|
|
errorExtractor: 'posthog-errors',
|
|
|
|
params: {
|
|
projectId: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'Project ID (e.g., "12345" or project UUID)',
|
|
},
|
|
apiKey: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'PostHog Personal API Key',
|
|
},
|
|
region: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description: 'Cloud region: us or eu (default: us)',
|
|
},
|
|
host: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description:
|
|
'Self-hosted PostHog instance host (e.g., "posthog.mycompany.com"). Overrides the region setting when provided.',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: (params) => {
|
|
const baseUrl = getPostHogAppBaseUrl(params.region, params.host)
|
|
return `${baseUrl}/api/projects/${params.projectId}/`
|
|
},
|
|
method: 'GET',
|
|
headers: (params) => ({
|
|
Authorization: `Bearer ${params.apiKey}`,
|
|
'Content-Type': 'application/json',
|
|
}),
|
|
},
|
|
|
|
transformResponse: async (response: Response) => {
|
|
const data = await response.json()
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
project: {
|
|
id: data.id,
|
|
uuid: data.uuid,
|
|
organization: data.organization,
|
|
api_token: data.api_token,
|
|
app_urls: data.app_urls || [],
|
|
name: data.name,
|
|
slack_incoming_webhook: data.slack_incoming_webhook,
|
|
created_at: data.created_at,
|
|
updated_at: data.updated_at,
|
|
anonymize_ips: data.anonymize_ips,
|
|
completed_snippet_onboarding: data.completed_snippet_onboarding,
|
|
ingested_event: data.ingested_event,
|
|
test_account_filters: data.test_account_filters || [],
|
|
is_demo: data.is_demo,
|
|
timezone: data.timezone,
|
|
data_attributes: data.data_attributes || [],
|
|
person_display_name_properties: data.person_display_name_properties || [],
|
|
correlation_config: data.correlation_config || {},
|
|
autocapture_opt_out: data.autocapture_opt_out,
|
|
autocapture_exceptions_opt_in: data.autocapture_exceptions_opt_in,
|
|
session_recording_opt_in: data.session_recording_opt_in,
|
|
capture_console_log_opt_in: data.capture_console_log_opt_in,
|
|
capture_performance_opt_in: data.capture_performance_opt_in,
|
|
},
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
project: {
|
|
type: 'object',
|
|
description: 'Detailed project information with all configuration settings',
|
|
properties: {
|
|
id: { type: 'number', description: 'Project ID' },
|
|
uuid: { type: 'string', description: 'Project UUID' },
|
|
organization: { type: 'string', description: 'Organization UUID' },
|
|
api_token: { type: 'string', description: 'Project API token for ingestion' },
|
|
app_urls: { type: 'array', description: 'Allowed app URLs' },
|
|
name: { type: 'string', description: 'Project name' },
|
|
slack_incoming_webhook: {
|
|
type: 'string',
|
|
description: 'Slack webhook URL for notifications',
|
|
},
|
|
created_at: { type: 'string', description: 'Project creation timestamp' },
|
|
updated_at: { type: 'string', description: 'Last update timestamp' },
|
|
anonymize_ips: { type: 'boolean', description: 'Whether IP anonymization is enabled' },
|
|
completed_snippet_onboarding: {
|
|
type: 'boolean',
|
|
description: 'Whether snippet onboarding is completed',
|
|
},
|
|
ingested_event: { type: 'boolean', description: 'Whether any event has been ingested' },
|
|
test_account_filters: { type: 'array', description: 'Filters for test accounts' },
|
|
is_demo: { type: 'boolean', description: 'Whether this is a demo project' },
|
|
timezone: { type: 'string', description: 'Project timezone' },
|
|
data_attributes: { type: 'array', description: 'Custom data attributes' },
|
|
person_display_name_properties: {
|
|
type: 'array',
|
|
description: 'Properties used for person display names',
|
|
},
|
|
correlation_config: {
|
|
type: 'object',
|
|
description: 'Configuration for correlation analysis',
|
|
},
|
|
autocapture_opt_out: { type: 'boolean', description: 'Whether autocapture is disabled' },
|
|
autocapture_exceptions_opt_in: {
|
|
type: 'boolean',
|
|
description: 'Whether exception autocapture is enabled',
|
|
},
|
|
session_recording_opt_in: {
|
|
type: 'boolean',
|
|
description: 'Whether session recording is enabled',
|
|
},
|
|
capture_console_log_opt_in: {
|
|
type: 'boolean',
|
|
description: 'Whether console log capture is enabled',
|
|
},
|
|
capture_performance_opt_in: {
|
|
type: 'boolean',
|
|
description: 'Whether performance capture is enabled',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|