paqad-ai
Version:
Spec-driven development framework — AI agents that think before they type
83 lines (79 loc) • 3.08 kB
TypeScript
declare function estimateTokens(text: string | null | undefined): number;
interface HighTableStopPayload {
agent_id?: unknown;
agent_type?: unknown;
agent_transcript_path?: unknown;
session_id?: unknown;
}
interface RecordHighTableUsageInput {
projectRoot: string;
payload: HighTableStopPayload;
now?: () => Date;
}
type HighTableUsageOutcome = 'recorded' | 'not-high-table' | 'no-transcript' | 'no-usage' | 'no-role' | 'no-feature';
declare function recordHighTableUsage(input: RecordHighTableUsageInput): HighTableUsageOutcome;
declare function stageFromAgentType(agentType: string | null | undefined): string | null;
interface SubagentStopPayload {
agent_id?: unknown;
agent_type?: unknown;
session_id?: unknown;
agent_transcript_path?: unknown;
last_assistant_message?: unknown;
usage?: {
input_tokens?: unknown;
output_tokens?: unknown;
cache_read_input_tokens?: unknown;
cached_input_tokens?: unknown;
} | null;
}
interface TokenCounts {
tokens_input: number;
tokens_cached: number;
tokens_output: number;
exact: boolean;
}
declare function resolveTokenCounts(payload: SubagentStopPayload, transcriptText: string): TokenCounts;
interface StageAgentTokens {
tokens_used: number;
tokens_not_recarried: number;
exact: boolean;
}
declare function resolveStageAgentTokens(payload: SubagentStopPayload, transcriptText: string): StageAgentTokens;
interface RecordStageAgentCompletionInput {
projectRoot: string;
payload: SubagentStopPayload;
transcriptText: string;
adapter: string;
now?: () => Date;
log?: (line: string) => void;
}
declare function stagesRunByAgent(projectRoot: string, dirName: string, stage: string, payload: SubagentStopPayload): string[];
interface StageAgentJudgement {
report_status?: string;
report_stated?: boolean;
advance?: boolean;
decision?: string | null;
report_source?: string;
report_hash?: string;
stated_status?: string;
reason?: string;
gate_checked?: boolean;
api_turns?: number;
must_not?: string[];
}
interface JudgeStageAgentReturnInput {
projectRoot: string;
dirName: string;
adapter: string;
fallbackTranscript?: string;
}
declare function judgeStageAgentReturn(stage: string, payload: SubagentStopPayload, context: JudgeStageAgentReturnInput): StageAgentJudgement;
interface RecordStageAgentStartInput {
projectRoot: string;
payload: SubagentStopPayload;
now?: () => Date;
}
declare function recordStageAgentStart(input: RecordStageAgentStartInput): boolean;
declare function recordStageAgentCompletion(input: RecordStageAgentCompletionInput): boolean;
export { estimateTokens, judgeStageAgentReturn, recordHighTableUsage, recordStageAgentCompletion, recordStageAgentStart, resolveStageAgentTokens, resolveTokenCounts, stageFromAgentType, stagesRunByAgent };
export type { JudgeStageAgentReturnInput, RecordStageAgentCompletionInput, RecordStageAgentStartInput, StageAgentJudgement, StageAgentTokens, SubagentStopPayload };