Documentation
¶
Overview ¶
Package node hosts the runtime-side primitives shared by every concrete graph node implementation: the per-type Builder registry (Factory) and compatibility port declarations for custom type-only nodes.
Concrete node implementations live in sub-packages and register their builder explicitly into a Factory; this package no longer keeps any global default registry, schema metadata, or BuildContext.
File layout:
factory.go Factory + NodeBuilder ports.go RegisterPorts + PortsForType
Index ¶
- func LookupPortsForType(nodeType string) (input, output []graph.Port, ok bool)
- func PortsForType(nodeType string) (input, output []graph.Port)
- func RegisterPorts(nodeType string, input, output []graph.Port)
- type Factory
- func (f *Factory) Build(def graph.NodeDefinition) (graph.Node, error)
- func (f *Factory) Fallback() NodeBuilder
- func (f *Factory) FallbackRegistration(owner any) (FallbackRegistration, bool)
- func (f *Factory) RegisterBuilder(nodeType string, builder NodeBuilder)
- func (f *Factory) SetFallback(builder NodeBuilder)
- func (f *Factory) SetFallbackRegistration(owner any, registration FallbackRegistration)
- type FallbackRegistration
- type NodeBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LookupPortsForType ¶ added in v0.4.7
LookupPortsForType returns the ports previously registered for nodeType and reports whether a registration exists. The ok result lets callers distinguish "not registered" from an explicit nil/nil port declaration.
func PortsForType ¶
PortsForType returns the ports previously registered for nodeType. The returned slices are nil when no registration exists, mirroring the "unknown type" branch in scriptnode (which falls back to generic input/output ports).
func RegisterPorts ¶ added in v0.2.3
RegisterPorts declares the input/output port shape for a node type. Safe for concurrent use. Re-registering a type overwrites the previous entry. Prefer explicit setup over package init side effects for new code.
Types ¶
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory maps node type strings to NodeBuilders and constructs node instances on demand. Factory is safe for concurrent use.
func NewFactory ¶
func NewFactory() *Factory
NewFactory creates an empty Factory. Call RegisterBuilder (or the per-sub-package Register helpers like llmnode.Register, scriptnode.Register, knowledgenode.Register) to populate it before passing it to runner.New.
func (*Factory) Build ¶
Build constructs a single node from its declarative definition. The engine's two reserved types (__end__ and passthrough) are handled directly so callers never need to register them.
func (*Factory) Fallback ¶
func (f *Factory) Fallback() NodeBuilder
Fallback returns the current fallback builder (may be nil).
func (*Factory) FallbackRegistration ¶ added in v0.4.7
func (f *Factory) FallbackRegistration(owner any) (FallbackRegistration, bool)
FallbackRegistration returns fallback wrapper state previously stored for owner.
func (*Factory) RegisterBuilder ¶
func (f *Factory) RegisterBuilder(nodeType string, builder NodeBuilder)
RegisterBuilder registers builder for the given node type. Re-registering the same type overwrites the previous entry.
func (*Factory) SetFallback ¶
func (f *Factory) SetFallback(builder NodeBuilder)
SetFallback installs a builder that handles every node type for which no explicit builder is registered. Pass nil to clear.
func (*Factory) SetFallbackRegistration ¶ added in v0.4.7
func (f *Factory) SetFallbackRegistration(owner any, registration FallbackRegistration)
SetFallbackRegistration stores package-specific fallback wrapper state. owner should be a comparable package-private value to avoid collisions.
type FallbackRegistration ¶ added in v0.4.7
type FallbackRegistration struct {
External NodeBuilder
InstalledPC uintptr
}
FallbackRegistration records which package installed a fallback wrapper. Register helpers can use it to distinguish their own wrapper from a caller's external fallback when they are registered more than once on the same factory.
type NodeBuilder ¶
type NodeBuilder func(def graph.NodeDefinition) (graph.Node, error)
NodeBuilder constructs a graph.Node from its declarative definition. Build-time dependencies (LLM resolver, tool registry, script runtime, workspace, etc.) are captured by the closure that returns the builder — see graph/node/llmnode, graph/node/scriptnode, graph/node/knowledgenode.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package knowledgenode implements the "knowledge" graph node and exposes a Register helper for binding it into a node.Factory.
|
Package knowledgenode implements the "knowledge" graph node and exposes a Register helper for binding it into a node.Factory. |
|
Package llmnode implements the Go-native "llm" graph node and exposes a Register helper for binding it into a node.Factory.
|
Package llmnode implements the Go-native "llm" graph node and exposes a Register helper for binding it into a node.Factory. |
|
Package scripts owns only the embedded source for built-in JS graph nodes.
|
Package scripts owns only the embedded source for built-in JS graph nodes. |