Skip to content
← Public packages

@kentcdodds/sentry-triage

Sentry triage wakes Cole (Grok Bot) per issue: one active wake per repo (lease + queue), loop-safe Discord. Cole may spawn Cursor for isolated repo work.

src/get-issue-state.d.ts

44 lines · 1.1 KB · TypeScript
export type TriageIssueRecord = {
	issueId?: string
	projectSlug?: string
	shortId?: string | null
	title?: string
	link?: string
	status?: string
	summary?: string
	prUrl?: string | null
	agentId?: string
	agentUrl?: string | null
	discordMessageId?: string
	seenAt?: string
	spawnedAt?: string
	completedAt?: string
	hourBucket?: string
	backfill?: boolean
	[key: string]: unknown
}

export type GetIssueStateInput = {
	/** Sentry issue id (numeric string). */
	issueId: string
}

export type GetIssueStateResult = {
	record: TriageIssueRecord | null
	spawnedThisHour: number
	issuesSeenThisHour: number
	capRemaining: number
}

/**
 * Loop-guard lookup for triage agents: prior state for one issue plus current
 * hourly counters. Invoked cross-package via a static `kody:@kentcdodds/sentry-triage` import.
 *
 * @example
 * import getIssueState from 'kody:@kentcdodds/sentry-triage/get-issue-state'
 * const state = await getIssueState({ issueId: '12345' })
 * // => { record, spawnedThisHour, issuesSeenThisHour, capRemaining }
 */
export default function getIssueState(
	input: GetIssueStateInput,
): Promise<GetIssueStateResult>