Skip to content

Latest commit

 

History

History
36 lines (24 loc) · 1.91 KB

File metadata and controls

36 lines (24 loc) · 1.91 KB

Dynamic tools (pkg/dynamictools)

Repository documentation index: docs/README.md

Overview

This package implements Phase 1 of MoonHub dynamic UI tools: the backend stores AI-generated tool definitions (chat + space JSON schemas), deduplicates by content hash, and executes them with the SchemaEngine — fetching optional remote data through HostFunctions, then merging data into a copy of the UI schema for the PWA DynamicRenderer.

The engine field on DynamicTool allows "schema" (implemented) and "wasm" (reserved for a future runtime). Generation is triggered from the HTTP API via the configured LLM (see web/backend/api/dynamic_tools.go).

Layout

File Role
types.go DynamicTool, GeneratedComponent, FetchConfig, GenerateRequest, ExecutionResult
tool_manager.go SQLite CRUD, content_hash unique index, is_on_home flag
schema_engine.go Execute / ExecuteSpace, data injection into schema
host_functions.go HTTPFetch, ReadChannel (stub); bounded response size
fetch_url.go URL allowlisting / validation for fetches

Persistence

  • Database path: <MOONHUB_HOME>/dynamic_tools.db (same home as MOONHUB_HOME / default ~/.moonhub).
  • Table dynamic_tools — see tool_manager.go for columns.

Integration

Tests

go test ./pkg/dynamictools/... -count=1