feat(gpu): GPU agent admin card — token, queue, backfill (#114)
The FC-side control surface the operator asked for: Settings → Tagging → "GPU agent". Generate/reveal/copy/rotate the agent bearer token (with the FC URL to point the agent at), see the live job-queue depth (pending/in-flight/done/ errored, polled), and a "Queue character embedding (CCIP)" button that triggers the library backfill. Plain-HTTP-safe copy (copyText resolves on success, throws on fail). Closes the "how do I get the token in the UI" gap. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ttrj5P7upUTueSfoJcxEqa
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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: <string|null>, 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 }
|
||||
})
|
||||
Reference in New Issue
Block a user