Files
agentic-coding-workflow/internal/acp/queries/agent_kinds.sql
T
2026-06-22 08:55:57 +08:00

65 lines
2.9 KiB
SQL

-- name: CreateAgentKind :one
INSERT INTO acp_agent_kinds (
id, name, display_name, description, binary_path, args, encrypted_env, enabled, created_by, tool_allowlist, client_type, encrypted_mcp_servers,
model_id, max_cost_usd, max_tokens, max_wall_clock_seconds
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)
RETURNING id, name, display_name, description, binary_path, args, encrypted_env,
enabled, created_by, created_at, updated_at, tool_allowlist, client_type, encrypted_mcp_servers,
model_id, max_cost_usd, max_tokens, max_wall_clock_seconds, key_version;
-- name: GetAgentKindByID :one
SELECT id, name, display_name, description, binary_path, args, encrypted_env,
enabled, created_by, created_at, updated_at, tool_allowlist, client_type, encrypted_mcp_servers,
model_id, max_cost_usd, max_tokens, max_wall_clock_seconds, key_version
FROM acp_agent_kinds
WHERE id = $1;
-- name: GetAgentKindByName :one
SELECT id, name, display_name, description, binary_path, args, encrypted_env,
enabled, created_by, created_at, updated_at, tool_allowlist, client_type, encrypted_mcp_servers,
model_id, max_cost_usd, max_tokens, max_wall_clock_seconds, key_version
FROM acp_agent_kinds
WHERE name = $1;
-- name: ListAgentKinds :many
SELECT id, name, display_name, description, binary_path, args, encrypted_env,
enabled, created_by, created_at, updated_at, tool_allowlist, client_type, encrypted_mcp_servers,
model_id, max_cost_usd, max_tokens, max_wall_clock_seconds, key_version
FROM acp_agent_kinds
ORDER BY created_at DESC;
-- name: ListEnabledAgentKinds :many
SELECT id, name, display_name, description, binary_path, args, encrypted_env,
enabled, created_by, created_at, updated_at, tool_allowlist, client_type, encrypted_mcp_servers,
model_id, max_cost_usd, max_tokens, max_wall_clock_seconds, key_version
FROM acp_agent_kinds
WHERE enabled = TRUE
ORDER BY name ASC;
-- name: UpdateAgentKind :one
UPDATE acp_agent_kinds
SET display_name = $2,
description = $3,
binary_path = $4,
args = $5,
encrypted_env = $6,
enabled = $7,
tool_allowlist = $8,
client_type = $9,
encrypted_mcp_servers = $10,
model_id = $11,
max_cost_usd = $12,
max_tokens = $13,
max_wall_clock_seconds = $14,
updated_at = now()
WHERE id = $1
RETURNING id, name, display_name, description, binary_path, args, encrypted_env,
enabled, created_by, created_at, updated_at, tool_allowlist, client_type, encrypted_mcp_servers,
model_id, max_cost_usd, max_tokens, max_wall_clock_seconds, key_version;
-- name: DeleteAgentKind :exec
DELETE FROM acp_agent_kinds WHERE id = $1;
-- name: CountAgentKindUsage :one
SELECT COUNT(*) FROM acp_sessions WHERE agent_kind_id = $1;