import { type Static, Type } from "typebox"; /** * One skill that was previously retrieved (T08) and is now being evaluated * for actual usage. `workflowSteps` is the list of declared step / tool / * action names the skill's SKILL.md (or workflow doc) advertises — these * are what we diff the trajectory against. * * Step matching is case-insensitive substring: a tool call's `name` matches * a workflow step if the step (after lowercasing + whitespace collapse) * appears anywhere in the tool call's name. This is intentionally permissive * — declared steps are human-authored phrases ("store-cli query"), and tool * call names may be qualified (`mcp__store__store-cli-query`). Misses bias * toward `used: false`, which is the safer of the two error modes for a * curation signal. */ export declare const RetrievedSkillForTrackingSchema: Type.TObject<{ skillId: Type.TString; name: Type.TString; workflowSteps: Type.TArray; }>; export type RetrievedSkillForTracking = Static; /** One observed tool invocation in the task's trajectory. */ export declare const ToolCallObservationSchema: Type.TObject<{ name: Type.TString; }>; export type ToolCallObservation = Static; /** * The observable trajectory of a closed task: the sequence of tool calls * the agent made, plus the concatenated reasoning / assistant text the * orchestrator captured. Both inputs are supplied by the caller — this * module does not read transcripts itself. */ export declare const TaskTrajectorySchema: Type.TObject<{ toolCalls: Type.TArray>; reasoningText: Type.TString; }>; export type TaskTrajectory = Static; /** * Runtime attribution supplied by the caller (orchestrator). * These are NEVER fabricated inside the tracker (IL10). */ export declare const EmitRuntimeSchema: Type.TObject<{ storeCli: Type.TString; cwd: Type.TString; sprintId: Type.TString; taskId: Type.TString; role: Type.TString; action: Type.TString; phase: Type.TOptional; iteration: Type.TOptional; startTimestamp: Type.TString; endTimestamp: Type.TString; durationMinutes: Type.TNumber; model: Type.TString; provider: Type.TString; }>; export type EmitRuntime = Static; export interface EmitResult { emitted: number; failed: number; stderrs: string[]; } /** Why the classifier ruled `used: true`, or `"none"` when it ruled false. */ export type UsageSignal = "overlap" | "reasoning" | "none"; export interface UsageVerdict { used: boolean; signal: UsageSignal; tool_call_success_rate: number; } /** * Apply the FORGE-S24-T09 heuristic to a single retrieved skill against * the observed task trajectory. Pure function — no IO, no allocation * beyond return value. */ export declare function classifySkillUsage(skill: RetrievedSkillForTracking, trajectory: TaskTrajectory): UsageVerdict; /** * Emit one `skill_usage` tracking event per retrieved skill via * `node emit `. Each event carries the * classifier's `used` verdict and the observed `tool_call_success_rate`. * * `retrieval_score` is set to 0 — at tracking time, the score has already * been emitted in the T08 retrieval event; this follow-up captures the * usage signal only. (The schema requires the field to be present; it does * not require it to be re-derived per emission.) * * Never throws on subprocess failure — the failure is surfaced via the * returned counter and stderr text (IL7, explicit not silent). */ export declare function emitSkillUsageTrackingEvents(retrieved: readonly RetrievedSkillForTracking[], trajectory: TaskTrajectory, runtime: EmitRuntime): EmitResult;