Add typed Poimen REST endpoints (/v1/poimen/*) #32

Closed
opened 2026-09-26 09:47:37 +00:00 by rock · 0 comments
Owner

Description

Add Poimen-specific REST endpoints to the API gateway. The generic /workflow action dispatch works but is untyped and clunky for frontend consumption.

New Endpoints

POST /v1/poimen/plan                       — call PlannerActivity, return DAG
POST /v1/poimen/execute                    — start DAGWorkflow with DAG input
GET  /v1/poimen/executions                 — list Poimen workflow executions
GET  /v1/poimen/executions/:id             — describe execution + status
GET  /v1/poimen/executions/:id/history     — get activity event history
POST /v1/poimen/executions/:id/signal      — signal (pause/resume/cancel)
DELETE /v1/poimen/executions/:id           — terminate workflow

Request/Response Contracts

POST /v1/poimen/plan

// Request
{"message": "scan repo for vulnerabilities and deploy if clean", "context": {"repo": "https://github.com/...", "branch": "main"}}
// Response
{"dag": {"nodes": [{"id": "clone", "activity": "CloneRepoActivity", "params": {}}], "edges": [{"source": "clone", "target": "scan"}]}, "name": "security-scan-deploy"}

POST /v1/poimen/execute

// Request
{"dag": {}, "namespace": "default", "task_queue": "poimen-worker"}
// Response
{"workflow_id": "dag-abc123", "run_id": "run_xyz", "started_at": "2025-01-01T00:00:00Z"}

Implementation Notes

  • All endpoints require Authorization: Bearer <JWT> (Authentik)
  • Extract sub from JWT as tenant/user ID
  • /plan calls PlannerActivity directly (not via Temporal) for low latency
  • /execute starts DAGWorkflow via Temporal gRPC
  • Filter executions by user (sub claim) for tenant isolation

Dependencies

  • poimen-workflows: PlannerActivity (B1) for /plan
  • poimen-workflows: DAGWorkflow (B2) for /execute
## Description Add Poimen-specific REST endpoints to the API gateway. The generic `/workflow` action dispatch works but is untyped and clunky for frontend consumption. ## New Endpoints ``` POST /v1/poimen/plan — call PlannerActivity, return DAG POST /v1/poimen/execute — start DAGWorkflow with DAG input GET /v1/poimen/executions — list Poimen workflow executions GET /v1/poimen/executions/:id — describe execution + status GET /v1/poimen/executions/:id/history — get activity event history POST /v1/poimen/executions/:id/signal — signal (pause/resume/cancel) DELETE /v1/poimen/executions/:id — terminate workflow ``` ## Request/Response Contracts ### POST /v1/poimen/plan ```json // Request {"message": "scan repo for vulnerabilities and deploy if clean", "context": {"repo": "https://github.com/...", "branch": "main"}} // Response {"dag": {"nodes": [{"id": "clone", "activity": "CloneRepoActivity", "params": {}}], "edges": [{"source": "clone", "target": "scan"}]}, "name": "security-scan-deploy"} ``` ### POST /v1/poimen/execute ```json // Request {"dag": {}, "namespace": "default", "task_queue": "poimen-worker"} // Response {"workflow_id": "dag-abc123", "run_id": "run_xyz", "started_at": "2025-01-01T00:00:00Z"} ``` ## Implementation Notes - All endpoints require `Authorization: Bearer <JWT>` (Authentik) - Extract `sub` from JWT as tenant/user ID - `/plan` calls PlannerActivity directly (not via Temporal) for low latency - `/execute` starts `DAGWorkflow` via Temporal gRPC - Filter executions by user (`sub` claim) for tenant isolation ## Dependencies - poimen-workflows: PlannerActivity (B1) for `/plan` - poimen-workflows: DAGWorkflow (B2) for `/execute`
rock closed this issue 2026-09-26 10:52:09 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: riotpiao-poimen/homelab-frontend#32