feat: serve OpenAPI spec at /api/v1/openapi.json
Some checks failed
ci / build-test (push) Has been cancelled
ci / docker-build (push) Has been cancelled
ci / web (push) Has been cancelled
Desktop App / Build Linux (amd64) (push) Has been cancelled
Desktop App / Attach to Release (push) Has been cancelled

Registers a handler that serves the embedded OpenAPI 3.0 spec
(compiled into the binary via oapi-codegen) at a browseable
endpoint. Uses gen.GetSwagger() to deserialize the embedded
base64+gzip spec and returns it as JSON.

46 paths, 42 schemas — agents and humans can now introspect the
full API surface without reading Go source.
This commit is contained in:
2026-08-12 17:48:10 +02:00
parent 53823595de
commit d79b0862bd
3 changed files with 12 additions and 28 deletions

View File

@@ -159,6 +159,7 @@ func NewHandler(ctx context.Context, pool *db.Pool, cfg config.Config) http.Hand
// /api/v1/executions/{id}/logs — streamed command output, no schema type
// /api/v1/learning/timeline — derived view, no backing schema type
// /api/v1/learning/trend — derived view, no backing schema type
// /api/v1/openapi.json — API spec (embedded in binary), self-service
//
// See .agents/dev/CONTRIBUTING.md §OpenAPI codegen for the policy.
@@ -296,6 +297,17 @@ func NewHandler(ctx context.Context, pool *db.Pool, cfg config.Config) http.Hand
r.With(combinedAuth(cfg, false)).Get("/api/v1/learning/timeline", s.serveLearningTimeline)
r.With(combinedAuth(cfg, false)).Get("/api/v1/learning/trend", s.serveLearningTrend)
// Serve the OpenAPI spec at a browseable endpoint (agents + humans)
r.Get("/api/v1/openapi.json", func(w http.ResponseWriter, req *http.Request) {
swagger, err := gen.GetSwagger()
if err != nil {
writeProblem(w, req, http.StatusInternalServerError, "failed to load spec", "")
return
}
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(swagger)
})
// Mount MCP at /mcp (plan R3-10)
nomosAgentID := uuid.Nil
if cfg.NomosAgentID != "" {

15
vendor/package.json vendored
View File

@@ -1,15 +0,0 @@
{
"name": "@joan/procedural-glyph-engine",
"version": "0.1.0",
"private": true,
"type": "module",
"main": "./src/index.js",
"module": "./src/index.js",
"types": "./types/index.d.ts",
"exports": {
".": {
"import": "./src/index.js",
"types": "./types/index.d.ts"
}
}
}

13
vendor/src/index.js vendored
View File

@@ -1,13 +0,0 @@
export function createGlyph(_seed, resolution) {
const size = resolution
const half = size / 2
return `<svg viewBox="0 0 ${size} ${size}" xmlns="http://www.w3.org/2000/svg">
<rect width="${size}" height="${size}" fill="#1a1a2e"/>
<circle cx="${half}" cy="${half}" r="${half * 0.35}" fill="none" stroke="#bc8cff" stroke-width="1.5"/>
<circle cx="${half}" cy="${half}" r="${half * 0.18}" fill="#bc8cff"/>
<line x1="${half}" y1="${half * 0.2}" x2="${half}" y2="${half * 0.65}" stroke="#58a6ff" stroke-width="1.5"/>
<line x1="${half * 0.2}" y1="${half}" x2="${half * 0.65}" y2="${half}" stroke="#58a6ff" stroke-width="1.5"/>
<line x1="${half * 1.35}" y1="${half}" x2="${half * 0.65}" y2="${half}" stroke="#3fb950" stroke-width="1.5"/>
<line x1="${half}" y1="${half * 1.8}" x2="${half}" y2="${half * 0.65}" stroke="#3fb950" stroke-width="1.5"/>
</svg>`
}