feat(runtime): add local codex daemon pairing
This commit is contained in:
parent
c6960d39b9
commit
cdfa63af15
36 changed files with 2579 additions and 309 deletions
41
server/pkg/db/queries/runtime.sql
Normal file
41
server/pkg/db/queries/runtime.sql
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
-- name: ListAgentRuntimes :many
|
||||
SELECT * FROM agent_runtime
|
||||
WHERE workspace_id = $1
|
||||
ORDER BY created_at ASC;
|
||||
|
||||
-- name: GetAgentRuntime :one
|
||||
SELECT * FROM agent_runtime
|
||||
WHERE id = $1;
|
||||
|
||||
-- name: GetAgentRuntimeForWorkspace :one
|
||||
SELECT * FROM agent_runtime
|
||||
WHERE id = $1 AND workspace_id = $2;
|
||||
|
||||
-- name: UpsertAgentRuntime :one
|
||||
INSERT INTO agent_runtime (
|
||||
workspace_id,
|
||||
daemon_id,
|
||||
name,
|
||||
runtime_mode,
|
||||
provider,
|
||||
status,
|
||||
device_info,
|
||||
metadata,
|
||||
last_seen_at
|
||||
) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, now())
|
||||
ON CONFLICT (workspace_id, daemon_id, provider)
|
||||
DO UPDATE SET
|
||||
name = EXCLUDED.name,
|
||||
runtime_mode = EXCLUDED.runtime_mode,
|
||||
status = EXCLUDED.status,
|
||||
device_info = EXCLUDED.device_info,
|
||||
metadata = EXCLUDED.metadata,
|
||||
last_seen_at = now(),
|
||||
updated_at = now()
|
||||
RETURNING *;
|
||||
|
||||
-- name: UpdateAgentRuntimeHeartbeat :one
|
||||
UPDATE agent_runtime
|
||||
SET status = 'online', last_seen_at = now(), updated_at = now()
|
||||
WHERE id = $1
|
||||
RETURNING *;
|
||||
Loading…
Add table
Add a link
Reference in a new issue