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/issue-state.ts

20 lines · 656 B · TypeScript
import { maxAgentsPerHour } from './shared.ts'
import type { GetIssueStateResult } from './types.ts'

export function emptyIssueState(): GetIssueStateResult {
	return {
		record: null,
		spawnedThisHour: 0,
		issuesSeenThisHour: 0,
		capRemaining: maxAgentsPerHour,
	}
}

export function formatIssueStateForPrompt(state: GetIssueStateResult) {
	return [
		`- capRemaining: ${state.capRemaining} (${state.spawnedThisHour} woken this hour)`,
		`- issuesSeenThisHour: ${state.issuesSeenThisHour}`,
		`- stored record status: ${state.record?.status ?? 'none'}`,
		`- stored owner: ${state.record?.agentUrl ?? state.record?.agentId ?? 'none'}`,
	].join('\n')
}