chore: import upstream snapshot with attribution
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
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
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
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
import {
|
||||
DOWNDETECTOR_API_BASE,
|
||||
type DowndetectorGetCompanyParams,
|
||||
type DowndetectorGetCompanyResponse,
|
||||
} from '@/tools/downdetector/types'
|
||||
import {
|
||||
downdetectorHeaders,
|
||||
encodePathParam,
|
||||
extractDowndetectorError,
|
||||
} from '@/tools/downdetector/utils'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
const DEFAULT_FIELDS =
|
||||
'id,name,slug,url,stats_24,baseline,baseline_current,category_id,status,country_iso,site_id,indicators,description'
|
||||
|
||||
interface RawCompany {
|
||||
id?: number
|
||||
name?: string
|
||||
slug?: string
|
||||
url?: string
|
||||
status?: string
|
||||
category_id?: number
|
||||
country_iso?: string
|
||||
site_id?: number
|
||||
baseline_current?: number
|
||||
stats_24?: number[]
|
||||
baseline?: number[]
|
||||
indicators?: string[]
|
||||
description?: string
|
||||
}
|
||||
|
||||
export const getCompanyTool: ToolConfig<
|
||||
DowndetectorGetCompanyParams,
|
||||
DowndetectorGetCompanyResponse
|
||||
> = {
|
||||
id: 'downdetector_get_company',
|
||||
name: 'Downdetector Get Company',
|
||||
description:
|
||||
'Get details for a Downdetector company by id, including its current status, 24h report statistics, baseline, and available problem indicators.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
companyId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The Downdetector company id',
|
||||
},
|
||||
fields: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-only',
|
||||
description:
|
||||
'Comma-separated list of fields to return (defaults to a rich set including status, stats_24, and baseline)',
|
||||
},
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-only',
|
||||
description: 'Downdetector API Bearer token',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) => {
|
||||
const url = new URL(
|
||||
`${DOWNDETECTOR_API_BASE}/companies/${encodePathParam(params.companyId, 'Company ID')}`
|
||||
)
|
||||
url.searchParams.set('fields', params.fields || DEFAULT_FIELDS)
|
||||
return url.toString()
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => downdetectorHeaders(params.apiKey),
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data: RawCompany = await response.json()
|
||||
if (!response.ok) {
|
||||
throw new Error(extractDowndetectorError(data, 'Failed to get company'))
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
company: {
|
||||
id: data.id ?? null,
|
||||
name: data.name ?? null,
|
||||
slug: data.slug ?? null,
|
||||
url: data.url ?? null,
|
||||
status: data.status ?? null,
|
||||
categoryId: data.category_id ?? null,
|
||||
countryIso: data.country_iso ?? null,
|
||||
siteId: data.site_id ?? null,
|
||||
baselineCurrent: data.baseline_current ?? null,
|
||||
stats24: data.stats_24 ?? [],
|
||||
baseline: data.baseline ?? [],
|
||||
indicators: data.indicators ?? [],
|
||||
description: data.description ?? null,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
outputs: {
|
||||
company: {
|
||||
type: 'object',
|
||||
description: 'Company details',
|
||||
properties: {
|
||||
id: { type: 'number', description: 'Company id' },
|
||||
name: { type: 'string', description: 'Company name' },
|
||||
slug: { type: 'string', description: 'Company slug' },
|
||||
url: { type: 'string', description: 'Company status page URL' },
|
||||
status: {
|
||||
type: 'string',
|
||||
description: 'Cached current status (success, warning, or danger)',
|
||||
},
|
||||
categoryId: { type: 'number', description: 'Category id' },
|
||||
countryIso: { type: 'string', description: 'ISO-2 country code' },
|
||||
siteId: { type: 'number', description: 'Site id' },
|
||||
baselineCurrent: {
|
||||
type: 'number',
|
||||
description: 'The current considered average reports at this point in time',
|
||||
},
|
||||
stats24: {
|
||||
type: 'array',
|
||||
description: 'Reports over the last 24h in 15-minute buckets',
|
||||
items: { type: 'number' },
|
||||
},
|
||||
baseline: {
|
||||
type: 'array',
|
||||
description: 'Averaged baseline values per 15m over 24h',
|
||||
items: { type: 'number' },
|
||||
},
|
||||
indicators: {
|
||||
type: 'array',
|
||||
description: 'List of available problem indicators',
|
||||
items: { type: 'string' },
|
||||
},
|
||||
description: { type: 'string', description: 'Company description' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user