Skip to content

devtools: populate entity directory at server startup so all components appear in tree immediately #52

Description

@TGPSKI

Context

  • internal/cli/api_devtools.go — /api/devtools/snapshot only returns bus events (no directory of registered components)
  • internal/cli/api_devtools.go:119-161 — inspectEntity only handles "event", "queue", "worker" kinds (missing agent, curing, tool, tannery, hide, artifact, lifecycle)
  • ui/js/devtools/tree.js:118-182 — buildModel() constructs the tree entirely from bus events; entities only appear after emitting events
  • ui/js/devtools/tree.js:184-210 — mergeDirectory() exists but backend never sends a "directory" field in the snapshot response
  • ui/js/devtools/api.js:81-83 — getEntityConfig calls /api/config/entity?kind=...&id=... which does not exist yet

Work

  • Add a Directory type (struct) with fields: curings, agents, tools, toolsets, tannery (optional), queues, hides, artifacts (all []ComponentEntry with id/count/status)
  • In apiMux() (cmd_serve.go), before creating the devtools handler, build a Directory from these known components:
    • curings: load from tannery config (if tannery mode active, from initTannery)
    • agents: all agents loaded from agent dir (always available in deps)
    • tools: tool registry entries (toolReg)
    • toolsets: from skill directory
    • tannery: tannery file path and mode from cfg
    • queues: from tannery config Queues
  • Pass Directory into DevtoolsHandlerDeps so the snapshot endpoint includes it as a response field
  • Update /api/devtools/snapshot JSON response to include a "directory" key when available, alongside existing version/commit/started_at/captured_at/bus_stats/recent_events
  • Extend inspectEntity() to handle additional kinds: agent, curing, tannery, tool, toolset, hide, artifact, lifecycle (if exists)
  • Wire up /api/config/entity?kind=...&id=... endpoint to return component metadata from the directory (backfill the missing endpoint referenced in api.js)
  • In tree.js mergeDirectory(): handle the new directory fields — toolsets (already referenced on line 203), tannery metadata, and any new sections
  • Test: start leather serve --api with devtools enabled; verify agent/curing/tool/tannery tree nodes appear immediately without any events firing; verify inspect works for each new kind; run make test and make check

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-workMinimal agent-consumable work item

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions