import { defineStore } from 'pinia' import { useApi } from '../composables/useApi.js' // GPU agent control surface (#114): the FC-side admin for the desktop agent — // the bearer token it authenticates with, the job-queue depth, and the backfill // trigger. The agent itself talks to /api/gpu/jobs/* over HTTP; nothing here // touches Redis/Postgres directly. export const useGpuStore = defineStore('gpu', () => { const api = useApi() // { token: , configured: bool } async function token() { return await api.get('/api/gpu/token') } // Generate a fresh token (invalidates the old one). Returns { token }. async function rotateToken() { return await api.post('/api/gpu/token/rotate') } // { pending, leased, done, error } async function status() { return await api.get('/api/gpu/status') } // Enqueue a job per image lacking one for `task` (the agent drains it). async function backfill(task = 'ccip') { return await api.post('/api/gpu/backfill', { body: { task } }) } return { token, rotateToken, status, backfill } })