feat: scoped Agent API + scheduled-jobs registry (Brokk→Heimdall)#10
Open
valvesss wants to merge 2 commits into
Open
feat: scoped Agent API + scheduled-jobs registry (Brokk→Heimdall)#10valvesss wants to merge 2 commits into
valvesss wants to merge 2 commits into
Conversation
Add a scoped Agent API so external agents (Brokk/Sindri) can drive allow-listed
control-plane actions — set env, redeploy, register route, register job — with a
dedicated HEIMDALL_AGENT_TOKEN instead of the internal god-token. Web proxies
under /api/agent/* resolve an app name to its Coolify ref and forward via the SDK;
job registration also writes the per-app JOBS_SHARED_SECRET into the app env.
Add a scheduled-jobs registry mirroring routing: scheduled_jobs table +
JobsProvider + /jobs routes (CRUD + render + status) + SDK methods. The reconciler
endpoints /api/jobs/{render,status} reuse ROUTING_AGENT_TOKEN (the host principal),
keeping per-job secrets off the agent token.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A safe, scoped way for external agents (Brokk/Sindri) to drive control-plane actions, plus a fleet scheduled-jobs primitive.
Scoped Agent API —
/api/agent/*, gated by a newHEIMDALL_AGENT_TOKEN:env— set an app env var (→ Rúnar/Coolify)redeploy— trigger a redeployroutes— register a custom Traefik routejobs— register a scheduled job (also writes the per-appJOBS_SHARED_SECRET)Each proxy resolves an app name → Coolify ref via the registry and forwards through the SDK with the internal token — which never leaves the server. The all-powerful internal token is never handed to agents.
Scheduled-jobs registry (mirrors the routing module):
scheduled_jobstable +JobsProvider+/jobsroutes (CRUD +/render+/status) + SDK methods./api/jobs/{render,status}reuseROUTING_AGENT_TOKEN(the host reconciler principal), keeping per-job secrets off the agent token.Why
So the fleet can be developed through Brokk (set env, register jobs, routes) without SSH / manual control-plane access — the "expose our internal APIs to Brokk" seam, done with a scoped token per the ADR-0007 blast-radius doctrine.
Design decisions
JOBS_SHARED_SECRET: agents register jobs but never read secrets (those sit behind the reconciler's token).Companion PRs
feat/sindri-infra-intents— the four Sindri tools.feat/jobs-route— the app-side/api/jobs/[name]route.Testing
core/db/sdk/apitypecheck clean; new web routes typecheck clean.Deploy
Set
HEIMDALL_AGENT_TOKEN(web env) + optionalAGENT_JOBS_NODE(defaultymir). Host reconciler install:~/ccl-jobs/deploy/INSTALL.md.main'sapps/webtypecheck is already red (lib/gjallarhorn.ts→ missing./deployments-hub), unrelated to this PR.🤖 Generated with Claude Code