Feature 09: AI harness and skills framework (#62)
Co-authored-by: dev_agent <dev_agent@cubecraftlabs.com>
This commit was merged in pull request #62.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
-- name: CreateAIRun :exec
|
||||
INSERT INTO ai_runs (
|
||||
id, skill, skill_version, provider, model, temperature, status,
|
||||
latency_ms, tokens_in, tokens_out, error, request_redacted,
|
||||
response_redacted, created_at, updated_at
|
||||
) VALUES (
|
||||
?, ?, ?, ?, ?, ?, ?,
|
||||
?, ?, ?, ?, ?,
|
||||
?, ?, ?
|
||||
);
|
||||
|
||||
-- name: ClearSuggestionBatchAIRunsBefore :execrows
|
||||
-- Drops references to the runs created before the cutoff, so the purge
|
||||
-- can delete them.
|
||||
UPDATE suggestion_batches
|
||||
SET ai_run_id = NULL
|
||||
WHERE ai_run_id IN (SELECT ai_runs.id FROM ai_runs WHERE ai_runs.created_at < sqlc.arg(cutoff));
|
||||
|
||||
-- name: ClearWeekPlanAIRunsBefore :execrows
|
||||
-- Drops references to the runs created before the cutoff, so the purge
|
||||
-- can delete them.
|
||||
UPDATE week_plans
|
||||
SET ai_run_id = NULL
|
||||
WHERE ai_run_id IN (SELECT ai_runs.id FROM ai_runs WHERE ai_runs.created_at < sqlc.arg(cutoff));
|
||||
|
||||
-- name: DeleteAIRunsBefore :execrows
|
||||
DELETE FROM ai_runs
|
||||
WHERE created_at < sqlc.arg(cutoff);
|
||||
@@ -0,0 +1,19 @@
|
||||
-- Reads for the AI household context block (internal/ai/harness).
|
||||
|
||||
-- name: ListRecentDeclinedNames :many
|
||||
-- The names of the most recently declined suggestions, newest first.
|
||||
SELECT dinners.name
|
||||
FROM suggestions
|
||||
JOIN dinners ON dinners.id = suggestions.dinner_id
|
||||
WHERE suggestions.status = 'declined'
|
||||
ORDER BY suggestions.decided_at DESC, suggestions.id DESC
|
||||
LIMIT ?;
|
||||
|
||||
-- name: ListPlannedDinners :many
|
||||
-- The planned dinners dated from from_date up to but not including
|
||||
-- to_date, oldest first. Days with no dinner are left out.
|
||||
SELECT plan_days.date, dinners.name
|
||||
FROM plan_days
|
||||
JOIN dinners ON dinners.id = plan_days.dinner_id
|
||||
WHERE plan_days.date >= sqlc.arg(from_date) AND plan_days.date < sqlc.arg(to_date)
|
||||
ORDER BY plan_days.date, plan_days.id;
|
||||
Reference in New Issue
Block a user