Documentation
¶
Index ¶
- Constants
- Variables
- func IsAgentToken(value string) bool
- func PrepareTokenFileWrite(path string) error
- func ReadTokenFile(path string) (string, error)
- func ValidateAllowedWakeSenders(name string, senders []string) error
- func ValidateClockField(data []byte, yamlFormat bool) error
- func ValidateWakeValue(name string, mode WakeConfig) error
- func WriteTokenFile(path string, token string) error
- type AgentConfig
- type ClockConfig
- func (c *ClockConfig) Identity() (string, error)
- func (c *ClockConfig) Now(realNow func() time.Time) (func() (time.Time, error), error)
- func (c *ClockConfig) RealTime(taskTime time.Time) (time.Time, error)
- func (c *ClockConfig) UnmarshalJSON(data []byte) error
- func (c *ClockConfig) UnmarshalYAML(node *yaml.Node) error
- func (c ClockConfig) Validate() error
- type Config
- type DMConfig
- type MoltnetConfig
- type MoltnetTokenConfig
- type RoomAccess
- type RoomBinding
- type RuntimeConfig
- type WakeConfig
Constants ¶
const ( VersionV1 = "moltnet.bridge.v1" AuthModeNone = "none" AuthModeBearer = "bearer" AuthModeOpen = "open" RuntimeOpenClaw = "openclaw" RuntimePicoClaw = "picoclaw" RuntimePi = "pi" RuntimeDaimon = "daimon" RuntimeClaudeCode = "claude-code" RuntimeCodex = "codex" )
const ( DefaultOpenClawGatewayURL = "ws://127.0.0.1:18789" DefaultPicoClawEventsURL = "ws://127.0.0.1:18990/pico/ws" DefaultPicoClawCommand = "picoclaw" DefaultClaudeCodeCommand = "claude" DefaultCodexCommand = "codex" )
const ( RuntimeModeManaged = "managed" RuntimeModeAttached = "attached" )
const AgentTokenPrefix = "magt_v1_"
const TaskClockHeader = "Moltnet-Clock"
TaskClockHeader carries the server-authored clock identity in HTTP responses. An absent header means the server uses real time.
const TaskClockVersion = "noopolis.task-clock.v1"
Variables ¶
var ErrClockRange = errors.New("clock result is outside supported range " + supportedClockRange)
ErrClockRange is safe to expose to callers; an exhausted clock cannot stamp new domain data. Existing recorded timestamps remain readable.
Functions ¶
func IsAgentToken ¶ added in v0.1.1
func PrepareTokenFileWrite ¶ added in v0.1.1
func ReadTokenFile ¶ added in v0.1.1
func ValidateAllowedWakeSenders ¶ added in v0.1.14
ValidateAllowedWakeSenders validates local unqualified sender IDs for every config carrier that embeds DMConfig.
func ValidateClockField ¶ added in v0.1.19
ValidateClockField distinguishes an omitted clock from an explicit null at the enclosing file boundary, where pointer decoding otherwise loses presence. The caller still decodes and validates the complete configuration normally.
func ValidateWakeValue ¶ added in v0.1.13
func ValidateWakeValue(name string, mode WakeConfig) error
ValidateWakeValue validates a single wake policy value for node or client configs.
func WriteTokenFile ¶ added in v0.1.1
Types ¶
type AgentConfig ¶
type ClockConfig ¶ added in v0.1.19
type ClockConfig struct {
Version string `json:"version" yaml:"version"`
Origin string `json:"origin" yaml:"origin"`
AnchorEpochMS int64 `json:"anchorEpochMs" yaml:"anchor_epoch_ms"`
}
ClockConfig is the explicit cross-process task clock. JSON uses the ecosystem contract; YAML uses the config file's snake_case convention. Omission is real time.
func (*ClockConfig) Identity ¶ added in v0.1.19
func (c *ClockConfig) Identity() (string, error)
Identity compares both clock coordinates, not just their difference. Normalize origins to epoch milliseconds so equivalent RFC3339 spellings agree.
func (*ClockConfig) Now ¶ added in v0.1.19
Now injects the real clock only at this boundary. Like Date.parse/Date.now, task timestamps have millisecond precision. A nil config preserves time.Now. Each read checks the supported range; callers must stop the operation on error.
func (*ClockConfig) RealTime ¶ added in v0.1.19
RealTime reverses the shift for deliverers whose receiver applies task time.
func (*ClockConfig) UnmarshalJSON ¶ added in v0.1.19
func (c *ClockConfig) UnmarshalJSON(data []byte) error
func (*ClockConfig) UnmarshalYAML ¶ added in v0.1.19
func (c *ClockConfig) UnmarshalYAML(node *yaml.Node) error
func (ClockConfig) Validate ¶ added in v0.1.19
func (c ClockConfig) Validate() error
type Config ¶
type Config struct {
Clock *ClockConfig `json:"clock,omitempty" yaml:"clock,omitempty"`
Version string `json:"version" yaml:"version"`
Agent AgentConfig `json:"agent" yaml:"agent"`
Moltnet MoltnetConfig `json:"moltnet" yaml:"moltnet"`
Runtime RuntimeConfig `json:"runtime" yaml:"runtime"`
Rooms []RoomBinding `json:"rooms,omitempty" yaml:"rooms,omitempty"`
DMs *DMConfig `json:"dms,omitempty" yaml:"dms,omitempty"`
}
func (Config) Normalized ¶ added in v0.0.2
func (Config) ResolveTokenPaths ¶ added in v0.1.1
type DMConfig ¶
type DMConfig struct {
Enabled bool `json:"enabled" yaml:"enabled"`
Wake WakeConfig `json:"wake,omitempty" yaml:"wake,omitempty"`
AllowedWakeSenders []string `json:"allowed_wake_senders,omitempty" yaml:"allowed_wake_senders,omitempty"`
}
type MoltnetConfig ¶
type MoltnetConfig struct {
AuthMode string `json:"auth_mode,omitempty" yaml:"auth_mode,omitempty"`
BaseURL string `json:"base_url" yaml:"base_url"`
NetworkID string `json:"network_id" yaml:"network_id"`
Registration string `json:"registration,omitempty" yaml:"registration,omitempty"`
StaticToken bool `json:"static_token,omitempty" yaml:"static_token,omitempty"`
Token protocol.SecretString `json:"token,omitempty" yaml:"token,omitempty"`
TokenEnv string `json:"token_env,omitempty" yaml:"token_env,omitempty"`
TokenPath string `json:"token_path,omitempty" yaml:"token_path,omitempty"`
}
func (MoltnetConfig) EffectiveAuthMode ¶ added in v0.1.1
func (m MoltnetConfig) EffectiveAuthMode() string
func (MoltnetConfig) HasTokenSource ¶ added in v0.1.1
func (m MoltnetConfig) HasTokenSource() bool
func (MoltnetConfig) ResolveToken ¶ added in v0.1.1
func (m MoltnetConfig) ResolveToken() (string, bool, error)
func (MoltnetConfig) ResolveTokenPath ¶ added in v0.1.1
func (m MoltnetConfig) ResolveTokenPath(baseDir string) MoltnetConfig
func (MoltnetConfig) ValidateAuth ¶ added in v0.1.1
func (m MoltnetConfig) ValidateAuth() error
type MoltnetTokenConfig ¶ added in v0.1.1
type MoltnetTokenConfig struct {
Token protocol.SecretString `json:"token,omitempty" yaml:"token,omitempty"`
TokenEnv string `json:"token_env,omitempty" yaml:"token_env,omitempty"`
TokenPath string `json:"token_path,omitempty" yaml:"token_path,omitempty"`
}
func (MoltnetTokenConfig) HasTokenSource ¶ added in v0.1.1
func (m MoltnetTokenConfig) HasTokenSource() bool
func (MoltnetTokenConfig) ResolveTokenPath ¶ added in v0.1.1
func (m MoltnetTokenConfig) ResolveTokenPath(baseDir string) MoltnetTokenConfig
type RoomAccess ¶ added in v0.1.11
type RoomBinding ¶
type RoomBinding struct {
ID string `json:"id" yaml:"id"`
Wake WakeConfig `json:"wake,omitempty" yaml:"wake,omitempty"`
Visibility string `json:"visibility,omitempty" yaml:"visibility,omitempty"`
WritePolicy string `json:"write_policy,omitempty" yaml:"write_policy,omitempty"`
CanWrite *bool `json:"can_write,omitempty" yaml:"can_write,omitempty"`
Access *RoomAccess `json:"access,omitempty" yaml:"access,omitempty"`
}
type RuntimeConfig ¶
type RuntimeConfig struct {
Kind string `json:"kind" yaml:"kind"`
// AgentID names the runtime-side target when it differs from Agent.ID.
// It is currently supported only by Daimon; omission preserves legacy identity behavior.
AgentID string `json:"agent_id,omitempty" yaml:"agent_id,omitempty"`
Token protocol.SecretString `json:"token,omitempty" yaml:"token,omitempty"`
TokenEnv string `json:"token_env,omitempty" yaml:"token_env,omitempty"`
Command string `json:"command,omitempty" yaml:"command,omitempty"`
ConfigPath string `json:"config_path,omitempty" yaml:"config_path,omitempty"`
HomePath string `json:"home_path,omitempty" yaml:"home_path,omitempty"`
GatewayURL string `json:"gateway_url,omitempty" yaml:"gateway_url,omitempty"`
EventsURL string `json:"events_url,omitempty" yaml:"events_url,omitempty"`
ControlURL string `json:"control_url,omitempty" yaml:"control_url,omitempty"`
WorkspacePath string `json:"workspace_path,omitempty" yaml:"workspace_path,omitempty"`
SessionStorePath string `json:"session_store_path,omitempty" yaml:"session_store_path,omitempty"`
ReceiptStorePath string `json:"receipt_store_path,omitempty" yaml:"receipt_store_path,omitempty"`
SessionPrefix string `json:"session_prefix,omitempty" yaml:"session_prefix,omitempty"`
Driver string `json:"driver,omitempty" yaml:"driver,omitempty"`
// Mode selects managed (Moltnet runs the CLI per wake, the default) or
// attached (Moltnet nudges an already-open session named by Session).
Mode string `json:"mode,omitempty" yaml:"mode,omitempty"`
Session string `json:"session,omitempty" yaml:"session,omitempty"`
}
func (RuntimeConfig) IsAttached ¶ added in v0.1.21
func (r RuntimeConfig) IsAttached() bool
IsAttached reports whether the runtime nudges an already-open session instead of Moltnet running the runtime command per wake.
func (RuntimeConfig) Normalized ¶ added in v0.0.2
func (r RuntimeConfig) Normalized() RuntimeConfig
func (RuntimeConfig) ResolveRuntimeToken ¶ added in v0.1.18
func (r RuntimeConfig) ResolveRuntimeToken() (protocol.SecretString, error)
ResolveRuntimeToken resolves a Daimon control token at process runtime. The returned secret is never written back into RuntimeConfig.
type WakeConfig ¶ added in v0.1.13
type WakeConfig string
const ( WakeAll WakeConfig = "all" WakeMentions WakeConfig = "mentions" WakeThreadOnly WakeConfig = "thread_only" WakeNever WakeConfig = "never" )