:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { apiMutator } from '../../../../frontend/src/lib/api-orval-mutator'
/**
* Auto-generated from the Django backend OpenAPI schema.
* To modify these types, update the Django serializers or views, then run:
* hogli build:openapi
* Questions or issues? #team-devex on Slack
*
* PostHog API - generated
* OpenAPI spec version: 1.0.0
*/
import type {
ChannelContextGenerationApi,
ChannelContributorsDTOApi,
ChannelDTOApi,
ChannelFeedMessageDTOApi,
ChannelFeedMessageWriteApi,
ChannelInstructionsDTOApi,
ChannelInstructionsWriteApi,
ChannelListResponseApi,
ChannelMembersWriteApi,
ChannelSetupWriteApi,
ChannelStarWriteApi,
ChannelWriteApi,
ConnectionTokenResponseApi,
DesktopAccessResponseApi,
DesktopBetaTermsAcceptanceDTOApi,
LegacyDesktopAccessResponseApi,
ModelCatalogueResponseApi,
OnboardingSessionApi,
OnboardingSessionTestApi,
OnboardingSessionTestResponseApi,
PaginatedChannelFeedMessageDTOListApi,
PaginatedChannelInstructionsDTOListApi,
PaginatedSandboxCustomImageDTOListApi,
PaginatedSandboxEnvironmentDTOListApi,
PaginatedTaskListItemListApi,
PaginatedTaskMentionDTOListApi,
PaginatedTaskRunDetailDTOListApi,
PaginatedTaskSummaryDTOListApi,
PaginatedTaskThreadMessageDTOListApi,
PatchedChannelInstructionsWriteApi,
PatchedChannelUpdateApi,
PatchedRepoRoutingRuleApi,
PatchedSandboxCustomImageUpdateApi,
PatchedSandboxEnvironmentWriteApi,
PatchedTaskRunSetOutputRequestApi,
PatchedTaskRunSetSummaryRequestApi,
PatchedTaskRunUpdateApi,
PatchedTaskWriteApi,
PinnedTaskIdsResponseApi,
ProvisionedChannelsApi,
RepoRoutingRuleApi,
RepositoryReadinessResponseApi,
SandboxComputePricingApi,
SandboxCustomImageBuildApi,
SandboxCustomImageDTOApi,
SandboxCustomImageWriteApi,
SandboxCustomImagesListParams,
SandboxEnvironmentDTOApi,
SandboxEnvironmentWriteApi,
SandboxListParams,
SlackThreadContextResponseApi,
SpaceSetupStartedDTOApi,
StreamReadTokenResponseApi,
TaskActivityListParams,
TaskActivityMarkReadApi,
TaskActivityMarkReadResponseApi,
TaskActivityPageDTOApi,
TaskArtifactsResponseApi,
TaskChannelsFeedListParams,
TaskChannelsListParams,
TaskCommentDetailApi,
TaskCommentsResponseApi,
TaskCreateApi,
TaskCreateResponseDTOApi,
TaskDetailDTOApi,
TaskHandoffRequestApi,
TaskMentionsListParams,
TaskPinRequestApi,
TaskPinResponseApi,
TaskPresenceBeaconRequestApi,
TaskPullRequestTitlesApi,
TaskPullRequestTitlesRequestApi,
TaskRepositoriesResponseApi,
TaskReviewApi,
TaskRunAnalysisActivityRequestApi,
TaskRunAnalysisActivityResponseApi,
TaskRunAnalyzeResponseApi,
TaskRunAppendLogRequestApi,
TaskRunArtifactPresignRequestApi,
TaskRunArtifactPresignResponseApi,
TaskRunArtifactPreviewResponseApi,
TaskRunArtifactsDismissRequestApi,
TaskRunArtifactsDismissResponseApi,
TaskRunArtifactsFinalizeUploadRequestApi,
TaskRunArtifactsFinalizeUploadResponseApi,
TaskRunArtifactsPrepareUploadRequestApi,
TaskRunArtifactsPrepareUploadResponseApi,
TaskRunArtifactsUploadRequestApi,
TaskRunArtifactsUploadResponseApi,
TaskRunBootstrapCreateRequestApi,
TaskRunCancelRequestApi,
TaskRunCommandRequestApi,
TaskRunCommandResponseApi,
TaskRunCreateRequestSchemaApi,
TaskRunDetailDTOApi,
TaskRunLivingArtifactChartRequestApi,
TaskRunLivingArtifactChartResponseApi,
TaskRunLivingArtifactCreateRequestApi,
TaskRunLivingArtifactEditRequestApi,
TaskRunLivingArtifactOpenResponseApi,
TaskRunLivingArtifactResponseApi,
TaskRunLivingArtifactsResponseApi,
TaskRunPostHogReferencesRequestApi,
TaskRunPostHogReferencesResponseApi,
TaskRunRelayMessageRequestApi,
TaskRunRelayMessageResponseApi,
TaskRunResponseApi,
TaskRunStartRequestApi,
TaskRunSubscriptionTokenRequestApi,
TaskRunSubscriptionTokenResponseApi,
TaskSearchResultApi,
TaskSessionResponseApi,
TaskSessionSyncResponseApi,
TaskSourcesResponseApi,
TaskStagedArtifactsFinalizeUploadRequestApi,
TaskStagedArtifactsFinalizeUploadResponseApi,
TaskStagedArtifactsPrepareUploadRequestApi,
TaskStagedArtifactsPrepareUploadResponseApi,
TaskSummariesRequestApi,
TaskThreadMessageDTOApi,
TaskThreadMessageWriteApi,
TaskUsageResponseApi,
TaskUserBasicInfoApi,
TaskWriteApi,
TasksAIRunPreferencesApi,
TasksAgentInstructionsApi,
TasksCommentsListParams,
TasksCommentsRetrieveParams,
TasksConfigListParams,
TasksListParams,
TasksRepositoryReadinessRetrieveParams,
TasksReviewRetrieveParams,
TasksRunsArtifactsPreviewRetrieveParams,
TasksRunsListParams,
TasksRunsLivingArtifactsVersionContentParams,
TasksRunsSessionLogsRetrieveParams,
TasksRunsStreamRetrieveParams,
TasksRunsStreamTokenRetrieveParams,
TasksSearchRetrieveParams,
TasksSlackThreadContextRetrieveParams,
TasksSummariesCreateParams,
TasksTaskDefaultsApi,
TasksTaskDefaultsUpdateApi,
TasksTeamConfigResponseApi,
TasksThreadMessagesListParams,
TasksUserConfigResponseApi,
TeachingCanvasApi,
WarmTaskRequestApi,
WarmTaskResponseApi,
WarmTaskResumeRequestApi,
WarmTaskResumeResponseApi,
WizardCloudRunDTOApi,
} from './api.schemas'
// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497
type IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? A : B
type WritableKeys<T> = {
[P in keyof T]-?: IfEquals<{ [Q in P]: T[P] }, { -readonly [Q in P]: T[P] }, P>
}[keyof T]
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never
type DistributeReadOnlyOverUnions<T> = T extends any ? NonReadonly<T> : never
type Writable<T> = Pick<T, WritableKeys<T>>
type NonReadonly<T> = [T] extends [UnionToIntersection<T>]
? {
[P in keyof Writable<T>]: T[P] extends object ? NonReadonly<NonNullable<T[P]>> : T[P]
}
: DistributeReadOnlyOverUnions<T>
export const getCodeInvitesCheckAccessRetrieveUrl = () => {
return `/api/code/invites/check-access/`
}
/**
* Compatibility endpoint for released PostHog Desktop clients.
* @summary Check PostHog Desktop access
*/
export const codeInvitesCheckAccessRetrieve = async (
options?: RequestInit
): Promise<LegacyDesktopAccessResponseApi> => {
return apiMutator<LegacyDesktopAccessResponseApi>(getCodeInvitesCheckAccessRetrieveUrl(), {
...options,
method: 'GET',
})
}
export const getCodeSandboxPricingListUrl = () => {
return `/api/code/sandbox-pricing/`
}
/**
* Get the current sandbox compute rate card and expired rate-card history.
* @summary Get sandbox compute pricing
*/
export const codeSandboxPricingList = async (options?: RequestInit): Promise<SandboxComputePricingApi> => {
return apiMutator<SandboxComputePricingApi>(getCodeSandboxPricingListUrl(), {
...options,
method: 'GET',
})
}
export const getDesktopAccessRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/desktop/access/`
}
/**
* Evaluate Desktop access for the selected project and organization.
* @summary Check PostHog Desktop access
*/
export const desktopAccessRetrieve = async (
projectId: string,
options?: RequestInit
): Promise<DesktopAccessResponseApi> => {
return apiMutator<DesktopAccessResponseApi>(getDesktopAccessRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}
export const getDesktopBetaTermsListUrl = (projectId: string) => {
return `/api/projects/${projectId}/desktop_beta_terms/`
}
export const desktopBetaTermsList = async (
projectId: string,
options?: RequestInit
): Promise<DesktopBetaTermsAcceptanceDTOApi> => {
return apiMutator<DesktopBetaTermsAcceptanceDTOApi>(getDesktopBetaTermsListUrl(projectId), {
...options,
method: 'GET',
})
}
export const getDesktopBetaTermsCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/desktop_beta_terms/`
}
export const desktopBetaTermsCreate = async (
projectId: string,
options?: RequestInit
): Promise<DesktopBetaTermsAcceptanceDTOApi> => {
return apiMutator<DesktopBetaTermsAcceptanceDTOApi>(getDesktopBetaTermsCreateUrl(projectId), {
...options,
method: 'POST',
})
}
export const getSandboxCustomImagesListUrl = (projectId: string, params?: SandboxCustomImagesListParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/sandbox_custom_images/?${stringifiedParams}`
: `/api/projects/${projectId}/sandbox_custom_images/`
}
/**
* API for custom sandbox base images, built on top of the VM sandbox base via an image-builder agent.
*
* Custom images only run on the Modal VM runtime, so every action is gated on the
* `tasks-modal-vm-sandbox` flag (org-enabled with `user_created` in its origin_products payload).
*/
export const sandboxCustomImagesList = async (
projectId: string,
params?: SandboxCustomImagesListParams,
options?: RequestInit
): Promise<PaginatedSandboxCustomImageDTOListApi> => {
return apiMutator<PaginatedSandboxCustomImageDTOListApi>(getSandboxCustomImagesListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getSandboxCustomImagesCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/sandbox_custom_images/`
}
/**
* Create a draft custom image and start its interactive image-builder agent task. The returned builder_task_id points at the conversation.
*/
export const sandboxCustomImagesCreate = async (
projectId: string,
sandboxCustomImageWriteApi: SandboxCustomImageWriteApi,
options?: RequestInit
): Promise<SandboxCustomImageDTOApi> => {
return apiMutator<SandboxCustomImageDTOApi>(getSandboxCustomImagesCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(sandboxCustomImageWriteApi),
})
}
export const getSandboxCustomImagesRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/sandbox_custom_images/${id}/`
}
/**
* API for custom sandbox base images, built on top of the VM sandbox base via an image-builder agent.
*
* Custom images only run on the Modal VM runtime, so every action is gated on the
* `tasks-modal-vm-sandbox` flag (org-enabled with `user_created` in its origin_products payload).
*/
export const sandboxCustomImagesRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<SandboxCustomImageDTOApi> => {
return apiMutator<SandboxCustomImageDTOApi>(getSandboxCustomImagesRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getSandboxCustomImagesPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/sandbox_custom_images/${id}/`
}
/**
* Rename or update the description of a custom image. Only mutable metadata (name, description) is editable; the build spec and status are managed by the build flow.
*/
export const sandboxCustomImagesPartialUpdate = async (
projectId: string,
id: string,
patchedSandboxCustomImageUpdateApi?: PatchedSandboxCustomImageUpdateApi,
options?: RequestInit
): Promise<SandboxCustomImageDTOApi> => {
return apiMutator<SandboxCustomImageDTOApi>(getSandboxCustomImagesPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedSandboxCustomImageUpdateApi),
})
}
export const getSandboxCustomImagesDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/sandbox_custom_images/${id}/`
}
/**
* API for custom sandbox base images, built on top of the VM sandbox base via an image-builder agent.
*
* Custom images only run on the Modal VM runtime, so every action is gated on the
* `tasks-modal-vm-sandbox` flag (org-enabled with `user_created` in its origin_products payload).
*/
export const sandboxCustomImagesDestroy = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getSandboxCustomImagesDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getSandboxCustomImagesBuildCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/sandbox_custom_images/${id}/build/`
}
/**
* Persist the image spec (from the request body or the builder agent's sandbox), run the security scan, and on pass build and publish the image.
*/
export const sandboxCustomImagesBuildCreate = async (
projectId: string,
id: string,
sandboxCustomImageBuildApi?: SandboxCustomImageBuildApi,
options?: RequestInit
): Promise<SandboxCustomImageDTOApi> => {
return apiMutator<SandboxCustomImageDTOApi>(getSandboxCustomImagesBuildCreateUrl(projectId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(sandboxCustomImageBuildApi),
})
}
export const getSandboxCustomImagesBuilderTaskCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/sandbox_custom_images/${id}/builder_task/`
}
/**
* Revive (or reuse) the image's builder agent session. When the previous session has ended, a fresh one is started seeded with the stored spec — use this to update an existing image.
*/
export const sandboxCustomImagesBuilderTaskCreate = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<SandboxCustomImageDTOApi> => {
return apiMutator<SandboxCustomImageDTOApi>(getSandboxCustomImagesBuilderTaskCreateUrl(projectId, id), {
...options,
method: 'POST',
})
}
export const getSandboxListUrl = (projectId: string, params?: SandboxListParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/sandbox_environments/?${stringifiedParams}`
: `/api/projects/${projectId}/sandbox_environments/`
}
/**
* API for managing sandbox environments that control network access for task runs.
*/
export const sandboxList = async (
projectId: string,
params?: SandboxListParams,
options?: RequestInit
): Promise<PaginatedSandboxEnvironmentDTOListApi> => {
return apiMutator<PaginatedSandboxEnvironmentDTOListApi>(getSandboxListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getSandboxCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/sandbox_environments/`
}
/**
* API for managing sandbox environments that control network access for task runs.
*/
export const sandboxCreate = async (
projectId: string,
sandboxEnvironmentWriteApi: SandboxEnvironmentWriteApi,
options?: RequestInit
): Promise<SandboxEnvironmentDTOApi> => {
return apiMutator<SandboxEnvironmentDTOApi>(getSandboxCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(sandboxEnvironmentWriteApi),
})
}
export const getSandboxRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/sandbox_environments/${id}/`
}
/**
* API for managing sandbox environments that control network access for task runs.
*/
export const sandboxRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<SandboxEnvironmentDTOApi> => {
return apiMutator<SandboxEnvironmentDTOApi>(getSandboxRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getSandboxPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/sandbox_environments/${id}/`
}
/**
* API for managing sandbox environments that control network access for task runs.
*/
export const sandboxPartialUpdate = async (
projectId: string,
id: string,
patchedSandboxEnvironmentWriteApi?: PatchedSandboxEnvironmentWriteApi,
options?: RequestInit
): Promise<SandboxEnvironmentDTOApi> => {
return apiMutator<SandboxEnvironmentDTOApi>(getSandboxPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedSandboxEnvironmentWriteApi),
})
}
export const getSandboxDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/sandbox_environments/${id}/`
}
/**
* API for managing sandbox environments that control network access for task runs.
*/
export const sandboxDestroy = async (projectId: string, id: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getSandboxDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getTaskActivityListUrl = (projectId: string, params?: TaskActivityListParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/task_activity/?${stringifiedParams}`
: `/api/projects/${projectId}/task_activity/`
}
/**
* Task lifecycle rows collapse per task. Comment notifications remain separate. Results are most-recent first and restricted to tasks the requester can see.
* @summary List the requester's task activity
*/
export const taskActivityList = async (
projectId: string,
params?: TaskActivityListParams,
options?: RequestInit
): Promise<TaskActivityPageDTOApi> => {
return apiMutator<TaskActivityPageDTOApi>(getTaskActivityListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getTaskActivityMarkReadCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/task_activity/mark_read/`
}
/**
* Clear collapsed task activity through task timestamps and individual comment activity through activity IDs.
* @summary Mark task activity read
*/
export const taskActivityMarkReadCreate = async (
projectId: string,
taskActivityMarkReadApi: TaskActivityMarkReadApi,
options?: RequestInit
): Promise<TaskActivityMarkReadResponseApi> => {
return apiMutator<TaskActivityMarkReadResponseApi>(getTaskActivityMarkReadCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskActivityMarkReadApi),
})
}
export const getTaskChannelsListUrl = (projectId: string, params?: TaskChannelsListParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/task_channels/?${stringifiedParams}`
: `/api/projects/${projectId}/task_channels/`
}
/**
* List channels the requester can access, sorted by name and ID. Includes public channels, their personal #me channel, and private channels they belong to. Call provision_defaults to create missing default channels. Send limit and offset to get a page with count, next, previous, and results. Without limit, the response is an array of all accessible channels.
* @summary List channels
*/
export const taskChannelsList = async (
projectId: string,
params?: TaskChannelsListParams,
options?: RequestInit
): Promise<ChannelListResponseApi> => {
return apiMutator<ChannelListResponseApi>(getTaskChannelsListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getTaskChannelsCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/task_channels/`
}
/**
* Create a channel. Public channels use lowercase names with hyphens. If a public channel has that name, return it. The name general returns the project's general space. Private channels always get a new ID, even if another channel has the same name. The requester and users in member_ids with project access become members. New channels are starred for the requester unless star is false. The names "me" and "personal" are reserved.
* @summary Create a channel
*/
export const taskChannelsCreate = async (
projectId: string,
channelWriteApi: ChannelWriteApi,
options?: RequestInit
): Promise<ChannelDTOApi> => {
return apiMutator<ChannelDTOApi>(getTaskChannelsCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(channelWriteApi),
})
}
export const getTaskChannelsFeedListUrl = (
projectId: string,
channelId: string,
params?: TaskChannelsFeedListParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/task_channels/${channelId}/feed/?${stringifiedParams}`
: `/api/projects/${projectId}/task_channels/${channelId}/feed/`
}
/**
* A channel's system announcements in chronological order.
* @summary List channel feed messages
*/
export const taskChannelsFeedList = async (
projectId: string,
channelId: string,
params?: TaskChannelsFeedListParams,
options?: RequestInit
): Promise<PaginatedChannelFeedMessageDTOListApi> => {
return apiMutator<PaginatedChannelFeedMessageDTOListApi>(getTaskChannelsFeedListUrl(projectId, channelId, params), {
...options,
method: 'GET',
})
}
export const getTaskChannelsFeedCreateUrl = (projectId: string, channelId: string) => {
return `/api/projects/${projectId}/task_channels/${channelId}/feed/`
}
/**
* API for a channel's system-announcement feed — durable "PostHog agent" rows
* (context created, CONTEXT.md being built) rendered alongside the channel's task
* cards. Read by any team member for a public channel; personal channels are owner-only.
* @summary Post a channel feed message
*/
export const taskChannelsFeedCreate = async (
projectId: string,
channelId: string,
channelFeedMessageWriteApi: ChannelFeedMessageWriteApi,
options?: RequestInit
): Promise<ChannelFeedMessageDTOApi> => {
return apiMutator<ChannelFeedMessageDTOApi>(getTaskChannelsFeedCreateUrl(projectId, channelId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(channelFeedMessageWriteApi),
})
}
export const getTaskChannelsRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/task_channels/${id}/`
}
/**
* @summary Get a channel
*/
export const taskChannelsRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<ChannelDTOApi> => {
return apiMutator<ChannelDTOApi>(getTaskChannelsRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getTaskChannelsPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/task_channels/${id}/`
}
/**
* @summary Update a channel
*/
export const taskChannelsPartialUpdate = async (
projectId: string,
id: string,
patchedChannelUpdateApi?: PatchedChannelUpdateApi,
options?: RequestInit
): Promise<ChannelDTOApi> => {
return apiMutator<ChannelDTOApi>(getTaskChannelsPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedChannelUpdateApi),
})
}
export const getTaskChannelsDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/task_channels/${id}/`
}
/**
* @summary Delete a channel
*/
export const taskChannelsDestroy = async (projectId: string, id: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getTaskChannelsDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getTaskChannelsContextGenerationRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/task_channels/${id}/context_generation/`
}
/**
* @summary Get the channel's CONTEXT.md generation task
*/
export const taskChannelsContextGenerationRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<ChannelContextGenerationApi> => {
return apiMutator<ChannelContextGenerationApi>(getTaskChannelsContextGenerationRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getTaskChannelsContextGenerationUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/task_channels/${id}/context_generation/`
}
/**
* @summary Set or clear the channel's CONTEXT.md generation task
*/
export const taskChannelsContextGenerationUpdate = async (
projectId: string,
id: string,
channelContextGenerationApi: ChannelContextGenerationApi,
options?: RequestInit
): Promise<ChannelContextGenerationApi> => {
return apiMutator<ChannelContextGenerationApi>(getTaskChannelsContextGenerationUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(channelContextGenerationApi),
})
}
export const getTaskChannelsInstructionsRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/task_channels/${id}/instructions/`
}
/**
* The channel's latest CONTEXT.md instructions. A channel with no published instructions reads as a blank version 0 — publish against base_version 0 to create version 1.
* @summary Get channel instructions
*/
export const taskChannelsInstructionsRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<ChannelInstructionsDTOApi> => {
return apiMutator<ChannelInstructionsDTOApi>(getTaskChannelsInstructionsRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getTaskChannelsInstructionsUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/task_channels/${id}/instructions/`
}
/**
* Publish a new version of the channel's CONTEXT.md instructions. Pass base_version (the version you read) so a concurrent edit is rejected with 409 instead of overwritten.
* @summary Publish channel instructions
*/
export const taskChannelsInstructionsUpdate = async (
projectId: string,
id: string,
channelInstructionsWriteApi: ChannelInstructionsWriteApi,
options?: RequestInit
): Promise<ChannelInstructionsDTOApi> => {
return apiMutator<ChannelInstructionsDTOApi>(getTaskChannelsInstructionsUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(channelInstructionsWriteApi),
})
}
export const getTaskChannelsInstructionsPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/task_channels/${id}/instructions/`
}
/**
* Publish a new version of the channel's CONTEXT.md instructions. Pass base_version (the version you read) so a concurrent edit is rejected with 409 instead of overwritten.
* @summary Publish channel instructions
*/
export const taskChannelsInstructionsPartialUpdate = async (
projectId: string,
id: string,
patchedChannelInstructionsWriteApi?: PatchedChannelInstructionsWriteApi,
options?: RequestInit
): Promise<ChannelInstructionsDTOApi> => {
return apiMutator<ChannelInstructionsDTOApi>(getTaskChannelsInstructionsPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedChannelInstructionsWriteApi),
})
}
export const getTaskChannelsInstructionsDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/task_channels/${id}/instructions/`
}
/**
* @summary Delete channel instructions
*/
export const taskChannelsInstructionsDestroy = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getTaskChannelsInstructionsDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getTaskChannelsInstructionsVersionsRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/task_channels/${id}/instructions/versions/`
}
/**
* @summary List channel instruction versions
*/
export const taskChannelsInstructionsVersionsRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<PaginatedChannelInstructionsDTOListApi> => {
return apiMutator<PaginatedChannelInstructionsDTOListApi>(
getTaskChannelsInstructionsVersionsRetrieveUrl(projectId, id),
{
...options,
method: 'GET',
}
)
}
export const getTaskChannelsMembersRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/task_channels/${id}/members/`
}
/**
* List the members of a private channel. Return an empty list for public and personal channels. Return 404 if the requester cannot access the channel.
* @summary List a channel's members
*/
export const taskChannelsMembersRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<TaskUserBasicInfoApi[]> => {
return apiMutator<TaskUserBasicInfoApi[]>(getTaskChannelsMembersRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getTaskChannelsMembersUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/task_channels/${id}/members/`
}
/**
* Replace the members of a private channel. Any member can update this list. The creator remains a member. Return 400 for public and personal channels.
* @summary Replace a private channel's members
*/
export const taskChannelsMembersUpdate = async (
projectId: string,
id: string,
channelMembersWriteApi: ChannelMembersWriteApi,
options?: RequestInit
): Promise<TaskUserBasicInfoApi[]> => {
return apiMutator<TaskUserBasicInfoApi[]>(getTaskChannelsMembersUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(channelMembersWriteApi),
})
}
export const getTaskChannelsSetupCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/task_channels/${id}/setup/`
}
/**
* Starts one unattended task in the channel that resolves the metric, writes the context page and, for a goal, creates the tracking canvas and the loops. The task becomes the channel's context generation task.
* @summary Set a space up for a goal or a feature
*/
export const taskChannelsSetupCreate = async (
projectId: string,
id: string,
channelSetupWriteApi: ChannelSetupWriteApi,
options?: RequestInit
): Promise<SpaceSetupStartedDTOApi> => {
return apiMutator<SpaceSetupStartedDTOApi>(getTaskChannelsSetupCreateUrl(projectId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(channelSetupWriteApi),
})
}
export const getTaskChannelsStarCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/task_channels/${id}/star/`
}
/**
* @summary Star or unstar a channel for the requesting user
*/
export const taskChannelsStarCreate = async (
projectId: string,
id: string,
channelStarWriteApi: ChannelStarWriteApi,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getTaskChannelsStarCreateUrl(projectId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(channelStarWriteApi),
})
}
export const getTaskChannelsContributorsRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/task_channels/contributors/`
}
/**
* For each channel the requester can access, list the people who own at least one task or canvas in it, most recently active first. Channels with no owners are left out.
* @summary List who worked in each channel
*/
export const taskChannelsContributorsRetrieve = async (
projectId: string,
options?: RequestInit
): Promise<ChannelContributorsDTOApi[]> => {
return apiMutator<ChannelContributorsDTOApi[]>(getTaskChannelsContributorsRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}
export const getTaskChannelsOnboardingSessionCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/task_channels/onboarding_session/`
}
/**
* Open the agent session a new user lands in, in the team's #general space. Reads the company's homepage, so it takes a few seconds and is deliberately not part of provisioning, which blocks the app opening. Callers fire it without awaiting it when provision_defaults reports personal_created.
* @summary Start a first-run onboarding session
*/
export const taskChannelsOnboardingSessionCreate = async (
projectId: string,
options?: RequestInit
): Promise<OnboardingSessionApi> => {
return apiMutator<OnboardingSessionApi>(getTaskChannelsOnboardingSessionCreateUrl(projectId), {
...options,
method: 'POST',
})
}
export const getTaskChannelsOnboardingSessionTestCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/task_channels/onboarding_session_test/`
}
/**
* Feature-flagged test path that creates a repeatable session from explicit prompt-building inputs, in the requester's personal space.
* @summary Start a test first-run onboarding session
*/
export const taskChannelsOnboardingSessionTestCreate = async (
projectId: string,
onboardingSessionTestApi?: OnboardingSessionTestApi,
options?: RequestInit
): Promise<OnboardingSessionTestResponseApi> => {
return apiMutator<OnboardingSessionTestResponseApi>(getTaskChannelsOnboardingSessionTestCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(onboardingSessionTestApi),
})
}
export const getTaskChannelsProvisionDefaultsCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/task_channels/provision_defaults/`
}
/**
* Get-or-create the requester's personal #me channel and the team's shared #general channel, and report which of the two this call created. Idempotent.
* @summary Provision default channels
*/
export const taskChannelsProvisionDefaultsCreate = async (
projectId: string,
options?: RequestInit
): Promise<ProvisionedChannelsApi> => {
return apiMutator<ProvisionedChannelsApi>(getTaskChannelsProvisionDefaultsCreateUrl(projectId), {
...options,
method: 'POST',
})
}
export const getTaskChannelsTeachingCanvasTestCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/task_channels/teaching_canvas_test/`
}
/**
* Feature-flagged test path that resolves or creates the teaching canvas in the requester's personal space.
* @summary Create the teaching canvas for testing
*/
export const taskChannelsTeachingCanvasTestCreate = async (
projectId: string,
options?: RequestInit
): Promise<TeachingCanvasApi> => {
return apiMutator<TeachingCanvasApi>(getTaskChannelsTeachingCanvasTestCreateUrl(projectId), {
...options,
method: 'POST',
})
}
export const getTaskMentionsListUrl = (projectId: string, params?: TaskMentionsListParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/task_mentions/?${stringifiedParams}`
: `/api/projects/${projectId}/task_mentions/`
}
/**
* Thread messages that @-mention the requester, newest first, restricted to tasks they can see.
* @summary List mentions of the requester
*/
export const taskMentionsList = async (
projectId: string,
params?: TaskMentionsListParams,
options?: RequestInit
): Promise<PaginatedTaskMentionDTOListApi> => {
return apiMutator<PaginatedTaskMentionDTOListApi>(getTaskMentionsListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getTasksListUrl = (projectId: string, params?: TasksListParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/tasks/?${stringifiedParams}`
: `/api/projects/${projectId}/tasks/`
}
/**
* Get a list of tasks for the current project, with optional filtering by origin product, stage, organization, repository, created_by, and the workflow (hog_flow_id) that created the task. By default, each row includes description. Pass basic=true for a summary row that omits description and includes description_preview, its first 1000 characters. Use the search parameter to match description text server-side.
* @summary List tasks
*/
export const tasksList = async (
projectId: string,
params?: TasksListParams,
options?: RequestInit
): Promise<PaginatedTaskListItemListApi> => {
return apiMutator<PaginatedTaskListItemListApi>(getTasksListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getTasksCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/tasks/`
}
/**
* API for managing tasks within a project. Tasks represent units of work to be performed by an agent.
*/
export const tasksCreate = async (
projectId: string,
taskCreateApi?: TaskCreateApi,
options?: RequestInit
): Promise<TaskCreateResponseDTOApi> => {
return apiMutator<TaskCreateResponseDTOApi>(getTasksCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskCreateApi),
})
}
export const getTasksRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${id}/`
}
/**
* Retrieve a single task by ID.
* @summary Get task
*/
export const tasksRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<TaskDetailDTOApi> => {
return apiMutator<TaskDetailDTOApi>(getTasksRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getTasksUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${id}/`
}
/**
* API for managing tasks within a project. Tasks represent units of work to be performed by an agent.
*/
export const tasksUpdate = async (
projectId: string,
id: string,
taskWriteApi?: TaskWriteApi,
options?: RequestInit
): Promise<TaskDetailDTOApi> => {
return apiMutator<TaskDetailDTOApi>(getTasksUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskWriteApi),
})
}
export const getTasksPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${id}/`
}
/**
* API for managing tasks within a project. Tasks represent units of work to be performed by an agent.
*/
export const tasksPartialUpdate = async (
projectId: string,
id: string,
patchedTaskWriteApi?: PatchedTaskWriteApi,
options?: RequestInit
): Promise<TaskDetailDTOApi> => {
return apiMutator<TaskDetailDTOApi>(getTasksPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedTaskWriteApi),
})
}
export const getTasksDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${id}/`
}
/**
* API for managing tasks within a project. Tasks represent units of work to be performed by an agent.
*/
export const tasksDestroy = async (projectId: string, id: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getTasksDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getTasksArtifactsListUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${id}/artifacts/`
}
/**
* API for managing tasks within a project. Tasks represent units of work to be performed by an agent.
*/
export const tasksArtifactsList = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<TaskArtifactsResponseApi> => {
return apiMutator<TaskArtifactsResponseApi>(getTasksArtifactsListUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getTasksCommentsListUrl = (projectId: string, id: string, params?: TasksCommentsListParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/tasks/${id}/comments/?${stringifiedParams}`
: `/api/projects/${projectId}/tasks/${id}/comments/`
}
/**
* API for managing tasks within a project. Tasks represent units of work to be performed by an agent.
*/
export const tasksCommentsList = async (
projectId: string,
id: string,
params?: TasksCommentsListParams,
options?: RequestInit
): Promise<TaskCommentsResponseApi> => {
return apiMutator<TaskCommentsResponseApi>(getTasksCommentsListUrl(projectId, id, params), {
...options,
method: 'GET',
})
}
export const getTasksCommentsRetrieveUrl = (
projectId: string,
id: string,
rootCommentId: string,
params?: TasksCommentsRetrieveParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/tasks/${id}/comments/${rootCommentId}/?${stringifiedParams}`
: `/api/projects/${projectId}/tasks/${id}/comments/${rootCommentId}/`
}
/**
* API for managing tasks within a project. Tasks represent units of work to be performed by an agent.
*/
export const tasksCommentsRetrieve = async (
projectId: string,
id: string,
rootCommentId: string,
params?: TasksCommentsRetrieveParams,
options?: RequestInit
): Promise<TaskCommentDetailApi> => {
return apiMutator<TaskCommentDetailApi>(getTasksCommentsRetrieveUrl(projectId, id, rootCommentId, params), {
...options,
method: 'GET',
})
}
export const getTasksHandoffCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${id}/handoff/`
}
/**
* Transfer ownership of a task to another member of the project: they take over driving it (steering, archiving, running), and future runs resolve GitHub authorship and notification recipients from them. Only the task's current owner can hand it off. Every run must be finished or canceled, and every sandbox must be shut down first. A task in a private space moves into the recipient's private space; a task in a shared space stays there.
* @summary Hand a task off to a colleague
*/
export const tasksHandoffCreate = async (
projectId: string,
id: string,
taskHandoffRequestApi: TaskHandoffRequestApi,
options?: RequestInit
): Promise<TaskDetailDTOApi> => {
return apiMutator<TaskDetailDTOApi>(getTasksHandoffCreateUrl(projectId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskHandoffRequestApi),
})
}
export const getTasksPinCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${id}/pin/`
}
/**
* API for managing tasks within a project. Tasks represent units of work to be performed by an agent.
*/
export const tasksPinCreate = async (
projectId: string,
id: string,
taskPinRequestApi: TaskPinRequestApi,
options?: RequestInit
): Promise<TaskPinResponseApi> => {
return apiMutator<TaskPinResponseApi>(getTasksPinCreateUrl(projectId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskPinRequestApi),
})
}
export const getTasksPresenceCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${id}/presence/`
}
/**
* Idempotent upsert: marks the calling user + `device_id` as actively watching this task for the next ~60 seconds. While at least one device for the user has a non-expired presence row for this task, the push fanout will skip ALL of that user's other registered devices for task notifications — the contract is 'if any device is demonstrably watching, suppress the others'. Clients call this every ~30s while the task screen is foregrounded. `device_id` is the UUID of the caller's UserPushToken row.
* @summary Beacon presence for a device watching this task
*/
export const tasksPresenceCreate = async (
projectId: string,
id: string,
taskPresenceBeaconRequestApi: TaskPresenceBeaconRequestApi,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getTasksPresenceCreateUrl(projectId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskPresenceBeaconRequestApi),
})
}
export const getTasksPresenceDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${id}/presence/`
}
/**
* Idempotent upsert: marks the calling user + `device_id` as actively watching this task for the next ~60 seconds. While at least one device for the user has a non-expired presence row for this task, the push fanout will skip ALL of that user's other registered devices for task notifications — the contract is 'if any device is demonstrably watching, suppress the others'. Clients call this every ~30s while the task screen is foregrounded. `device_id` is the UUID of the caller's UserPushToken row.
* @summary Beacon presence for a device watching this task
*/
export const tasksPresenceDestroy = async (projectId: string, id: string, options?: RequestInit): Promise<void> => {
return apiMutator<void>(getTasksPresenceDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getTasksReviewRetrieveUrl = (projectId: string, id: string, params?: TasksReviewRetrieveParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/tasks/${id}/review/?${stringifiedParams}`
: `/api/projects/${projectId}/tasks/${id}/review/`
}
/**
* API for managing tasks within a project. Tasks represent units of work to be performed by an agent.
*/
export const tasksReviewRetrieve = async (
projectId: string,
id: string,
params?: TasksReviewRetrieveParams,
options?: RequestInit
): Promise<TaskReviewApi> => {
return apiMutator<TaskReviewApi>(getTasksReviewRetrieveUrl(projectId, id, params), {
...options,
method: 'GET',
})
}
export const getTasksRunCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${id}/run/`
}
/**
* Create a new task run and kick off the workflow. The response is the refreshed task with the created run under the top-level `run` key: read `run.id` for anything run-scoped, such as the run's stream and command endpoints. The top-level `id` is the task's, and `latest_run` mirrors `run` only as long as nothing newer starts — reading either of those as the created run is deprecated.
* @summary Run task
*/
export const tasksRunCreate = async (
projectId: string,
id: string,
taskRunCreateRequestSchemaApi?: TaskRunCreateRequestSchemaApi,
options?: RequestInit
): Promise<TaskRunResponseApi> => {
return apiMutator<TaskRunResponseApi>(getTasksRunCreateUrl(projectId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskRunCreateRequestSchemaApi),
})
}
export const getTasksStagedArtifactsFinalizeUploadCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${id}/staged_artifacts/finalize_upload/`
}
/**
* Verify staged S3 uploads and cache their metadata so they can be attached to the next run created for this task.
* @summary Finalize staged direct uploads for task attachments
*/
export const tasksStagedArtifactsFinalizeUploadCreate = async (
projectId: string,
id: string,
taskStagedArtifactsFinalizeUploadRequestApi: TaskStagedArtifactsFinalizeUploadRequestApi,
options?: RequestInit
): Promise<TaskStagedArtifactsFinalizeUploadResponseApi> => {
return apiMutator<TaskStagedArtifactsFinalizeUploadResponseApi>(
getTasksStagedArtifactsFinalizeUploadCreateUrl(projectId, id),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskStagedArtifactsFinalizeUploadRequestApi),
}
)
}
export const getTasksStagedArtifactsPrepareUploadCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${id}/staged_artifacts/prepare_upload/`
}
/**
* Reserve S3 object keys for task attachments before creating a new run and return presigned POST forms for direct uploads.
* @summary Prepare staged direct uploads for task attachments
*/
export const tasksStagedArtifactsPrepareUploadCreate = async (
projectId: string,
id: string,
taskStagedArtifactsPrepareUploadRequestApi: TaskStagedArtifactsPrepareUploadRequestApi,
options?: RequestInit
): Promise<TaskStagedArtifactsPrepareUploadResponseApi> => {
return apiMutator<TaskStagedArtifactsPrepareUploadResponseApi>(
getTasksStagedArtifactsPrepareUploadCreateUrl(projectId, id),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskStagedArtifactsPrepareUploadRequestApi),
}
)
}
export const getTasksUsageRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${id}/usage/`
}
/**
* Return estimated model and cloud compute costs attributed to a task.
* @summary Get task usage
*/
export const tasksUsageRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<TaskUsageResponseApi> => {
return apiMutator<TaskUsageResponseApi>(getTasksUsageRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getTasksWarmResumeCreateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${id}/warm/`
}
/**
* Warm an idling successor for the task's latest terminal Run while the user composes the next message. The successor restores the prior snapshot when compatible and waits for the normal run endpoint to activate it. Best-effort: returns an empty body when warming is disabled, capped, or the task advanced to another Run.
* @summary Warm a resumed task sandbox
*/
export const tasksWarmResumeCreate = async (
projectId: string,
id: string,
warmTaskResumeRequestApi: WarmTaskResumeRequestApi,
options?: RequestInit
): Promise<WarmTaskResumeResponseApi> => {
return apiMutator<WarmTaskResumeResponseApi>(getTasksWarmResumeCreateUrl(projectId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(warmTaskResumeRequestApi),
})
}
export const getTasksRunsListUrl = (projectId: string, taskId: string, params?: TasksRunsListParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/tasks/${taskId}/runs/?${stringifiedParams}`
: `/api/projects/${projectId}/tasks/${taskId}/runs/`
}
/**
* Get a list of runs for a specific task.
* @summary List task runs
*/
export const tasksRunsList = async (
projectId: string,
taskId: string,
params?: TasksRunsListParams,
options?: RequestInit
): Promise<PaginatedTaskRunDetailDTOListApi> => {
return apiMutator<PaginatedTaskRunDetailDTOListApi>(getTasksRunsListUrl(projectId, taskId, params), {
...options,
method: 'GET',
})
}
export const getTasksRunsCreateUrl = (projectId: string, taskId: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/`
}
/**
* Create a new run for a specific task without starting execution.
* @summary Create task run
*/
export const tasksRunsCreate = async (
projectId: string,
taskId: string,
taskRunBootstrapCreateRequestApi?: TaskRunBootstrapCreateRequestApi,
options?: RequestInit
): Promise<TaskRunDetailDTOApi> => {
return apiMutator<TaskRunDetailDTOApi>(getTasksRunsCreateUrl(projectId, taskId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskRunBootstrapCreateRequestApi),
})
}
export const getTasksRunsRetrieveUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/`
}
/**
* Retrieve a single run for a specific task.
* @summary Get task run
*/
export const tasksRunsRetrieve = async (
projectId: string,
taskId: string,
id: string,
options?: RequestInit
): Promise<TaskRunDetailDTOApi> => {
return apiMutator<TaskRunDetailDTOApi>(getTasksRunsRetrieveUrl(projectId, taskId, id), {
...options,
method: 'GET',
})
}
export const getTasksRunsPartialUpdateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/`
}
/**
* API for managing task runs. Each run represents an execution of a task.
* @summary Update task run
*/
export const tasksRunsPartialUpdate = async (
projectId: string,
taskId: string,
id: string,
patchedTaskRunUpdateApi?: PatchedTaskRunUpdateApi,
options?: RequestInit
): Promise<TaskRunDetailDTOApi> => {
return apiMutator<TaskRunDetailDTOApi>(getTasksRunsPartialUpdateUrl(projectId, taskId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedTaskRunUpdateApi),
})
}
export const getTasksRunsAnalysisActivityCreateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/analysis-activity/`
}
/**
* Store one activity record on a task-analysis run. Only the run's own task-bound sandbox agent may call it, and only on a task-analysis run. Activities arrive in log order and do not overlap. An exact repeat of a stored activity returns its index without storing it again. The activities list is server-owned: it is not writable through the run update endpoint.
* @summary Report an analysis activity
*/
export const tasksRunsAnalysisActivityCreate = async (
projectId: string,
taskId: string,
id: string,
taskRunAnalysisActivityRequestApi: TaskRunAnalysisActivityRequestApi,
options?: RequestInit
): Promise<TaskRunAnalysisActivityResponseApi> => {
return apiMutator<TaskRunAnalysisActivityResponseApi>(
getTasksRunsAnalysisActivityCreateUrl(projectId, taskId, id),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskRunAnalysisActivityRequestApi),
}
)
}
export const getTasksRunsAnalyzeCreateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/analyze/`
}
/**
* Create a PostHog-funded analysis task that reviews this run's transcript for inefficiencies and reports findings. Idempotent per run: if an analysis task already exists for this run, it is returned instead of creating another. The analysis is not billed to the customer.
* @summary Analyze this run
*/
export const tasksRunsAnalyzeCreate = async (
projectId: string,
taskId: string,
id: string,
options?: RequestInit
): Promise<TaskRunAnalyzeResponseApi> => {
return apiMutator<TaskRunAnalyzeResponseApi>(getTasksRunsAnalyzeCreateUrl(projectId, taskId, id), {
...options,
method: 'POST',
})
}
export const getTasksRunsAppendLogCreateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/append_log/`
}
/**
* Append one or more log entries to the task run log array
* @summary Append log entries
*/
export const tasksRunsAppendLogCreate = async (
projectId: string,
taskId: string,
id: string,
taskRunAppendLogRequestApi: TaskRunAppendLogRequestApi,
options?: RequestInit
): Promise<TaskRunDetailDTOApi> => {
return apiMutator<TaskRunDetailDTOApi>(getTasksRunsAppendLogCreateUrl(projectId, taskId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskRunAppendLogRequestApi),
})
}
export const getTasksRunsArtifactsCreateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/artifacts/`
}
/**
* Persist task artifacts to S3 and attach them to the run manifest.
* @summary Upload artifacts for a task run
*/
export const tasksRunsArtifactsCreate = async (
projectId: string,
taskId: string,
id: string,
taskRunArtifactsUploadRequestApi: TaskRunArtifactsUploadRequestApi,
options?: RequestInit
): Promise<TaskRunArtifactsUploadResponseApi> => {
return apiMutator<TaskRunArtifactsUploadResponseApi>(getTasksRunsArtifactsCreateUrl(projectId, taskId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskRunArtifactsUploadRequestApi),
})
}
export const getTasksRunsArtifactsDownloadRetrieveUrl = (
projectId: string,
taskId: string,
id: string,
artifactId: string
) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/artifacts/${artifactId}/download/`
}
/**
* Redirects to a short-lived presigned URL for the artifact, so callers can share a stable link instead of a raw presigned URL.
* @summary Download a task run artifact by id
*/
export const tasksRunsArtifactsDownloadRetrieve = async (
projectId: string,
taskId: string,
id: string,
artifactId: string,
options?: RequestInit
): Promise<unknown> => {
return apiMutator<unknown>(getTasksRunsArtifactsDownloadRetrieveUrl(projectId, taskId, id, artifactId), {
...options,
method: 'GET',
})
}
export const getTasksRunsArtifactsPreviewRetrieveUrl = (
projectId: string,
taskId: string,
id: string,
artifactId: string,
params?: TasksRunsArtifactsPreviewRetrieveParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/artifacts/${artifactId}/preview/?${stringifiedParams}`
: `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/artifacts/${artifactId}/preview/`
}
/**
* Returns a short-lived URL for one HTML artifact version on the artifact origin. The page runs its scripts only when scripts=true.
* @summary Open an isolated HTML artifact preview
*/
export const tasksRunsArtifactsPreviewRetrieve = async (
projectId: string,
taskId: string,
id: string,
artifactId: string,
params?: TasksRunsArtifactsPreviewRetrieveParams,
options?: RequestInit
): Promise<TaskRunArtifactPreviewResponseApi> => {
return apiMutator<TaskRunArtifactPreviewResponseApi>(
getTasksRunsArtifactsPreviewRetrieveUrl(projectId, taskId, id, artifactId, params),
{
...options,
method: 'GET',
}
)
}
export const getTasksRunsArtifactsDismissCreateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/artifacts/dismiss/`
}
/**
* Hides artifacts from clients without deleting them from storage, so a file dismissed by mistake can be restored.
* @summary Dismiss or restore task run artifacts
*/
export const tasksRunsArtifactsDismissCreate = async (
projectId: string,
taskId: string,
id: string,
taskRunArtifactsDismissRequestApi: TaskRunArtifactsDismissRequestApi,
options?: RequestInit
): Promise<TaskRunArtifactsDismissResponseApi> => {
return apiMutator<TaskRunArtifactsDismissResponseApi>(
getTasksRunsArtifactsDismissCreateUrl(projectId, taskId, id),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskRunArtifactsDismissRequestApi),
}
)
}
export const getTasksRunsArtifactsDownloadCreateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/artifacts/download/`
}
/**
* Streams artifact content for a task run artifact after validating that it belongs to the run.
* @summary Download an artifact through the backend
*/
export const tasksRunsArtifactsDownloadCreate = async (
projectId: string,
taskId: string,
id: string,
taskRunArtifactPresignRequestApi: TaskRunArtifactPresignRequestApi,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getTasksRunsArtifactsDownloadCreateUrl(projectId, taskId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskRunArtifactPresignRequestApi),
})
}
export const getTasksRunsArtifactsFinalizeUploadCreateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/artifacts/finalize_upload/`
}
/**
* Verify directly uploaded S3 objects and attach them to the run artifact manifest.
* @summary Finalize direct uploads for task run artifacts
*/
export const tasksRunsArtifactsFinalizeUploadCreate = async (
projectId: string,
taskId: string,
id: string,
taskRunArtifactsFinalizeUploadRequestApi: TaskRunArtifactsFinalizeUploadRequestApi,
options?: RequestInit
): Promise<TaskRunArtifactsFinalizeUploadResponseApi> => {
return apiMutator<TaskRunArtifactsFinalizeUploadResponseApi>(
getTasksRunsArtifactsFinalizeUploadCreateUrl(projectId, taskId, id),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskRunArtifactsFinalizeUploadRequestApi),
}
)
}
export const getTasksRunsArtifactsPrepareUploadCreateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/artifacts/prepare_upload/`
}
/**
* Reserve S3 object keys for task artifacts and return presigned POST forms for direct uploads.
* @summary Prepare direct uploads for task run artifacts
*/
export const tasksRunsArtifactsPrepareUploadCreate = async (
projectId: string,
taskId: string,
id: string,
taskRunArtifactsPrepareUploadRequestApi: TaskRunArtifactsPrepareUploadRequestApi,
options?: RequestInit
): Promise<TaskRunArtifactsPrepareUploadResponseApi> => {
return apiMutator<TaskRunArtifactsPrepareUploadResponseApi>(
getTasksRunsArtifactsPrepareUploadCreateUrl(projectId, taskId, id),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskRunArtifactsPrepareUploadRequestApi),
}
)
}
export const getTasksRunsArtifactsPresignCreateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/artifacts/presign/`
}
/**
* Returns a temporary, signed URL that can be used to download a specific artifact.
* @summary Generate presigned URL for an artifact
*/
export const tasksRunsArtifactsPresignCreate = async (
projectId: string,
taskId: string,
id: string,
taskRunArtifactPresignRequestApi: TaskRunArtifactPresignRequestApi,
options?: RequestInit
): Promise<TaskRunArtifactPresignResponseApi> => {
return apiMutator<TaskRunArtifactPresignResponseApi>(getTasksRunsArtifactsPresignCreateUrl(projectId, taskId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskRunArtifactPresignRequestApi),
})
}
export const getTasksRunsArtifactsReferencesCreateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/artifacts/references/`
}
/**
* Attach live PostHog object references to the run artifact manifest without uploading files.
* @summary Register PostHog object references for a task run
*/
export const tasksRunsArtifactsReferencesCreate = async (
projectId: string,
taskId: string,
id: string,
taskRunPostHogReferencesRequestApi: TaskRunPostHogReferencesRequestApi,
options?: RequestInit
): Promise<TaskRunPostHogReferencesResponseApi> => {
return apiMutator<TaskRunPostHogReferencesResponseApi>(
getTasksRunsArtifactsReferencesCreateUrl(projectId, taskId, id),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskRunPostHogReferencesRequestApi),
}
)
}
export const getTasksRunsCancelCreateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/cancel/`
}
/**
* Stop an active cloud run. Interrupts the agent, snapshots interactive sessions for later resume, tears down the sandbox, and marks the run cancelled. Idempotent: cancelling a finished run returns it unchanged.
* @summary Cancel task run
*/
export const tasksRunsCancelCreate = async (
projectId: string,
taskId: string,
id: string,
taskRunCancelRequestApi?: TaskRunCancelRequestApi,
options?: RequestInit
): Promise<TaskRunDetailDTOApi> => {
return apiMutator<TaskRunDetailDTOApi>(getTasksRunsCancelCreateUrl(projectId, taskId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskRunCancelRequestApi),
})
}
export const getTasksRunsClearConversationCreateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/clear_conversation/`
}
/**
* Record a `/clear` boundary in a finished run's log so the next run in the chain starts with an empty conversation. Its artifacts and visible history are unaffected. Only for a finished run: an active one has an agent that owns the clear, so send `/clear` to it as an ordinary message instead.
* @summary Clear conversation history
*/
export const tasksRunsClearConversationCreate = async (
projectId: string,
taskId: string,
id: string,
options?: RequestInit
): Promise<TaskRunDetailDTOApi> => {
return apiMutator<TaskRunDetailDTOApi>(getTasksRunsClearConversationCreateUrl(projectId, taskId, id), {
...options,
method: 'POST',
})
}
export const getTasksRunsCommandCreateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/command/`
}
/**
* Queue user_message JSON-RPC commands through the task workflow and forward sandbox control commands to the agent server. Supports user_message, cancel, close, permission_response, set_config_option, mcp_response, side_question, native Pi RPC commands, and Pi queue operations. Retry loop: a 503 is transient (sandbox_not_ready means the command arrived before the live run's command channel came up; agent_session_not_ready means an approval was rejected before execution while the agent starts) — retry it until the request you are answering expires. A 502 (agent server unreachable) or 504 (agent server timed out) means delivery is unknown; retry only when the command method is safe to retry. A 409 run_ended is final: the run is over and its sandbox is gone. HTTP 200 preserves JSON-RPC errors; permission acceptance requires result.resolved=true.
* @summary Send command to task run
*/
export const tasksRunsCommandCreate = async (
projectId: string,
taskId: string,
id: string,
taskRunCommandRequestApi: TaskRunCommandRequestApi,
options?: RequestInit
): Promise<TaskRunCommandResponseApi> => {
return apiMutator<TaskRunCommandResponseApi>(getTasksRunsCommandCreateUrl(projectId, taskId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskRunCommandRequestApi),
})
}
export const getTasksRunsConnectionTokenRetrieveUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/connection_token/`
}
/**
* Generate a JWT token for direct connection to the sandbox. Valid for 24 hours.
* @summary Get sandbox connection token
*/
export const tasksRunsConnectionTokenRetrieve = async (
projectId: string,
taskId: string,
id: string,
options?: RequestInit
): Promise<ConnectionTokenResponseApi> => {
return apiMutator<ConnectionTokenResponseApi>(getTasksRunsConnectionTokenRetrieveUrl(projectId, taskId, id), {
...options,
method: 'GET',
})
}
export const getTasksRunsPreviewRetrieveUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/preview/`
}
/**
* Redirects to the PostHog dev stack running inside this run's sandbox. A fresh sandbox access token is minted on every request and carried only in the redirect target, so it is never persisted or returned in a response body. When the run has no preview, or its sandbox has stopped, this renders a short HTML page instead.
* @summary Open the dev stack preview for a task run
*/
export const tasksRunsPreviewRetrieve = async (
projectId: string,
taskId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getTasksRunsPreviewRetrieveUrl(projectId, taskId, id), {
...options,
method: 'GET',
})
}
export const getTasksRunsRelayMessageCreateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/relay_message/`
}
/**
* Queue a Slack relay workflow to post a run message into the mapped Slack thread.
* @summary Relay run message to Slack
*/
export const tasksRunsRelayMessageCreate = async (
projectId: string,
taskId: string,
id: string,
taskRunRelayMessageRequestApi: TaskRunRelayMessageRequestApi,
options?: RequestInit
): Promise<TaskRunRelayMessageResponseApi> => {
return apiMutator<TaskRunRelayMessageResponseApi>(getTasksRunsRelayMessageCreateUrl(projectId, taskId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskRunRelayMessageRequestApi),
})
}
export const getTasksRunsResumeInCloudCreateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/resume_in_cloud/`
}
/**
* Resume an existing task run in a cloud sandbox. Terminates any existing workflow and starts a new one.
* @summary Resume task run in cloud
*/
export const tasksRunsResumeInCloudCreate = async (
projectId: string,
taskId: string,
id: string,
options?: RequestInit
): Promise<TaskRunDetailDTOApi> => {
return apiMutator<TaskRunDetailDTOApi>(getTasksRunsResumeInCloudCreateUrl(projectId, taskId, id), {
...options,
method: 'POST',
})
}
export const getTasksRunsSessionLogsRetrieveUrl = (
projectId: string,
taskId: string,
id: string,
params?: TasksRunsSessionLogsRetrieveParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/session_logs/?${stringifiedParams}`
: `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/session_logs/`
}
/**
* Fetch session log entries for a task run with optional filtering by timestamp, event type, and limit.
* @summary Get filtered task run session logs
*/
export const tasksRunsSessionLogsRetrieve = async (
projectId: string,
taskId: string,
id: string,
params?: TasksRunsSessionLogsRetrieveParams,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getTasksRunsSessionLogsRetrieveUrl(projectId, taskId, id, params), {
...options,
method: 'GET',
})
}
export const getTasksRunsSetOutputPartialUpdateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/set_output/`
}
/**
* Update the output field for a task run (e.g., PR URL, commit SHA, etc.)
* @summary Set run output
*/
export const tasksRunsSetOutputPartialUpdate = async (
projectId: string,
taskId: string,
id: string,
patchedTaskRunSetOutputRequestApi?: PatchedTaskRunSetOutputRequestApi,
options?: RequestInit
): Promise<TaskRunDetailDTOApi> => {
return apiMutator<TaskRunDetailDTOApi>(getTasksRunsSetOutputPartialUpdateUrl(projectId, taskId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedTaskRunSetOutputRequestApi),
})
}
export const getTasksRunsSetSummaryPartialUpdateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/set_summary/`
}
/**
* Replace the running summary for a task run, and optionally its slug tags.
* @summary Set task run summary
*/
export const tasksRunsSetSummaryPartialUpdate = async (
projectId: string,
taskId: string,
id: string,
patchedTaskRunSetSummaryRequestApi?: PatchedTaskRunSetSummaryRequestApi,
options?: RequestInit
): Promise<TaskRunDetailDTOApi> => {
return apiMutator<TaskRunDetailDTOApi>(getTasksRunsSetSummaryPartialUpdateUrl(projectId, taskId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedTaskRunSetSummaryRequestApi),
})
}
export const getTasksRunsStartCreateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/start/`
}
/**
* Start an existing cloud run after any initial run-scoped attachments have been uploaded.
* @summary Start task run
*/
export const tasksRunsStartCreate = async (
projectId: string,
taskId: string,
id: string,
taskRunStartRequestApi?: TaskRunStartRequestApi,
options?: RequestInit
): Promise<TaskDetailDTOApi> => {
return apiMutator<TaskDetailDTOApi>(getTasksRunsStartCreateUrl(projectId, taskId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskRunStartRequestApi),
})
}
export const getTasksRunsStreamRetrieveUrl = (
projectId: string,
taskId: string,
id: string,
params?: TasksRunsStreamRetrieveParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/stream/?${stringifiedParams}`
: `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/stream/`
}
/**
* Server-Sent Events stream of task run events. Events carry an `id:` line (a Redis stream id, or a synthetic `log-<n>` id during backlog replay) usable as a resume cursor.
*
* The server caps each connection at 900 seconds: it emits `event: end` with `data: {"type": "rotated"}` and closes. This does NOT mean the run finished — reconnect with the `Last-Event-ID` header set to the last received event id to resume. Only treat the stream as complete when the run itself reaches a terminal status.
*
* Resume guarantees cover mirrored events only: on runs where live mirroring is presence-gated, events produced while no viewer was connected are not in the live stream. Reload the run's session logs to recover the agent's output; run-state and progress frames are not in those logs, so refetch the run itself for its current state.
*
* On runs with durable backlog serving, a connection without `Last-Event-ID` first replays history from the run log under synthetic `log-<n>` event ids, then attaches the live stream, skipping live entries the backlog already covered. Reconnecting with a `log-<n>` id resumes the backlog replay from that point; reconnecting with a Redis id resumes the live stream, may re-deliver a few events already served as backlog frames, and falls back to a full backlog replay when the resume point was trimmed or the stream expired. Runs whose log exceeds the backlog byte cap skip the replay and serve only the recent live window. When the backlog is temporarily unavailable (a storage read failure, or a worker at its concurrent replay budget), the stream emits an `event: error` frame and closes; reconnect with the same cursor to retry. Treat delivery as at-least-once across reconnects.
*
* `?start=latest` consumers must also carry `Last-Event-ID` across reconnects: reconnecting without it re-resolves to the then-current latest event, silently skipping anything published while disconnected.
*
* **SDK consumers**: do not call the generated fetch wrapper for this path — it will buffer the entire stream. Use the URL builder (`getTasksRunsStreamRetrieveUrl`) with a streaming `fetch`/`EventSource`-style consumer and the `Last-Event-ID` header instead.
*/
export const tasksRunsStreamRetrieve = async (
projectId: string,
taskId: string,
id: string,
params?: TasksRunsStreamRetrieveParams,
options?: RequestInit
): Promise<string> => {
return apiMutator<string>(getTasksRunsStreamRetrieveUrl(projectId, taskId, id, params), {
...options,
method: 'GET',
})
}
export const getTasksRunsStreamTokenRetrieveUrl = (
projectId: string,
taskId: string,
id: string,
params?: TasksRunsStreamTokenRetrieveParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/stream_token/?${stringifiedParams}`
: `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/stream_token/`
}
/**
* Generate a run-scoped JWT that authorizes reading this task run's live event stream via the agent-proxy. A run that keeps only a short live tail in Redis is routed to the proxy only when the client sets resync=true, meaning it rebuilds from the durable run log when the proxy reports a trimmed cursor.
* @summary Get task run stream read token
*/
export const tasksRunsStreamTokenRetrieve = async (
projectId: string,
taskId: string,
id: string,
params?: TasksRunsStreamTokenRetrieveParams,
options?: RequestInit
): Promise<StreamReadTokenResponseApi> => {
return apiMutator<StreamReadTokenResponseApi>(getTasksRunsStreamTokenRetrieveUrl(projectId, taskId, id, params), {
...options,
method: 'GET',
})
}
export const getTasksRunsSubscriptionTokenCreateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/subscription_token/`
}
/**
* Give the run's agent-server a short-lived ChatGPT access token from the run owner's connected account. Only the run's sandbox may call this, and it must present the run token it received at launch. Send the digest of a token Codex rejected so the server refreshes it early, once.
* @summary Issue a ChatGPT access token for a Codex run
*/
export const tasksRunsSubscriptionTokenCreate = async (
projectId: string,
taskId: string,
id: string,
taskRunSubscriptionTokenRequestApi?: TaskRunSubscriptionTokenRequestApi,
options?: RequestInit
): Promise<TaskRunSubscriptionTokenResponseApi> => {
return apiMutator<TaskRunSubscriptionTokenResponseApi>(
getTasksRunsSubscriptionTokenCreateUrl(projectId, taskId, id),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskRunSubscriptionTokenRequestApi),
}
)
}
export const getTasksRunsTaskSessionRetrieveUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/task_session/`
}
/**
* API for managing task runs. Each run represents an execution of a task.
* @summary Get active task session storage access
*/
export const tasksRunsTaskSessionRetrieve = async (
projectId: string,
taskId: string,
id: string,
options?: RequestInit
): Promise<TaskSessionResponseApi> => {
return apiMutator<TaskSessionResponseApi>(getTasksRunsTaskSessionRetrieveUrl(projectId, taskId, id), {
...options,
method: 'GET',
})
}
export const getTasksRunsTaskSessionSyncCreateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${id}/task_session_sync/`
}
/**
* API for managing task runs. Each run represents an execution of a task.
* @summary Replace the active native task session
*/
export const tasksRunsTaskSessionSyncCreate = async (
projectId: string,
taskId: string,
id: string,
tasksRunsTaskSessionSyncCreateBody?: Blob,
options?: RequestInit
): Promise<TaskSessionSyncResponseApi> => {
return apiMutator<TaskSessionSyncResponseApi>(getTasksRunsTaskSessionSyncCreateUrl(projectId, taskId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/octet-stream', ...options?.headers },
body: tasksRunsTaskSessionSyncCreateBody,
})
}
export const getTasksRunsLivingArtifactsListUrl = (projectId: string, taskId: string, runId: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${runId}/living_artifacts/`
}
/**
* Returns stable, versioned artifact handles created by the run's task.
* @summary List living artifacts for a task run
*/
export const tasksRunsLivingArtifactsList = async (
projectId: string,
taskId: string,
runId: string,
options?: RequestInit
): Promise<TaskRunLivingArtifactsResponseApi> => {
return apiMutator<TaskRunLivingArtifactsResponseApi>(getTasksRunsLivingArtifactsListUrl(projectId, taskId, runId), {
...options,
method: 'GET',
})
}
export const getTasksRunsLivingArtifactsCreateUrl = (projectId: string, taskId: string, runId: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${runId}/living_artifacts/`
}
/**
* Create a stable, editable artifact handle from direct markdown/text content or an existing run artifact. Slack adapters deliver into the mapped Slack thread; document artifacts use external connector storage when available.
* @summary Create a living artifact for a task run
*/
export const tasksRunsLivingArtifactsCreate = async (
projectId: string,
taskId: string,
runId: string,
taskRunLivingArtifactCreateRequestApi: TaskRunLivingArtifactCreateRequestApi,
options?: RequestInit
): Promise<TaskRunLivingArtifactResponseApi> => {
return apiMutator<TaskRunLivingArtifactResponseApi>(
getTasksRunsLivingArtifactsCreateUrl(projectId, taskId, runId),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskRunLivingArtifactCreateRequestApi),
}
)
}
export const getTasksRunsLivingArtifactsOpenUrl = (projectId: string, taskId: string, runId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${runId}/living_artifacts/${id}/`
}
/**
* Return a stable living artifact handle and the current content when the adapter supports reads.
* @summary Open a living artifact for a task run
*/
export const tasksRunsLivingArtifactsOpen = async (
projectId: string,
taskId: string,
runId: string,
id: string,
options?: RequestInit
): Promise<TaskRunLivingArtifactOpenResponseApi> => {
return apiMutator<TaskRunLivingArtifactOpenResponseApi>(
getTasksRunsLivingArtifactsOpenUrl(projectId, taskId, runId, id),
{
...options,
method: 'GET',
}
)
}
export const getTasksRunsLivingArtifactsEditUrl = (projectId: string, taskId: string, runId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${runId}/living_artifacts/${id}/edit/`
}
/**
* Commit a new version to an existing living artifact handle.
* @summary Edit a living artifact for a task run
*/
export const tasksRunsLivingArtifactsEdit = async (
projectId: string,
taskId: string,
runId: string,
id: string,
taskRunLivingArtifactEditRequestApi?: TaskRunLivingArtifactEditRequestApi,
options?: RequestInit
): Promise<TaskRunLivingArtifactResponseApi> => {
return apiMutator<TaskRunLivingArtifactResponseApi>(
getTasksRunsLivingArtifactsEditUrl(projectId, taskId, runId, id),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskRunLivingArtifactEditRequestApi),
}
)
}
export const getTasksRunsLivingArtifactsVersionContentUrl = (
projectId: string,
taskId: string,
runId: string,
id: string,
version: number,
params?: TasksRunsLivingArtifactsVersionContentParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/tasks/${taskId}/runs/${runId}/living_artifacts/${id}/versions/${version}/?${stringifiedParams}`
: `/api/projects/${projectId}/tasks/${taskId}/runs/${runId}/living_artifacts/${id}/versions/${version}/`
}
/**
* Returns the content of one living artifact version. Slack file versions return their stored file, streamed from the app origin for a preview or redirected to a presigned URL with download=true. Slack canvas and message versions return their text.
* @summary Download one version of a living artifact
*/
export const tasksRunsLivingArtifactsVersionContent = async (
projectId: string,
taskId: string,
runId: string,
id: string,
version: number,
params?: TasksRunsLivingArtifactsVersionContentParams,
options?: RequestInit
): Promise<Blob> => {
return apiMutator<Blob>(
getTasksRunsLivingArtifactsVersionContentUrl(projectId, taskId, runId, id, version, params),
{
...options,
method: 'GET',
}
)
}
export const getTasksRunsLivingArtifactsChartUrl = (projectId: string, taskId: string, runId: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/runs/${runId}/living_artifacts/chart/`
}
/**
* Renders a PostHog insight (ad-hoc query JSON or a saved insight) to a PNG server-side and registers it as a slack_file living artifact in one call. Blocks until the render finishes.
* @summary Render an insight chart and attach it as a living artifact
*/
export const tasksRunsLivingArtifactsChart = async (
projectId: string,
taskId: string,
runId: string,
taskRunLivingArtifactChartRequestApi: TaskRunLivingArtifactChartRequestApi,
options?: RequestInit
): Promise<TaskRunLivingArtifactChartResponseApi> => {
return apiMutator<TaskRunLivingArtifactChartResponseApi>(
getTasksRunsLivingArtifactsChartUrl(projectId, taskId, runId),
{
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskRunLivingArtifactChartRequestApi),
}
)
}
export const getTasksThreadMessagesListUrl = (
projectId: string,
taskId: string,
params?: TasksThreadMessagesListParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/tasks/${taskId}/thread_messages/?${stringifiedParams}`
: `/api/projects/${projectId}/tasks/${taskId}/thread_messages/`
}
/**
* The task's thread in chronological order.
* @summary List thread messages
*/
export const tasksThreadMessagesList = async (
projectId: string,
taskId: string,
params?: TasksThreadMessagesListParams,
options?: RequestInit
): Promise<PaginatedTaskThreadMessageDTOListApi> => {
return apiMutator<PaginatedTaskThreadMessageDTOListApi>(getTasksThreadMessagesListUrl(projectId, taskId, params), {
...options,
method: 'GET',
})
}
export const getTasksThreadMessagesCreateUrl = (projectId: string, taskId: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/thread_messages/`
}
/**
* API for a task's thread — the human-only side conversation around a task. Messages
* reach the agent only via the explicit send_to_agent action, gated to the task author.
* @summary Post a thread message
*/
export const tasksThreadMessagesCreate = async (
projectId: string,
taskId: string,
taskThreadMessageWriteApi: TaskThreadMessageWriteApi,
options?: RequestInit
): Promise<TaskThreadMessageDTOApi> => {
return apiMutator<TaskThreadMessageDTOApi>(getTasksThreadMessagesCreateUrl(projectId, taskId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskThreadMessageWriteApi),
})
}
export const getTasksThreadMessagesDestroyUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/thread_messages/${id}/`
}
/**
* API for a task's thread — the human-only side conversation around a task. Messages
* reach the agent only via the explicit send_to_agent action, gated to the task author.
* @summary Delete own thread message
*/
export const tasksThreadMessagesDestroy = async (
projectId: string,
taskId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getTasksThreadMessagesDestroyUrl(projectId, taskId, id), {
...options,
method: 'DELETE',
})
}
export const getTasksThreadMessagesSendToAgentCreateUrl = (projectId: string, taskId: string, id: string) => {
return `/api/projects/${projectId}/tasks/${taskId}/thread_messages/${id}/send_to_agent/`
}
/**
* Task author only: forwards the message into the task's latest live run.
* @summary Send a thread message to the agent
*/
export const tasksThreadMessagesSendToAgentCreate = async (
projectId: string,
taskId: string,
id: string,
taskThreadMessageDTOApi: TaskThreadMessageDTOApi,
options?: RequestInit
): Promise<TaskThreadMessageDTOApi> => {
return apiMutator<TaskThreadMessageDTOApi>(getTasksThreadMessagesSendToAgentCreateUrl(projectId, taskId, id), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskThreadMessageDTOApi),
})
}
export const getTasksMeConfigListUrl = (projectId: string) => {
return `/api/projects/${projectId}/tasks/@me/config/`
}
/**
* Retrieve your per-project default AI run preferences, plus the resolved defaults a new run will use when no explicit runtime selection is sent (your preference over the project default).
*/
export const tasksMeConfigList = async (
projectId: string,
options?: RequestInit
): Promise<TasksUserConfigResponseApi> => {
return apiMutator<TasksUserConfigResponseApi>(getTasksMeConfigListUrl(projectId), {
...options,
method: 'GET',
})
}
export const getTasksMeConfigCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/tasks/@me/config/`
}
/**
* Set your per-project default AI run preferences; they override the project default wholesale. Send all fields as null to clear and inherit the project default.
*/
export const tasksMeConfigCreate = async (
projectId: string,
tasksAIRunPreferencesApi?: TasksAIRunPreferencesApi,
options?: RequestInit
): Promise<TasksUserConfigResponseApi> => {
return apiMutator<TasksUserConfigResponseApi>(getTasksMeConfigCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(tasksAIRunPreferencesApi),
})
}
export const getTasksMeConfigAgentInstructionsCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/tasks/@me/config/agent_instructions/`
}
/**
* Set your personal instructions, which PostHog cloud agents load in Tasks runs you start, after the project instructions. Autonomous runs never get them. Anyone who continues a task you started can see them, so leave out anything private. Send an empty string to clear.
*/
export const tasksMeConfigAgentInstructionsCreate = async (
projectId: string,
tasksAgentInstructionsApi: TasksAgentInstructionsApi,
options?: RequestInit
): Promise<TasksAgentInstructionsApi> => {
return apiMutator<TasksAgentInstructionsApi>(getTasksMeConfigAgentInstructionsCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(tasksAgentInstructionsApi),
})
}
export const getTasksMeConfigTaskDefaultsCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/tasks/@me/config/task_defaults/`
}
/**
* Update your per-project defaults for new tasks. Fields you leave out keep their stored value.
*/
export const tasksMeConfigTaskDefaultsCreate = async (
projectId: string,
tasksTaskDefaultsUpdateApi?: TasksTaskDefaultsUpdateApi,
options?: RequestInit
): Promise<TasksTaskDefaultsApi> => {
return apiMutator<TasksTaskDefaultsApi>(getTasksMeConfigTaskDefaultsCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(tasksTaskDefaultsUpdateApi),
})
}
export const getTasksActiveWizardRunRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/tasks/active_wizard_run/`
}
/**
* Returns the most recent onboarding wizard cloud run for the current project when it is still running (or completed within the last day), so the setup-progress FAB can rehydrate after a drop-flow signup that started the run server-side. Returns 204 when there is none.
* @summary Get the team's active onboarding wizard cloud run
*/
export const tasksActiveWizardRunRetrieve = async (
projectId: string,
options?: RequestInit
): Promise<WizardCloudRunDTOApi | void> => {
return apiMutator<WizardCloudRunDTOApi | void>(getTasksActiveWizardRunRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}
export const getTasksConfigListUrl = (projectId: string, params?: TasksConfigListParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/tasks/config/?${stringifiedParams}`
: `/api/projects/${projectId}/tasks/config/`
}
/**
* Retrieve the project-wide default AI run preferences for task runs.
*/
export const tasksConfigList = async (
projectId: string,
params?: TasksConfigListParams,
options?: RequestInit
): Promise<TasksTeamConfigResponseApi> => {
return apiMutator<TasksTeamConfigResponseApi>(getTasksConfigListUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getTasksConfigCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/tasks/config/`
}
/**
* Set the project-wide default AI run preferences applied to task runs created without an explicit runtime selection. Send all fields as null to clear.
*/
export const tasksConfigCreate = async (
projectId: string,
tasksAIRunPreferencesApi?: TasksAIRunPreferencesApi,
options?: RequestInit
): Promise<TasksTeamConfigResponseApi> => {
return apiMutator<TasksTeamConfigResponseApi>(getTasksConfigCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(tasksAIRunPreferencesApi),
})
}
export const getTasksConfigAgentInstructionsCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/tasks/config/agent_instructions/`
}
/**
* Set the project instructions that PostHog cloud agents load as their user-level AGENTS.md in every eligible Tasks run, including autonomous runs. Send an empty string to clear.
*/
export const tasksConfigAgentInstructionsCreate = async (
projectId: string,
tasksAgentInstructionsApi: TasksAgentInstructionsApi,
options?: RequestInit
): Promise<TasksAgentInstructionsApi> => {
return apiMutator<TasksAgentInstructionsApi>(getTasksConfigAgentInstructionsCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(tasksAgentInstructionsApi),
})
}
export const getTasksModelsRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/tasks/models/`
}
/**
* Return the models a task run may use, with the reasoning efforts each one supports. Derived from the live LLM gateway catalogue, so a newly released model appears without a client change. An empty list means the gateway is unreachable — clients should fall back to their own default rather than treating it as 'no models exist'.
* @summary List available models
*/
export const tasksModelsRetrieve = async (
projectId: string,
options?: RequestInit
): Promise<ModelCatalogueResponseApi> => {
return apiMutator<ModelCatalogueResponseApi>(getTasksModelsRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}
export const getTasksPinnedRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/tasks/pinned/`
}
/**
* Return the visible tasks pinned by the requester in the current project.
* @summary List pinned tasks
*/
export const tasksPinnedRetrieve = async (
projectId: string,
options?: RequestInit
): Promise<PinnedTaskIdsResponseApi> => {
return apiMutator<PinnedTaskIdsResponseApi>(getTasksPinnedRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}
export const getTasksPullRequestTitlesCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/tasks/pull_request_titles/`
}
/**
* Returns the GitHub titles of the pull requests that the latest run of each task opened.
* @summary Fetch pull request titles for tasks
*/
export const tasksPullRequestTitlesCreate = async (
projectId: string,
taskPullRequestTitlesRequestApi: TaskPullRequestTitlesRequestApi,
options?: RequestInit
): Promise<TaskPullRequestTitlesApi> => {
return apiMutator<TaskPullRequestTitlesApi>(getTasksPullRequestTitlesCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskPullRequestTitlesRequestApi),
})
}
export const getTasksRepoRoutingRulesListUrl = (projectId: string) => {
return `/api/projects/${projectId}/tasks/repo_routing_rules/`
}
/**
* Team routing rules that steer agent repo selection (`RepoRoutingRule`).
*
* The same rows the Slack `/posthog rules` commands manage; the repo selection agent
* reads them ordered by priority when picking a repository for a task. Rules whose
* repository is not connected to the project are ignored at selection time, so a
* stale rule is inert rather than harmful — which is why writes here don't check the
* connected-repository list (the UI constrains the picker to connected repos anyway).
*/
export const tasksRepoRoutingRulesList = async (
projectId: string,
options?: RequestInit
): Promise<RepoRoutingRuleApi[]> => {
return apiMutator<RepoRoutingRuleApi[]>(getTasksRepoRoutingRulesListUrl(projectId), {
...options,
method: 'GET',
})
}
export const getTasksRepoRoutingRulesCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/tasks/repo_routing_rules/`
}
/**
* Team routing rules that steer agent repo selection (`RepoRoutingRule`).
*
* The same rows the Slack `/posthog rules` commands manage; the repo selection agent
* reads them ordered by priority when picking a repository for a task. Rules whose
* repository is not connected to the project are ignored at selection time, so a
* stale rule is inert rather than harmful — which is why writes here don't check the
* connected-repository list (the UI constrains the picker to connected repos anyway).
*/
export const tasksRepoRoutingRulesCreate = async (
projectId: string,
repoRoutingRuleApi: NonReadonly<RepoRoutingRuleApi>,
options?: RequestInit
): Promise<RepoRoutingRuleApi> => {
return apiMutator<RepoRoutingRuleApi>(getTasksRepoRoutingRulesCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(repoRoutingRuleApi),
})
}
export const getTasksRepoRoutingRulesRetrieveUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/tasks/repo_routing_rules/${id}/`
}
/**
* Team routing rules that steer agent repo selection (`RepoRoutingRule`).
*
* The same rows the Slack `/posthog rules` commands manage; the repo selection agent
* reads them ordered by priority when picking a repository for a task. Rules whose
* repository is not connected to the project are ignored at selection time, so a
* stale rule is inert rather than harmful — which is why writes here don't check the
* connected-repository list (the UI constrains the picker to connected repos anyway).
*/
export const tasksRepoRoutingRulesRetrieve = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<RepoRoutingRuleApi> => {
return apiMutator<RepoRoutingRuleApi>(getTasksRepoRoutingRulesRetrieveUrl(projectId, id), {
...options,
method: 'GET',
})
}
export const getTasksRepoRoutingRulesUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/tasks/repo_routing_rules/${id}/`
}
/**
* Team routing rules that steer agent repo selection (`RepoRoutingRule`).
*
* The same rows the Slack `/posthog rules` commands manage; the repo selection agent
* reads them ordered by priority when picking a repository for a task. Rules whose
* repository is not connected to the project are ignored at selection time, so a
* stale rule is inert rather than harmful — which is why writes here don't check the
* connected-repository list (the UI constrains the picker to connected repos anyway).
*/
export const tasksRepoRoutingRulesUpdate = async (
projectId: string,
id: string,
repoRoutingRuleApi: NonReadonly<RepoRoutingRuleApi>,
options?: RequestInit
): Promise<RepoRoutingRuleApi> => {
return apiMutator<RepoRoutingRuleApi>(getTasksRepoRoutingRulesUpdateUrl(projectId, id), {
...options,
method: 'PUT',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(repoRoutingRuleApi),
})
}
export const getTasksRepoRoutingRulesPartialUpdateUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/tasks/repo_routing_rules/${id}/`
}
/**
* Team routing rules that steer agent repo selection (`RepoRoutingRule`).
*
* The same rows the Slack `/posthog rules` commands manage; the repo selection agent
* reads them ordered by priority when picking a repository for a task. Rules whose
* repository is not connected to the project are ignored at selection time, so a
* stale rule is inert rather than harmful — which is why writes here don't check the
* connected-repository list (the UI constrains the picker to connected repos anyway).
*/
export const tasksRepoRoutingRulesPartialUpdate = async (
projectId: string,
id: string,
patchedRepoRoutingRuleApi?: NonReadonly<PatchedRepoRoutingRuleApi>,
options?: RequestInit
): Promise<RepoRoutingRuleApi> => {
return apiMutator<RepoRoutingRuleApi>(getTasksRepoRoutingRulesPartialUpdateUrl(projectId, id), {
...options,
method: 'PATCH',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(patchedRepoRoutingRuleApi),
})
}
export const getTasksRepoRoutingRulesDestroyUrl = (projectId: string, id: string) => {
return `/api/projects/${projectId}/tasks/repo_routing_rules/${id}/`
}
/**
* Team routing rules that steer agent repo selection (`RepoRoutingRule`).
*
* The same rows the Slack `/posthog rules` commands manage; the repo selection agent
* reads them ordered by priority when picking a repository for a task. Rules whose
* repository is not connected to the project are ignored at selection time, so a
* stale rule is inert rather than harmful — which is why writes here don't check the
* connected-repository list (the UI constrains the picker to connected repos anyway).
*/
export const tasksRepoRoutingRulesDestroy = async (
projectId: string,
id: string,
options?: RequestInit
): Promise<void> => {
return apiMutator<void>(getTasksRepoRoutingRulesDestroyUrl(projectId, id), {
...options,
method: 'DELETE',
})
}
export const getTasksRepositoriesRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/tasks/repositories/`
}
/**
* Return the set of repositories referenced by non-deleted, non-internal tasks in the current project. Used to populate repository filter pickers without being constrained by task list pagination.
* @summary List distinct task repositories
*/
export const tasksRepositoriesRetrieve = async (
projectId: string,
options?: RequestInit
): Promise<TaskRepositoriesResponseApi> => {
return apiMutator<TaskRepositoriesResponseApi>(getTasksRepositoriesRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}
export const getTasksRepositoryReadinessRetrieveUrl = (
projectId: string,
params: TasksRepositoryReadinessRetrieveParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/tasks/repository_readiness/?${stringifiedParams}`
: `/api/projects/${projectId}/tasks/repository_readiness/`
}
/**
* Get autonomy readiness details for a specific repository in the current project.
* @summary Get repository readiness
*/
export const tasksRepositoryReadinessRetrieve = async (
projectId: string,
params: TasksRepositoryReadinessRetrieveParams,
options?: RequestInit
): Promise<RepositoryReadinessResponseApi> => {
return apiMutator<RepositoryReadinessResponseApi>(getTasksRepositoryReadinessRetrieveUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getTasksSearchRetrieveUrl = (projectId: string, params: TasksSearchRetrieveParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/tasks/search/?${stringifiedParams}`
: `/api/projects/${projectId}/tasks/search/`
}
/**
* API for managing tasks within a project. Tasks represent units of work to be performed by an agent.
* @summary Search tasks, pull requests, artifacts, and spaces
*/
export const tasksSearchRetrieve = async (
projectId: string,
params: TasksSearchRetrieveParams,
options?: RequestInit
): Promise<TaskSearchResultApi[]> => {
return apiMutator<TaskSearchResultApi[]>(getTasksSearchRetrieveUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getTasksSlackThreadContextRetrieveUrl = (
projectId: string,
params: TasksSlackThreadContextRetrieveParams
) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/tasks/slack_thread_context/?${stringifiedParams}`
: `/api/projects/${projectId}/tasks/slack_thread_context/`
}
/**
* PostHog-internal debug tool. Resolves a Slack permalink to the linked task, its runs, the task-processing and mention-dispatch Temporal workflow ids/URLs, and presigned log URLs.
* @summary Resolve a Slack thread to its task, runs, and Temporal workflows
*/
export const tasksSlackThreadContextRetrieve = async (
projectId: string,
params: TasksSlackThreadContextRetrieveParams,
options?: RequestInit
): Promise<SlackThreadContextResponseApi> => {
return apiMutator<SlackThreadContextResponseApi>(getTasksSlackThreadContextRetrieveUrl(projectId, params), {
...options,
method: 'GET',
})
}
export const getTasksSourcesRetrieveUrl = (projectId: string) => {
return `/api/projects/${projectId}/tasks/sources/`
}
/**
* Return the distinct sources of the requester's own non-archived tasks, in the words of the task list `sources` filter. Used to populate a source filter picker without being constrained by task list pagination.
* @summary List task sources
*/
export const tasksSourcesRetrieve = async (
projectId: string,
options?: RequestInit
): Promise<TaskSourcesResponseApi> => {
return apiMutator<TaskSourcesResponseApi>(getTasksSourcesRetrieveUrl(projectId), {
...options,
method: 'GET',
})
}
export const getTasksSummariesCreateUrl = (projectId: string, params?: TasksSummariesCreateParams) => {
const normalizedParams = new URLSearchParams()
Object.entries(params || {}).forEach(([key, value]) => {
if (value !== undefined) {
normalizedParams.append(key, value === null ? 'null' : String(value))
}
})
const stringifiedParams = normalizedParams.toString()
return stringifiedParams.length > 0
? `/api/projects/${projectId}/tasks/summaries/?${stringifiedParams}`
: `/api/projects/${projectId}/tasks/summaries/`
}
/**
* Returns summary for the requested tasks, including the creator ID and the latest run's ID, status, and environment.
* @summary Fetch task summaries by ID
*/
export const tasksSummariesCreate = async (
projectId: string,
taskSummariesRequestApi: TaskSummariesRequestApi,
params?: TasksSummariesCreateParams,
options?: RequestInit
): Promise<PaginatedTaskSummaryDTOListApi> => {
return apiMutator<PaginatedTaskSummaryDTOListApi>(getTasksSummariesCreateUrl(projectId, params), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(taskSummariesRequestApi),
})
}
export const getTasksWarmCreateUrl = (projectId: string) => {
return `/api/projects/${projectId}/tasks/warm/`
}
/**
* Warm a full idling Run for a cloud task while the user composes: boot a sandbox, clone the repo, check out the branch, and start the agent, then idle awaiting the first message. On submit the normal create+run path transparently reuses and activates this Run; abandoned warms are reaped by the Run's inactivity timeout. Best-effort: returns an empty body when the feature flag is off, the warm pool is full, or the GitHub integration doesn't belong to the team.
* @summary Warm a task sandbox
*/
export const tasksWarmCreate = async (
projectId: string,
warmTaskRequestApi?: WarmTaskRequestApi,
options?: RequestInit
): Promise<WarmTaskResponseApi> => {
return apiMutator<WarmTaskResponseApi>(getTasksWarmCreateUrl(projectId), {
...options,
method: 'POST',
headers: { 'Content-Type': 'application/json', ...options?.headers },
body: JSON.stringify(warmTaskRequestApi),
})
}