-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Labels
Description
Wanted to open discussion here around a monitoring server. Idea for an API:
const ow = new OpenWorkflow({ backend })
ow.serve({
port: 4594,
// host, etc
})Sketch of an HTTP server with Hono:
import { Hono } from 'hono'
const app = new Hono()
app.get('/api/metrics', (c) => {
return this.backend.getWorkflowMetrics(params: GetWorkflowMetricsParams)
})
app.get('/api/workflows', (c) => {
return this.registeredWorkflows
})
app.get('/api/workflows/runs', (c) => {
return this.backend.listWorkflowRuns(params: ListWorkflowRunsParams)
})
app.get('/api/workflows/runs/:id', (c) => {
return this.backend.getWorkflowRun(params: GetWorkflowRunParams)
})
// Serve SPA frontend built with vite
app.use('/*', serveStatic({ root: './dist/public' }))
app.get('*', serveStatic({ path: '/index.html', root: './dist/public' }))Adds listWorkflowRuns() and getWorkflowMetrics() to the backend interface. Probably want to explore adding listWorkflows() and getWorkflow() as well (registeredWorkflows is stored in memory rather than persisted to the backend).
Could interface with a future CLI rather than spawning from JS:
$ ow serve --port 4594