Files
WeHub Mirror 6bf8bebf51
CI / Test and Build (push) Failing after 1s
CI / Migrate Dev DB (push) Has been skipped
CI / Migrate DB (push) Has been skipped
CodeQL / Analyze actions (push) Has been cancelled
CodeQL / Analyze javascript-typescript (push) Has been cancelled
CI / Detect Version (push) Has been cancelled
CI / Detect Desktop Changes (push) Has been cancelled
CI / Build AMD64 (blacksmith-2vcpu-ubuntu-2404, ./docker/cron.Dockerfile, ubuntu-latest, ghcr.io/simstudioai/cron) (push) Has been cancelled
CI / Build AMD64 (blacksmith-2vcpu-ubuntu-2404, ./docker/db.Dockerfile, ECR_MIGRATIONS, ubuntu-latest, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (blacksmith-4vcpu-ubuntu-2404, ./docker/pii.Dockerfile, ECR_PII, ubuntu-latest, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (blacksmith-4vcpu-ubuntu-2404, ./docker/realtime.Dockerfile, ECR_REALTIME, ubuntu-latest, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build AMD64 (blacksmith-8vcpu-ubuntu-2404, ./docker/app.Dockerfile, ECR_APP, linux-x64-8-core, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (blacksmith-4vcpu-ubuntu-2404-arm, ./docker/cron.Dockerfile, ubuntu-24.04-arm, ghcr.io/simstudioai/cron) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (blacksmith-4vcpu-ubuntu-2404-arm, ./docker/db.Dockerfile, ubuntu-24.04-arm, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (blacksmith-4vcpu-ubuntu-2404-arm, ./docker/pii.Dockerfile, ubuntu-24.04-arm, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (blacksmith-4vcpu-ubuntu-2404-arm, ./docker/realtime.Dockerfile, ubuntu-24.04-arm, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (blacksmith-8vcpu-ubuntu-2404-arm, ./docker/app.Dockerfile, linux-arm64-8-core, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
Helm Chart / Lint, test, and validate chart (push) Has been cancelled
Helm Chart / Chart version bumped (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
CI / Build Dev ECR (blacksmith-8vcpu-ubuntu-2404, ./docker/app.Dockerfile, ECR_APP, linux-x64-8-core) (push) Has been cancelled
CI / Promote Images (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/cron) (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 / Build Dev ECR (blacksmith-2vcpu-ubuntu-2404, ./docker/db.Dockerfile, ECR_MIGRATIONS, ubuntu-latest) (push) Has been cancelled
CI / Build Dev ECR (blacksmith-4vcpu-ubuntu-2404, ./docker/pii.Dockerfile, ECR_PII, ubuntu-latest) (push) Has been cancelled
CI / Build Dev ECR (blacksmith-4vcpu-ubuntu-2404, ./docker/realtime.Dockerfile, ECR_REALTIME, ubuntu-latest) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Check Desktop Signing Secrets (push) Has been cancelled
CI / Desktop Release (push) Has been cancelled
CI / Create Desktop Prerelease (push) Has been cancelled
CI / Desktop Prerelease Build (push) Has been cancelled
CI / Publish Desktop Prerelease (push) Has been cancelled
CI / Prune Desktop Prereleases (push) Has been cancelled
Helm Chart / Install on kind and run helm test (push) Has been cancelled
WeHub snapshot of cb28d14c6f2c081de7a0d8729a8c816c9adef67a
2026-08-10 11:17:50 +08:00

119 lines
4.4 KiB
TypeScript

import type { KnowledgeGetConnectorResponse } from '@/tools/knowledge/types'
import type { ToolConfig } from '@/tools/types'
export const knowledgeGetConnectorTool: ToolConfig<any, KnowledgeGetConnectorResponse> = {
id: 'knowledge_get_connector',
name: 'Knowledge Get Connector',
description:
'Get detailed connector information including recent sync logs for monitoring sync health',
version: '1.0.0',
params: {
knowledgeBaseId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the knowledge base the connector belongs to',
},
connectorId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'ID of the connector to retrieve',
},
},
request: {
url: (params) => `/api/knowledge/${params.knowledgeBaseId}/connectors/${params.connectorId}`,
method: 'GET',
headers: () => ({
'Content-Type': 'application/json',
}),
},
transformResponse: async (response): Promise<KnowledgeGetConnectorResponse> => {
const result = await response.json()
const data = result.data || {}
return {
success: result.success ?? true,
output: {
connector: {
id: data.id,
connectorType: data.connectorType,
status: data.status,
syncIntervalMinutes: data.syncIntervalMinutes,
lastSyncAt: data.lastSyncAt ?? null,
lastSyncError: data.lastSyncError ?? null,
lastSyncDocCount: data.lastSyncDocCount ?? null,
nextSyncAt: data.nextSyncAt ?? null,
consecutiveFailures: data.consecutiveFailures ?? 0,
createdAt: data.createdAt ?? null,
updatedAt: data.updatedAt ?? null,
},
syncLogs: (data.syncLogs || []).map(
(log: {
id: string
status: string
startedAt: string | null
completedAt: string | null
docsAdded: number | null
docsUpdated: number | null
docsDeleted: number | null
docsUnchanged: number | null
errorMessage: string | null
}) => ({
id: log.id,
status: log.status,
startedAt: log.startedAt ?? null,
completedAt: log.completedAt ?? null,
docsAdded: log.docsAdded ?? null,
docsUpdated: log.docsUpdated ?? null,
docsDeleted: log.docsDeleted ?? null,
docsUnchanged: log.docsUnchanged ?? null,
errorMessage: log.errorMessage ?? null,
})
),
},
}
},
outputs: {
connector: {
type: 'object',
description: 'Connector details',
properties: {
id: { type: 'string', description: 'Connector ID' },
connectorType: { type: 'string', description: 'Type of connector' },
status: { type: 'string', description: 'Connector status (active, paused, syncing)' },
syncIntervalMinutes: { type: 'number', description: 'Sync interval in minutes' },
lastSyncAt: { type: 'string', description: 'Timestamp of last sync' },
lastSyncError: { type: 'string', description: 'Error from last sync if failed' },
lastSyncDocCount: { type: 'number', description: 'Docs synced in last sync' },
nextSyncAt: { type: 'string', description: 'Next scheduled sync timestamp' },
consecutiveFailures: { type: 'number', description: 'Consecutive sync failures' },
createdAt: { type: 'string', description: 'Creation timestamp' },
updatedAt: { type: 'string', description: 'Last update timestamp' },
},
},
syncLogs: {
type: 'array',
description: 'Recent sync log entries',
items: {
type: 'object',
properties: {
id: { type: 'string', description: 'Sync log ID' },
status: { type: 'string', description: 'Sync status' },
startedAt: { type: 'string', description: 'Sync start time' },
completedAt: { type: 'string', description: 'Sync completion time' },
docsAdded: { type: 'number', description: 'Documents added' },
docsUpdated: { type: 'number', description: 'Documents updated' },
docsDeleted: { type: 'number', description: 'Documents deleted' },
docsUnchanged: { type: 'number', description: 'Documents unchanged' },
errorMessage: { type: 'string', description: 'Error message if sync failed' },
},
},
},
},
}