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
136 lines
4.0 KiB
TypeScript
136 lines
4.0 KiB
TypeScript
import type {
|
|
TemporalListSchedulesParams,
|
|
TemporalListSchedulesResponse,
|
|
} from '@/tools/temporal/types'
|
|
import {
|
|
parseTemporalResponse,
|
|
temporalNamespaceUrl,
|
|
temporalRequestHeaders,
|
|
} from '@/tools/temporal/utils'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
interface RawScheduleListEntry {
|
|
scheduleId?: string
|
|
info?: {
|
|
workflowType?: { name?: string }
|
|
notes?: string
|
|
paused?: boolean
|
|
futureActionTimes?: string[]
|
|
}
|
|
}
|
|
|
|
export const listSchedulesTool: ToolConfig<
|
|
TemporalListSchedulesParams,
|
|
TemporalListSchedulesResponse
|
|
> = {
|
|
id: 'temporal_list_schedules',
|
|
name: 'Temporal List Schedules',
|
|
description: 'List schedules in a Temporal namespace.',
|
|
version: '1.0.0',
|
|
|
|
params: {
|
|
serverUrl: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: "Base URL of the Temporal server's HTTP API (e.g., http://localhost:7243)",
|
|
},
|
|
namespace: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'Temporal namespace (e.g., default)',
|
|
},
|
|
apiKey: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description: 'API key sent as a Bearer token (leave blank for servers without auth)',
|
|
},
|
|
query: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description:
|
|
'Visibility filter over schedules, e.g. TemporalSchedulePaused = false (empty lists all schedules)',
|
|
},
|
|
maximumPageSize: {
|
|
type: 'number',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Maximum number of schedules to return per page',
|
|
},
|
|
nextPageToken: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Page token from a previous response, for pagination',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: (params) => {
|
|
const search = new URLSearchParams()
|
|
if (params.query) search.set('query', params.query)
|
|
const pageSize = Number(params.maximumPageSize)
|
|
if (Number.isFinite(pageSize) && pageSize > 0) {
|
|
search.set('maximumPageSize', String(pageSize))
|
|
}
|
|
if (params.nextPageToken) search.set('nextPageToken', params.nextPageToken)
|
|
const queryString = search.toString()
|
|
return `${temporalNamespaceUrl(params.serverUrl, params.namespace)}/schedules${queryString ? `?${queryString}` : ''}`
|
|
},
|
|
method: 'GET',
|
|
headers: (params) => temporalRequestHeaders(params),
|
|
},
|
|
|
|
transformResponse: async (response: Response) => {
|
|
const data = await parseTemporalResponse<{
|
|
schedules?: RawScheduleListEntry[]
|
|
nextPageToken?: string
|
|
}>(response, 'list schedules')
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
schedules: (data.schedules ?? []).map((schedule) => ({
|
|
scheduleId: schedule.scheduleId ?? null,
|
|
workflowType: schedule.info?.workflowType?.name ?? null,
|
|
paused: schedule.info?.paused ?? false,
|
|
notes: schedule.info?.notes ?? null,
|
|
futureActionTimes: schedule.info?.futureActionTimes ?? [],
|
|
})),
|
|
nextPageToken: data.nextPageToken || null,
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
schedules: {
|
|
type: 'array',
|
|
description: 'Schedules in the namespace',
|
|
items: {
|
|
type: 'object',
|
|
properties: {
|
|
scheduleId: { type: 'string', description: 'Schedule ID' },
|
|
workflowType: {
|
|
type: 'string',
|
|
description: 'Workflow type the schedule starts',
|
|
},
|
|
paused: { type: 'boolean', description: 'Whether the schedule is paused' },
|
|
notes: { type: 'string', description: 'Human-readable notes on the schedule' },
|
|
futureActionTimes: {
|
|
type: 'json',
|
|
description: 'Upcoming action times (RFC 3339)',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
nextPageToken: {
|
|
type: 'string',
|
|
description: 'Token for the next page of results, null when no more pages exist',
|
|
optional: true,
|
|
},
|
|
},
|
|
}
|