Skip to content
← Public packages

@kody/kody-factory

Forkable multi-project software factory: signals, priority queue, project UI, sweep job. Agent runners and Sentry reach it by events.

FollowFork

Files

cole-orchestrator.ts

49 lines · 1.4 KB · TypeScript
/**
 * Cole-pattern orchestrator stub (plan + handoff).
 * Not a live runner. Live implementer work goes through `devin`.
 * Planning card writes stay on the planning adapter (storage stub unless github is wired).
 */
import type {
	AgentRunner,
	AgentStartResult,
	AgentStatusResult,
	AgentTask,
} from './types.ts'

const runs = new Map<string, { task: AgentTask; state: AgentStatusResult['state']; at: string }>()

export const coleOrchestrator: AgentRunner = {
	id: 'cole-orchestrator',
	displayName: 'Cole orchestrator stub (plan only, non-live)',
	capabilities: ['plan', 'review'],
	onComplete: { mode: 'poll', pollIntervalMs: 60_000 },

	async start(task: AgentTask): Promise<AgentStartResult> {
		const runId = `cole_stub_${crypto.randomUUID().replace(/-/g, '').slice(0, 12)}`
		const at = new Date().toISOString()
		runs.set(runId, {
			task,
			state: 'succeeded',
			at,
		})
		return { runId }
	},

	async status(runId: string): Promise<AgentStatusResult> {
		const row = runs.get(runId)
		if (!row) return { state: 'unknown', summary: 'cole stub run not found' }
		return {
			state: row.state,
			updatedAt: row.at,
			summary: `stub plan workItem=${row.task.workItemId} project=${row.task.projectId}`,
		}
	},

	async cancel(runId: string): Promise<void> {
		const row = runs.get(runId)
		if (row) {
			row.state = 'cancelled'
			row.at = new Date().toISOString()
		}
	},
}