Skip to content

docs(openapi): cover the full HTTP API surface#1171

Open
aaron-tsar wants to merge 2 commits into
nextlevelbuilder:devfrom
aaron-tsar:docs/openapi-add-vault-endpoints
Open

docs(openapi): cover the full HTTP API surface#1171
aaron-tsar wants to merge 2 commits into
nextlevelbuilder:devfrom
aaron-tsar:docs/openapi-add-vault-endpoints

Conversation

@aaron-tsar

@aaron-tsar aaron-tsar commented May 25, 2026

Copy link
Copy Markdown
Contributor

Summary

The committed internal/http/openapi_spec.json documented 60 of ~258 actual HTTP routes (incl. the Vault chunk added in this PR's first commit). This PR brings that to 210 paths — full coverage of the public + admin surface — and adds 31 component schemas so generated clients have real types instead of object blobs.

Two commits:

  1. docs(openapi): add vault endpoints + schemas — 19 Vault routes, 9 schemas, 2 tags (Vault, Vault Graph). Diff for this commit is +1961, 0 deletions.
  2. docs(openapi): cover the remaining HTTP endpoints — 151 more paths, 19 schemas, 8 tags spanning KG, Memory, OAuth, Storage, Agents sub-resources, Skills, MCP, Providers, Tenants, CLI Credentials, System / Backup, Packages, Built-in Tools, TTS / Voices, Teams, Channels / Contacts, Evolution, Episodic Memory, Edition, openapi.json itself, API Keys revoke, Traces export, Usage breakdown.

Total this PR: +10620 lines, no existing operation/schema/tag modified.

Source of truth

Every entry is grounded in code from internal/http/*.go:

Area Source files used
Vault vault_handlers.go, vault_handler_documents.go, vault_handler_links.go, vault_handler_tree.go, vault_handler_upload.go, vault_graph_handler.go
Knowledge Graph knowledge_graph.go, knowledge_graph_handlers.go, internal/store/knowledge_graph_store.go
Memory memory.go, memory_handlers.go
OAuth oauth.go (chatgpt+openai share the same handler set)
Storage / Files storage.go, files.go, workspace_upload.go
Agents sub-resources agents.go and helpers (agents_export*.go, agents_import*.go, agents_instances.go, agents_sharing.go, agents_prompt_preview.go, agents_workspace.go)
Skills skills.go
MCP mcp.go, mcp_user_credentials.go
Providers providers.go
Tenants / users tenants.go, channel_instances.go (users/search)
CLI Credentials secure_cli.go, secure_cli_user_credentials.go, secure_cli_agent_grants.go
System / Backup system_configs.go, backup_handler.go, backup_s3_handler.go, tenant_backup_handler.go, restore_handler.go, edition.go, openapi.go
Packages packages.go
Built-in Tools builtin_tools.go
TTS / Voices tts.go, voices.go, tts_capabilities.go
Teams / Channels / Contacts agents.go (team export/import), channel_instances.go, team_events.go, team_attachments.go
Evolution / Episodic evolution_handlers.go, episodic_handlers.go
Traces / Usage / API keys traces.go, usage.go
Orchestration / v3 flags orchestration_handlers.go, v3_flags_handlers.go

For each handler I read: route registration line (method + path), var body struct { ... } if any (to derive request body fields), and the writeJSON(...) call shape (to derive responses). Where the body is generic / free-form (map[string]any / additionalProperties: true), the spec documents that honestly rather than fabricating a rigid schema.

Diff cleanliness

Default git diff uses the Myers algorithm, which for this kind of big-block JSON insertion produces some cosmetic deletion lines (about 270) even though no semantic content was removed. Verified two ways:

  • git diff --histogram and git diff --patience both report 0 deletions for the second commit (the first commit was already 0 deletions under Myers).
  • Programmatic check: load HEAD's spec + the new spec with json.load and compare every operation / schema entry. All originals are bit-identical; nothing was changed in place.
$ git diff --diff-algorithm=histogram --stat internal/http/openapi_spec.json
 internal/http/openapi_spec.json | 10620 +++++++++++++++++++++++++...
 1 file changed, 10620 insertions(+)

What's intentionally not covered

  • WebSocket-only methods (sessions, cron, chat history, pairing, ...). The OpenAPI spec is HTTP only.
  • A few admin / internal endpoints whose handlers accept fully free-form payloads (e.g. agents_import_handlers.go) are documented with additionalProperties: true rather than a fabricated rigid body. If the maintainers want strict shapes for those, happy to follow up after this lands.
  • Workstations + Webhooks weren't in the route gap on dev at this commit.

Test plan

  • JSON parses (python3 -c "import json; json.load(open(...))").
  • go build ./internal/http///go:embed compiles with the new bytes.
  • go vet ./internal/http/ — clean.
  • Semantic preservation check: every original paths[*][method] entry and every original components.schemas[*] entry is bit-identical between HEAD and the new file.
  • No existing tag renamed or removed.
  • Run goclaw locally and curl /v1/openapi.json → Swagger UI at /docs should now list every visible HTTP handler.

Why one PR instead of three

I started with a Vault-only PR for review-size reasons and the maintainers' time. The user driving this asked to ship it all together since the work is mechanical and verifiable — the diff is large but flat, and the semantic preservation is automatable.

Happy to split back into three commits (Vault / KG-Memory / rest) if that's easier to review — they're already separable in the current commit history.

The committed OpenAPI spec only documented 41 of ~286 actual routes. This
adds the 19 Vault endpoints — 16 under /v1/vault/* and 3 under
/v1/agents/{agentID}/vault/* — plus their request/response schemas.

Routes covered (matches internal/http/vault_handler_*.go and
vault_graph_handler.go registrations):

- documents:    list, create, get, update, delete (per-agent and cross-agent)
- documents/{docID}/links:  outlinks + backlinks + name lookup
- links:        create, delete, batch get outlinks
- upload:       multipart, allowed exts whitelist
- rescan:       per-tenant workspace rescan w/ concurrency guard (409)
- tree:         lazy sidebar listing
- search:       hybrid FTS + vector
- enrichment:   status + stop
- graph:        lightweight nodes/edges for visualization

Schemas: VaultDocument, VaultDocumentInput, VaultDocumentUpdateInput,
VaultLink, VaultBacklink, VaultSearchResult, VaultTreeEntry,
VaultGraphNode, VaultGraphEdge. Tags: Vault, Vault Graph.

Pure spec addition — no handler changes. The insertion is surgical
(no reformatting of existing entries), so the diff is additive only.
@aaron-tsar aaron-tsar changed the title docs(openapi): add vault endpoints + schemas to openapi_spec.json docs(openapi): cover the full HTTP API surface May 25, 2026
Continues the gap-fill started for Vault. Adds 150 more path operations
spanning every other HTTP-route file under internal/http/, with 19 new
component schemas and 8 new tags. After this commit the spec covers 210
paths vs 60 previously committed (the actual handler surface is ~258).

Coverage by area (file → routes added):
  knowledge_graph_handlers.go     9   (Knowledge Graph: extract, graph, stats,
                                       dedup scan/dismiss, merge, single entity)
  vault_graph_handler.go          1   (kg/graph/compact)
  memory_handlers.go              6   (documents CRUD with {path...}, chunks,
                                       index, index-all)
  oauth.go                        8   (chatgpt + openai: status, start,
                                       callback, logout × 2)
  storage.go                      4   (files {path...} read/delete, size, move;
                                       POST upload merged into the existing
                                       /v1/storage/files block so the path key
                                       stays unique and YAML-strict parsers like
                                       Swagger UI's loader accept the spec)
  agents.go                       22  (sync-workspace, shares CRUD, regenerate /
                                       resummon / cancel-summon, system-prompt-
                                       preview, export {preview,download/token},
                                       import {preview,merge}, teams export/import,
                                       instances + metadata, orchestration,
                                       v3-flags)
  evolution_handlers.go           3   (metrics, suggestions, suggestion review)
  episodic_handlers.go            2   (list, search)
  skills.go                       18  (versions, files, files/{path...}, upload,
                                       grants agent/user × revoke, install-deps
                                       trio, runtimes, toggle, tenant-config,
                                       export {preview}, import)
  mcp.go + mcp_user_credentials.go 16 (test, reconnect, grants + per-user creds,
                                       requests CRUD + review, export {preview},
                                       import, agent-grants list)
  providers.go                    4   (verify-embedding, codex-pool-activity,
                                       claude-cli auth-status, embedding/status)
  tenants.go + users              7   (CRUD + tenant users + tenant-users list,
                                       users/search)
  secure_cli.go + agent_grants    17  (cli-credentials full CRUD + presets +
                                       check-binary + test + user-credentials +
                                       agent-grants)
  system_configs.go               4   (list, get, put, delete)
  backup_handler.go + s3 + tenant 12  (system backup preflight/download/s3 set,
                                       tenant backup + restore)
  packages.go                     6   (list, install/uninstall, runtimes,
                                       github-releases, shell-deny-groups)
  builtin_tools.go                3   (tenant-config get/set/delete)
  tts.go + voices.go + caps       6   (config, synthesize, test-connection,
                                       capabilities, voices, voices/refresh)
  channel_instances.go +contacts +pending  10  (channel writers, writer groups,
                                       contacts resolve / merge / unmerge / merged,
                                       pending-messages)
  files.go + workspace_upload      3   (files {path...} read, files/sign,
                                       team workspace upload + move, team events,
                                       team task attachment download)
  edition.go + openapi.go          2   (edition info, openapi.json)
  api-keys + traces + usage        3   (revoke, traces/{traceID}/export,
                                       usage/breakdown)

New schemas: KGEntity, KGRelation, KGDedupCandidate, KGStats, TraversalResult,
MemoryDocument, MemoryChunk, MemorySearchHit, OAuthStatus, OAuthStartResponse,
Skill, McpServer, Tenant, TenantUser, CLICredential, Package, EvolutionMetric,
EvolutionSuggestion, EpisodicSummary.

New tags: Tenants, CLI Credentials, Packages, Contacts, Teams, TTS, Evolution,
Episodic Memory.

Purely additive — no existing operation, schema, or tag is modified. The one
overlap (`/v1/storage/files`, previously documented as GET-only) is handled
by inserting the new POST method inside the existing path block in place
rather than re-declaring the key, so each path key appears exactly once and
the spec parses cleanly under both JSON and strict YAML loaders.

Verified by parsing HEAD and the new file with python json.load + yaml.safe_load
and diffing entry-by-entry. Under `git diff --histogram`/`--patience` the diff
shows zero deletions; the default myers algorithm reports cosmetic deletion
lines but they are diff-algorithm noise, not real changes.

Where a body field or response shape was clear from the handler, the spec
captures it; where the handler accepts free-form / additive JSON payloads
the request body is documented as a generic object (additionalProperties:
true) rather than a fabricated rigid schema. Better to be honest about
flexibility than to lock callers into a wrong type.
@aaron-tsar aaron-tsar force-pushed the docs/openapi-add-vault-endpoints branch from 41f454c to 29a73db Compare May 25, 2026 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant