Files
mesh-catalog/modules/mesh-build-node/cmd/mesh-build-node/tools.go
T
jschoubben d3d9ff5183 M1: the build modules and the registry say their class and name every store's cap; detected-steps is pruned
Each of the four is core. Every state that named no cap names one, from its
live fill read 2026-11-22 01:4x CET (mesh-broker show, nats_streams on novox):
mesh-build-go steps 16.0 MiB (16,783,695 bytes) -> 128 MiB; mesh-build-node
steps 2.35 MiB (2,463,833 bytes) -> 16 MiB; every other state under 2 MiB ->
8 MiB (largest: distribution holds 1,844,287 bytes, mesh-build-go
detected-steps 868,554, distribution transfers 846,359, findings 668,161, idle
401,736, mesh-build-go pauses 254,366). The Go build module's finding-events is
8 MiB for 7 days. The objects stores already name their caps; none keeps a log.
The Go and Node build modules prune their state detected-steps (each key an
artifact's steps as detected, detected again when gone) at their own writes,
past prune-mark 70 % down to prune-target 50 %, and serve
<module>_state_prune_now and <module>_state_keep; no other state of the four is
prunable (each is truth: running steps, pauses, keys, toolchains, findings,
holds, transfers, windows, mirrors, taken asks).

Builds: design 47 H2 §812, §820; H-A-411 (1), (2), (3), H-A-437
2026-11-22 01:39:49 +01:00

58 lines
2.2 KiB
Go

package main
import (
"context"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun"
stdio "git.novox.be/novox/mesh-sdk/go"
)
// The tools this module serves. A tool is named as the module is: build_node_ and its verb (a tool name has no dot).
const (
StatusTool = "build_node_status"
HealthTool = "build_node_health"
)
// StepTool is one step tool of the module: fetch, test or build. Long is a step that answers at once and
// ends on its key (ADR 0469 §2); the others answer in their call. Both run behind the toolchain guard.
type StepTool struct {
Name string
Description string
Input map[string]any
Long bool
Run func(ctx context.Context, args map[string]any) (any, error)
}
// StepTools are the module's step tools. Each step's issue adds its own.
func (m *Module) StepTools() []StepTool {
return []StepTool{m.fetchTool(), m.testTool(), m.buildTool()}
}
// Tools is every tool the module serves: its step tools behind the guard, its status and its health.
func (m *Module) Tools(steps []StepTool) []stdio.Tool {
tools := []stdio.Tool{}
for _, s := range steps {
t := stdio.Tool{Name: s.Name, Description: s.Description, Input: s.Input}
if s.Long {
t.Run = m.Long(s.Name, s.Run)
} else {
t.Run = m.Short(s.Run)
}
tools = append(tools, t)
}
tools = append(tools, m.ReadTools()...)
tools = append(tools, steprun.StepEndTool(StepEndTool, m.Node, m.stepScan(), m.Held))
tools = append(tools, m.releaseTool())
tools = append(tools, pruneTools()...)
return append(tools,
stdio.Tool{Name: StatusTool,
Description: "What the Node build module is on this machine: the Node version its recipe builds with and the one installed, " +
"the recipe version, the toolchain directory and whether it is installed, and why it refuses to build if it does. Read-only.",
Run: func(map[string]any) (any, error) { return m.Status(m.Ctx), nil }},
stdio.Tool{Name: HealthTool,
Description: "How the Node build module is: unhealthy while the Node installed on this machine is not the version its " +
"recipe builds with, saying both versions; healthy otherwise. Read-only.",
Run: func(map[string]any) (any, error) { return m.Health(m.Ctx), nil }},
)
}