feat: AX primitives — Option/Options/Result, Data, Drive, full names
Core primitives:
- Option{K, V} atom, Options []Option universal input, Result[T] universal return
- Replaces With* functional options, Must*, For[T] patterns
- New(Options) returns *Core (no error — Core handles internally)
New subsystems:
- Data: embedded content mount registry (packages mount assets)
- Drive: transport handle registry stub (API, MCP, SSH, VPN)
Renames (AX principle — predictable names):
- ErrPan → ErrorPanic, ErrLog → ErrorLog, ErrSink → ErrorSink
- srv → service, cfg → config, err → error, emb → legacy accessor
- ErrorOptions/ErrorPanicOptions/NewErrorLog/NewErrorPanic removed
- Contract/ConfigService removed (unused)
RFC-025: Agent Experience updated to match implementation.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:22:30 +00:00
|
|
|
// SPDX-License-Identifier: EUPL-1.2
|
|
|
|
|
|
|
|
|
|
// Core primitives: Option, Options, Result.
|
|
|
|
|
//
|
2026-03-24 19:17:12 +00:00
|
|
|
// Options is the universal input type. Result is the universal output type.
|
|
|
|
|
// All Core operations accept Options and return Result.
|
|
|
|
|
//
|
|
|
|
|
// opts := core.NewOptions(
|
|
|
|
|
// core.Option{Key: "name", Value: "brain"},
|
|
|
|
|
// core.Option{Key: "path", Value: "prompts"},
|
|
|
|
|
// )
|
|
|
|
|
// r := c.Drive().New(opts)
|
|
|
|
|
// if !r.OK { log.Fatal(r.Error()) }
|
feat: AX primitives — Option/Options/Result, Data, Drive, full names
Core primitives:
- Option{K, V} atom, Options []Option universal input, Result[T] universal return
- Replaces With* functional options, Must*, For[T] patterns
- New(Options) returns *Core (no error — Core handles internally)
New subsystems:
- Data: embedded content mount registry (packages mount assets)
- Drive: transport handle registry stub (API, MCP, SSH, VPN)
Renames (AX principle — predictable names):
- ErrPan → ErrorPanic, ErrLog → ErrorLog, ErrSink → ErrorSink
- srv → service, cfg → config, err → error, emb → legacy accessor
- ErrorOptions/ErrorPanicOptions/NewErrorLog/NewErrorPanic removed
- Contract/ConfigService removed (unused)
RFC-025: Agent Experience updated to match implementation.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:22:30 +00:00
|
|
|
package core
|
|
|
|
|
|
2026-03-24 19:17:12 +00:00
|
|
|
// --- Result: Universal Output ---
|
|
|
|
|
|
feat: AX primitives — Option/Options/Result, Data, Drive, full names
Core primitives:
- Option{K, V} atom, Options []Option universal input, Result[T] universal return
- Replaces With* functional options, Must*, For[T] patterns
- New(Options) returns *Core (no error — Core handles internally)
New subsystems:
- Data: embedded content mount registry (packages mount assets)
- Drive: transport handle registry stub (API, MCP, SSH, VPN)
Renames (AX principle — predictable names):
- ErrPan → ErrorPanic, ErrLog → ErrorLog, ErrSink → ErrorSink
- srv → service, cfg → config, err → error, emb → legacy accessor
- ErrorOptions/ErrorPanicOptions/NewErrorLog/NewErrorPanic removed
- Contract/ConfigService removed (unused)
RFC-025: Agent Experience updated to match implementation.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:22:30 +00:00
|
|
|
// Result is the universal return type for Core operations.
|
|
|
|
|
// Replaces the (value, error) pattern — errors flow through Core internally.
|
|
|
|
|
//
|
2026-03-24 19:17:12 +00:00
|
|
|
// r := c.Data().New(opts)
|
|
|
|
|
// if !r.OK { core.Error("failed", "err", r.Error()) }
|
2026-03-20 13:30:22 +00:00
|
|
|
type Result struct {
|
|
|
|
|
Value any
|
feat: AX primitives — Option/Options/Result, Data, Drive, full names
Core primitives:
- Option{K, V} atom, Options []Option universal input, Result[T] universal return
- Replaces With* functional options, Must*, For[T] patterns
- New(Options) returns *Core (no error — Core handles internally)
New subsystems:
- Data: embedded content mount registry (packages mount assets)
- Drive: transport handle registry stub (API, MCP, SSH, VPN)
Renames (AX principle — predictable names):
- ErrPan → ErrorPanic, ErrLog → ErrorLog, ErrSink → ErrorSink
- srv → service, cfg → config, err → error, emb → legacy accessor
- ErrorOptions/ErrorPanicOptions/NewErrorLog/NewErrorPanic removed
- Contract/ConfigService removed (unused)
RFC-025: Agent Experience updated to match implementation.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:22:30 +00:00
|
|
|
OK bool
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-20 14:33:26 +00:00
|
|
|
// Result gets or sets the value. Zero args returns Value. With args, maps
|
|
|
|
|
// Go (value, error) pairs to Result and returns self.
|
2026-03-20 14:32:16 +00:00
|
|
|
//
|
2026-03-20 14:33:26 +00:00
|
|
|
// r.Result(file, err) // OK = err == nil, Value = file
|
|
|
|
|
// r.Result(value) // OK = true, Value = value
|
|
|
|
|
// r.Result() // after set — returns the value
|
2026-03-20 15:13:36 +00:00
|
|
|
func (r Result) Result(args ...any) Result {
|
2026-03-24 20:29:55 +00:00
|
|
|
if len(args) == 0 {
|
2026-03-20 17:20:08 +00:00
|
|
|
return r
|
|
|
|
|
}
|
2026-03-24 19:17:12 +00:00
|
|
|
return r.New(args...)
|
|
|
|
|
}
|
2026-03-20 15:13:36 +00:00
|
|
|
|
2026-03-25 18:07:42 +00:00
|
|
|
// New adapts Go (value, error) pairs into a Result.
|
|
|
|
|
//
|
|
|
|
|
// r := core.Result{}.New(file, err)
|
2026-03-24 19:17:12 +00:00
|
|
|
func (r Result) New(args ...any) Result {
|
2026-03-24 20:29:55 +00:00
|
|
|
if len(args) == 0 {
|
|
|
|
|
return r
|
2026-03-20 14:27:12 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-24 20:29:55 +00:00
|
|
|
if len(args) > 1 {
|
|
|
|
|
if err, ok := args[len(args)-1].(error); ok {
|
|
|
|
|
if err != nil {
|
|
|
|
|
return Result{Value: err, OK: false}
|
|
|
|
|
}
|
|
|
|
|
r.Value = args[0]
|
|
|
|
|
r.OK = true
|
|
|
|
|
return r
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
r.Value = args[0]
|
|
|
|
|
|
2026-03-24 19:17:12 +00:00
|
|
|
if err, ok := r.Value.(error); ok {
|
2026-03-20 17:20:08 +00:00
|
|
|
if err != nil {
|
2026-03-24 20:29:55 +00:00
|
|
|
return Result{Value: err, OK: false}
|
2026-03-20 14:27:12 +00:00
|
|
|
}
|
2026-03-24 20:29:55 +00:00
|
|
|
return Result{OK: true}
|
2026-03-20 14:27:12 +00:00
|
|
|
}
|
2026-03-24 19:17:12 +00:00
|
|
|
|
2026-03-24 20:29:55 +00:00
|
|
|
r.OK = true
|
2026-03-24 19:17:12 +00:00
|
|
|
return r
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-25 18:07:42 +00:00
|
|
|
// Get returns the Result if OK, empty Result otherwise.
|
|
|
|
|
//
|
|
|
|
|
// r := core.Result{Value: "hello", OK: true}.Get()
|
2026-03-24 19:17:12 +00:00
|
|
|
func (r Result) Get() Result {
|
|
|
|
|
if r.OK {
|
|
|
|
|
return r
|
|
|
|
|
}
|
|
|
|
|
return Result{Value: r.Value, OK: false}
|
2026-03-20 14:27:12 +00:00
|
|
|
}
|
|
|
|
|
|
feat: AX primitives — Option/Options/Result, Data, Drive, full names
Core primitives:
- Option{K, V} atom, Options []Option universal input, Result[T] universal return
- Replaces With* functional options, Must*, For[T] patterns
- New(Options) returns *Core (no error — Core handles internally)
New subsystems:
- Data: embedded content mount registry (packages mount assets)
- Drive: transport handle registry stub (API, MCP, SSH, VPN)
Renames (AX principle — predictable names):
- ErrPan → ErrorPanic, ErrLog → ErrorLog, ErrSink → ErrorSink
- srv → service, cfg → config, err → error, emb → legacy accessor
- ErrorOptions/ErrorPanicOptions/NewErrorLog/NewErrorPanic removed
- Contract/ConfigService removed (unused)
RFC-025: Agent Experience updated to match implementation.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:22:30 +00:00
|
|
|
// Option is a single key-value configuration pair.
|
|
|
|
|
//
|
fix: AX audit round 5 — full naming, Result returns throughout
Renames (via GoLand refactor):
- Option.K → Key, Option.V → Value
- Err.Op → Operation, Err.Msg → Message, Err.Err → Error
- CrashSystem.OS → OperatingSystem, Arch → Architecture
- TaskID → TaskIdentifier, TaskWithID → TaskWithIdentifier
- Ipc → IPC, BaseDir → BaseDirectory
- ServiceRuntime.Opts → Options
Return type changes:
- Options.Get, Config.Get → Result (was (any, bool))
- Embed.ReadDir → Result (was ([]fs.DirEntry, error))
- Translator.Translate, I18n.Translate → Result (was string)
Rule 6:
- data.go: propagate opts.Get failure, typed error for bad fs.FS
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 16:32:43 +00:00
|
|
|
// core.Option{Key: "name", Value: "brain"}
|
|
|
|
|
// core.Option{Key: "port", Value: 8080}
|
feat: AX primitives — Option/Options/Result, Data, Drive, full names
Core primitives:
- Option{K, V} atom, Options []Option universal input, Result[T] universal return
- Replaces With* functional options, Must*, For[T] patterns
- New(Options) returns *Core (no error — Core handles internally)
New subsystems:
- Data: embedded content mount registry (packages mount assets)
- Drive: transport handle registry stub (API, MCP, SSH, VPN)
Renames (AX principle — predictable names):
- ErrPan → ErrorPanic, ErrLog → ErrorLog, ErrSink → ErrorSink
- srv → service, cfg → config, err → error, emb → legacy accessor
- ErrorOptions/ErrorPanicOptions/NewErrorLog/NewErrorPanic removed
- Contract/ConfigService removed (unused)
RFC-025: Agent Experience updated to match implementation.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:22:30 +00:00
|
|
|
type Option struct {
|
fix: AX audit round 5 — full naming, Result returns throughout
Renames (via GoLand refactor):
- Option.K → Key, Option.V → Value
- Err.Op → Operation, Err.Msg → Message, Err.Err → Error
- CrashSystem.OS → OperatingSystem, Arch → Architecture
- TaskID → TaskIdentifier, TaskWithID → TaskWithIdentifier
- Ipc → IPC, BaseDir → BaseDirectory
- ServiceRuntime.Opts → Options
Return type changes:
- Options.Get, Config.Get → Result (was (any, bool))
- Embed.ReadDir → Result (was ([]fs.DirEntry, error))
- Translator.Translate, I18n.Translate → Result (was string)
Rule 6:
- data.go: propagate opts.Get failure, typed error for bad fs.FS
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 16:32:43 +00:00
|
|
|
Key string
|
|
|
|
|
Value any
|
feat: AX primitives — Option/Options/Result, Data, Drive, full names
Core primitives:
- Option{K, V} atom, Options []Option universal input, Result[T] universal return
- Replaces With* functional options, Must*, For[T] patterns
- New(Options) returns *Core (no error — Core handles internally)
New subsystems:
- Data: embedded content mount registry (packages mount assets)
- Drive: transport handle registry stub (API, MCP, SSH, VPN)
Renames (AX principle — predictable names):
- ErrPan → ErrorPanic, ErrLog → ErrorLog, ErrSink → ErrorSink
- srv → service, cfg → config, err → error, emb → legacy accessor
- ErrorOptions/ErrorPanicOptions/NewErrorLog/NewErrorPanic removed
- Contract/ConfigService removed (unused)
RFC-025: Agent Experience updated to match implementation.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:22:30 +00:00
|
|
|
}
|
|
|
|
|
|
2026-03-24 19:17:12 +00:00
|
|
|
// --- Options: Universal Input ---
|
|
|
|
|
|
|
|
|
|
// Options is the universal input type for Core operations.
|
|
|
|
|
// A structured collection of key-value pairs with typed accessors.
|
feat: AX primitives — Option/Options/Result, Data, Drive, full names
Core primitives:
- Option{K, V} atom, Options []Option universal input, Result[T] universal return
- Replaces With* functional options, Must*, For[T] patterns
- New(Options) returns *Core (no error — Core handles internally)
New subsystems:
- Data: embedded content mount registry (packages mount assets)
- Drive: transport handle registry stub (API, MCP, SSH, VPN)
Renames (AX principle — predictable names):
- ErrPan → ErrorPanic, ErrLog → ErrorLog, ErrSink → ErrorSink
- srv → service, cfg → config, err → error, emb → legacy accessor
- ErrorOptions/ErrorPanicOptions/NewErrorLog/NewErrorPanic removed
- Contract/ConfigService removed (unused)
RFC-025: Agent Experience updated to match implementation.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:22:30 +00:00
|
|
|
//
|
2026-03-24 19:17:12 +00:00
|
|
|
// opts := core.NewOptions(
|
|
|
|
|
// core.Option{Key: "name", Value: "myapp"},
|
|
|
|
|
// core.Option{Key: "port", Value: 8080},
|
|
|
|
|
// )
|
feat: AX primitives — Option/Options/Result, Data, Drive, full names
Core primitives:
- Option{K, V} atom, Options []Option universal input, Result[T] universal return
- Replaces With* functional options, Must*, For[T] patterns
- New(Options) returns *Core (no error — Core handles internally)
New subsystems:
- Data: embedded content mount registry (packages mount assets)
- Drive: transport handle registry stub (API, MCP, SSH, VPN)
Renames (AX principle — predictable names):
- ErrPan → ErrorPanic, ErrLog → ErrorLog, ErrSink → ErrorSink
- srv → service, cfg → config, err → error, emb → legacy accessor
- ErrorOptions/ErrorPanicOptions/NewErrorLog/NewErrorPanic removed
- Contract/ConfigService removed (unused)
RFC-025: Agent Experience updated to match implementation.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:22:30 +00:00
|
|
|
// name := opts.String("name")
|
2026-03-24 19:17:12 +00:00
|
|
|
type Options struct {
|
|
|
|
|
items []Option
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NewOptions creates an Options collection from key-value pairs.
|
|
|
|
|
//
|
|
|
|
|
// opts := core.NewOptions(
|
|
|
|
|
// core.Option{Key: "name", Value: "brain"},
|
|
|
|
|
// core.Option{Key: "path", Value: "prompts"},
|
|
|
|
|
// )
|
|
|
|
|
func NewOptions(items ...Option) Options {
|
|
|
|
|
cp := make([]Option, len(items))
|
|
|
|
|
copy(cp, items)
|
|
|
|
|
return Options{items: cp}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set adds or updates a key-value pair.
|
|
|
|
|
//
|
|
|
|
|
// opts.Set("port", 8080)
|
|
|
|
|
func (o *Options) Set(key string, value any) {
|
|
|
|
|
for i, opt := range o.items {
|
|
|
|
|
if opt.Key == key {
|
|
|
|
|
o.items[i].Value = value
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
o.items = append(o.items, Option{Key: key, Value: value})
|
|
|
|
|
}
|
feat: AX primitives — Option/Options/Result, Data, Drive, full names
Core primitives:
- Option{K, V} atom, Options []Option universal input, Result[T] universal return
- Replaces With* functional options, Must*, For[T] patterns
- New(Options) returns *Core (no error — Core handles internally)
New subsystems:
- Data: embedded content mount registry (packages mount assets)
- Drive: transport handle registry stub (API, MCP, SSH, VPN)
Renames (AX principle — predictable names):
- ErrPan → ErrorPanic, ErrLog → ErrorLog, ErrSink → ErrorSink
- srv → service, cfg → config, err → error, emb → legacy accessor
- ErrorOptions/ErrorPanicOptions/NewErrorLog/NewErrorPanic removed
- Contract/ConfigService removed (unused)
RFC-025: Agent Experience updated to match implementation.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:22:30 +00:00
|
|
|
|
|
|
|
|
// Get retrieves a value by key.
|
|
|
|
|
//
|
fix: AX audit round 5 — full naming, Result returns throughout
Renames (via GoLand refactor):
- Option.K → Key, Option.V → Value
- Err.Op → Operation, Err.Msg → Message, Err.Err → Error
- CrashSystem.OS → OperatingSystem, Arch → Architecture
- TaskID → TaskIdentifier, TaskWithID → TaskWithIdentifier
- Ipc → IPC, BaseDir → BaseDirectory
- ServiceRuntime.Opts → Options
Return type changes:
- Options.Get, Config.Get → Result (was (any, bool))
- Embed.ReadDir → Result (was ([]fs.DirEntry, error))
- Translator.Translate, I18n.Translate → Result (was string)
Rule 6:
- data.go: propagate opts.Get failure, typed error for bad fs.FS
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 16:32:43 +00:00
|
|
|
// r := opts.Get("name")
|
|
|
|
|
// if r.OK { name := r.Value.(string) }
|
|
|
|
|
func (o Options) Get(key string) Result {
|
2026-03-24 19:17:12 +00:00
|
|
|
for _, opt := range o.items {
|
fix: AX audit round 5 — full naming, Result returns throughout
Renames (via GoLand refactor):
- Option.K → Key, Option.V → Value
- Err.Op → Operation, Err.Msg → Message, Err.Err → Error
- CrashSystem.OS → OperatingSystem, Arch → Architecture
- TaskID → TaskIdentifier, TaskWithID → TaskWithIdentifier
- Ipc → IPC, BaseDir → BaseDirectory
- ServiceRuntime.Opts → Options
Return type changes:
- Options.Get, Config.Get → Result (was (any, bool))
- Embed.ReadDir → Result (was ([]fs.DirEntry, error))
- Translator.Translate, I18n.Translate → Result (was string)
Rule 6:
- data.go: propagate opts.Get failure, typed error for bad fs.FS
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 16:32:43 +00:00
|
|
|
if opt.Key == key {
|
|
|
|
|
return Result{opt.Value, true}
|
feat: AX primitives — Option/Options/Result, Data, Drive, full names
Core primitives:
- Option{K, V} atom, Options []Option universal input, Result[T] universal return
- Replaces With* functional options, Must*, For[T] patterns
- New(Options) returns *Core (no error — Core handles internally)
New subsystems:
- Data: embedded content mount registry (packages mount assets)
- Drive: transport handle registry stub (API, MCP, SSH, VPN)
Renames (AX principle — predictable names):
- ErrPan → ErrorPanic, ErrLog → ErrorLog, ErrSink → ErrorSink
- srv → service, cfg → config, err → error, emb → legacy accessor
- ErrorOptions/ErrorPanicOptions/NewErrorLog/NewErrorPanic removed
- Contract/ConfigService removed (unused)
RFC-025: Agent Experience updated to match implementation.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:22:30 +00:00
|
|
|
}
|
|
|
|
|
}
|
fix: AX audit round 5 — full naming, Result returns throughout
Renames (via GoLand refactor):
- Option.K → Key, Option.V → Value
- Err.Op → Operation, Err.Msg → Message, Err.Err → Error
- CrashSystem.OS → OperatingSystem, Arch → Architecture
- TaskID → TaskIdentifier, TaskWithID → TaskWithIdentifier
- Ipc → IPC, BaseDir → BaseDirectory
- ServiceRuntime.Opts → Options
Return type changes:
- Options.Get, Config.Get → Result (was (any, bool))
- Embed.ReadDir → Result (was ([]fs.DirEntry, error))
- Translator.Translate, I18n.Translate → Result (was string)
Rule 6:
- data.go: propagate opts.Get failure, typed error for bad fs.FS
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 16:32:43 +00:00
|
|
|
return Result{}
|
feat: AX primitives — Option/Options/Result, Data, Drive, full names
Core primitives:
- Option{K, V} atom, Options []Option universal input, Result[T] universal return
- Replaces With* functional options, Must*, For[T] patterns
- New(Options) returns *Core (no error — Core handles internally)
New subsystems:
- Data: embedded content mount registry (packages mount assets)
- Drive: transport handle registry stub (API, MCP, SSH, VPN)
Renames (AX principle — predictable names):
- ErrPan → ErrorPanic, ErrLog → ErrorLog, ErrSink → ErrorSink
- srv → service, cfg → config, err → error, emb → legacy accessor
- ErrorOptions/ErrorPanicOptions/NewErrorLog/NewErrorPanic removed
- Contract/ConfigService removed (unused)
RFC-025: Agent Experience updated to match implementation.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:22:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Has returns true if a key exists.
|
|
|
|
|
//
|
|
|
|
|
// if opts.Has("debug") { ... }
|
|
|
|
|
func (o Options) Has(key string) bool {
|
fix: AX audit round 5 — full naming, Result returns throughout
Renames (via GoLand refactor):
- Option.K → Key, Option.V → Value
- Err.Op → Operation, Err.Msg → Message, Err.Err → Error
- CrashSystem.OS → OperatingSystem, Arch → Architecture
- TaskID → TaskIdentifier, TaskWithID → TaskWithIdentifier
- Ipc → IPC, BaseDir → BaseDirectory
- ServiceRuntime.Opts → Options
Return type changes:
- Options.Get, Config.Get → Result (was (any, bool))
- Embed.ReadDir → Result (was ([]fs.DirEntry, error))
- Translator.Translate, I18n.Translate → Result (was string)
Rule 6:
- data.go: propagate opts.Get failure, typed error for bad fs.FS
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 16:32:43 +00:00
|
|
|
return o.Get(key).OK
|
feat: AX primitives — Option/Options/Result, Data, Drive, full names
Core primitives:
- Option{K, V} atom, Options []Option universal input, Result[T] universal return
- Replaces With* functional options, Must*, For[T] patterns
- New(Options) returns *Core (no error — Core handles internally)
New subsystems:
- Data: embedded content mount registry (packages mount assets)
- Drive: transport handle registry stub (API, MCP, SSH, VPN)
Renames (AX principle — predictable names):
- ErrPan → ErrorPanic, ErrLog → ErrorLog, ErrSink → ErrorSink
- srv → service, cfg → config, err → error, emb → legacy accessor
- ErrorOptions/ErrorPanicOptions/NewErrorLog/NewErrorPanic removed
- Contract/ConfigService removed (unused)
RFC-025: Agent Experience updated to match implementation.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:22:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// String retrieves a string value, empty string if missing.
|
|
|
|
|
//
|
|
|
|
|
// name := opts.String("name")
|
|
|
|
|
func (o Options) String(key string) string {
|
fix: AX audit round 5 — full naming, Result returns throughout
Renames (via GoLand refactor):
- Option.K → Key, Option.V → Value
- Err.Op → Operation, Err.Msg → Message, Err.Err → Error
- CrashSystem.OS → OperatingSystem, Arch → Architecture
- TaskID → TaskIdentifier, TaskWithID → TaskWithIdentifier
- Ipc → IPC, BaseDir → BaseDirectory
- ServiceRuntime.Opts → Options
Return type changes:
- Options.Get, Config.Get → Result (was (any, bool))
- Embed.ReadDir → Result (was ([]fs.DirEntry, error))
- Translator.Translate, I18n.Translate → Result (was string)
Rule 6:
- data.go: propagate opts.Get failure, typed error for bad fs.FS
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 16:32:43 +00:00
|
|
|
r := o.Get(key)
|
|
|
|
|
if !r.OK {
|
feat: AX primitives — Option/Options/Result, Data, Drive, full names
Core primitives:
- Option{K, V} atom, Options []Option universal input, Result[T] universal return
- Replaces With* functional options, Must*, For[T] patterns
- New(Options) returns *Core (no error — Core handles internally)
New subsystems:
- Data: embedded content mount registry (packages mount assets)
- Drive: transport handle registry stub (API, MCP, SSH, VPN)
Renames (AX principle — predictable names):
- ErrPan → ErrorPanic, ErrLog → ErrorLog, ErrSink → ErrorSink
- srv → service, cfg → config, err → error, emb → legacy accessor
- ErrorOptions/ErrorPanicOptions/NewErrorLog/NewErrorPanic removed
- Contract/ConfigService removed (unused)
RFC-025: Agent Experience updated to match implementation.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:22:30 +00:00
|
|
|
return ""
|
|
|
|
|
}
|
fix: AX audit round 5 — full naming, Result returns throughout
Renames (via GoLand refactor):
- Option.K → Key, Option.V → Value
- Err.Op → Operation, Err.Msg → Message, Err.Err → Error
- CrashSystem.OS → OperatingSystem, Arch → Architecture
- TaskID → TaskIdentifier, TaskWithID → TaskWithIdentifier
- Ipc → IPC, BaseDir → BaseDirectory
- ServiceRuntime.Opts → Options
Return type changes:
- Options.Get, Config.Get → Result (was (any, bool))
- Embed.ReadDir → Result (was ([]fs.DirEntry, error))
- Translator.Translate, I18n.Translate → Result (was string)
Rule 6:
- data.go: propagate opts.Get failure, typed error for bad fs.FS
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 16:32:43 +00:00
|
|
|
s, _ := r.Value.(string)
|
feat: AX primitives — Option/Options/Result, Data, Drive, full names
Core primitives:
- Option{K, V} atom, Options []Option universal input, Result[T] universal return
- Replaces With* functional options, Must*, For[T] patterns
- New(Options) returns *Core (no error — Core handles internally)
New subsystems:
- Data: embedded content mount registry (packages mount assets)
- Drive: transport handle registry stub (API, MCP, SSH, VPN)
Renames (AX principle — predictable names):
- ErrPan → ErrorPanic, ErrLog → ErrorLog, ErrSink → ErrorSink
- srv → service, cfg → config, err → error, emb → legacy accessor
- ErrorOptions/ErrorPanicOptions/NewErrorLog/NewErrorPanic removed
- Contract/ConfigService removed (unused)
RFC-025: Agent Experience updated to match implementation.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:22:30 +00:00
|
|
|
return s
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Int retrieves an int value, 0 if missing.
|
|
|
|
|
//
|
|
|
|
|
// port := opts.Int("port")
|
|
|
|
|
func (o Options) Int(key string) int {
|
fix: AX audit round 5 — full naming, Result returns throughout
Renames (via GoLand refactor):
- Option.K → Key, Option.V → Value
- Err.Op → Operation, Err.Msg → Message, Err.Err → Error
- CrashSystem.OS → OperatingSystem, Arch → Architecture
- TaskID → TaskIdentifier, TaskWithID → TaskWithIdentifier
- Ipc → IPC, BaseDir → BaseDirectory
- ServiceRuntime.Opts → Options
Return type changes:
- Options.Get, Config.Get → Result (was (any, bool))
- Embed.ReadDir → Result (was ([]fs.DirEntry, error))
- Translator.Translate, I18n.Translate → Result (was string)
Rule 6:
- data.go: propagate opts.Get failure, typed error for bad fs.FS
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 16:32:43 +00:00
|
|
|
r := o.Get(key)
|
|
|
|
|
if !r.OK {
|
feat: AX primitives — Option/Options/Result, Data, Drive, full names
Core primitives:
- Option{K, V} atom, Options []Option universal input, Result[T] universal return
- Replaces With* functional options, Must*, For[T] patterns
- New(Options) returns *Core (no error — Core handles internally)
New subsystems:
- Data: embedded content mount registry (packages mount assets)
- Drive: transport handle registry stub (API, MCP, SSH, VPN)
Renames (AX principle — predictable names):
- ErrPan → ErrorPanic, ErrLog → ErrorLog, ErrSink → ErrorSink
- srv → service, cfg → config, err → error, emb → legacy accessor
- ErrorOptions/ErrorPanicOptions/NewErrorLog/NewErrorPanic removed
- Contract/ConfigService removed (unused)
RFC-025: Agent Experience updated to match implementation.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:22:30 +00:00
|
|
|
return 0
|
|
|
|
|
}
|
fix: AX audit round 5 — full naming, Result returns throughout
Renames (via GoLand refactor):
- Option.K → Key, Option.V → Value
- Err.Op → Operation, Err.Msg → Message, Err.Err → Error
- CrashSystem.OS → OperatingSystem, Arch → Architecture
- TaskID → TaskIdentifier, TaskWithID → TaskWithIdentifier
- Ipc → IPC, BaseDir → BaseDirectory
- ServiceRuntime.Opts → Options
Return type changes:
- Options.Get, Config.Get → Result (was (any, bool))
- Embed.ReadDir → Result (was ([]fs.DirEntry, error))
- Translator.Translate, I18n.Translate → Result (was string)
Rule 6:
- data.go: propagate opts.Get failure, typed error for bad fs.FS
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 16:32:43 +00:00
|
|
|
i, _ := r.Value.(int)
|
feat: AX primitives — Option/Options/Result, Data, Drive, full names
Core primitives:
- Option{K, V} atom, Options []Option universal input, Result[T] universal return
- Replaces With* functional options, Must*, For[T] patterns
- New(Options) returns *Core (no error — Core handles internally)
New subsystems:
- Data: embedded content mount registry (packages mount assets)
- Drive: transport handle registry stub (API, MCP, SSH, VPN)
Renames (AX principle — predictable names):
- ErrPan → ErrorPanic, ErrLog → ErrorLog, ErrSink → ErrorSink
- srv → service, cfg → config, err → error, emb → legacy accessor
- ErrorOptions/ErrorPanicOptions/NewErrorLog/NewErrorPanic removed
- Contract/ConfigService removed (unused)
RFC-025: Agent Experience updated to match implementation.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:22:30 +00:00
|
|
|
return i
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Bool retrieves a bool value, false if missing.
|
|
|
|
|
//
|
|
|
|
|
// debug := opts.Bool("debug")
|
|
|
|
|
func (o Options) Bool(key string) bool {
|
fix: AX audit round 5 — full naming, Result returns throughout
Renames (via GoLand refactor):
- Option.K → Key, Option.V → Value
- Err.Op → Operation, Err.Msg → Message, Err.Err → Error
- CrashSystem.OS → OperatingSystem, Arch → Architecture
- TaskID → TaskIdentifier, TaskWithID → TaskWithIdentifier
- Ipc → IPC, BaseDir → BaseDirectory
- ServiceRuntime.Opts → Options
Return type changes:
- Options.Get, Config.Get → Result (was (any, bool))
- Embed.ReadDir → Result (was ([]fs.DirEntry, error))
- Translator.Translate, I18n.Translate → Result (was string)
Rule 6:
- data.go: propagate opts.Get failure, typed error for bad fs.FS
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 16:32:43 +00:00
|
|
|
r := o.Get(key)
|
|
|
|
|
if !r.OK {
|
feat: AX primitives — Option/Options/Result, Data, Drive, full names
Core primitives:
- Option{K, V} atom, Options []Option universal input, Result[T] universal return
- Replaces With* functional options, Must*, For[T] patterns
- New(Options) returns *Core (no error — Core handles internally)
New subsystems:
- Data: embedded content mount registry (packages mount assets)
- Drive: transport handle registry stub (API, MCP, SSH, VPN)
Renames (AX principle — predictable names):
- ErrPan → ErrorPanic, ErrLog → ErrorLog, ErrSink → ErrorSink
- srv → service, cfg → config, err → error, emb → legacy accessor
- ErrorOptions/ErrorPanicOptions/NewErrorLog/NewErrorPanic removed
- Contract/ConfigService removed (unused)
RFC-025: Agent Experience updated to match implementation.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:22:30 +00:00
|
|
|
return false
|
|
|
|
|
}
|
fix: AX audit round 5 — full naming, Result returns throughout
Renames (via GoLand refactor):
- Option.K → Key, Option.V → Value
- Err.Op → Operation, Err.Msg → Message, Err.Err → Error
- CrashSystem.OS → OperatingSystem, Arch → Architecture
- TaskID → TaskIdentifier, TaskWithID → TaskWithIdentifier
- Ipc → IPC, BaseDir → BaseDirectory
- ServiceRuntime.Opts → Options
Return type changes:
- Options.Get, Config.Get → Result (was (any, bool))
- Embed.ReadDir → Result (was ([]fs.DirEntry, error))
- Translator.Translate, I18n.Translate → Result (was string)
Rule 6:
- data.go: propagate opts.Get failure, typed error for bad fs.FS
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 16:32:43 +00:00
|
|
|
b, _ := r.Value.(bool)
|
feat: AX primitives — Option/Options/Result, Data, Drive, full names
Core primitives:
- Option{K, V} atom, Options []Option universal input, Result[T] universal return
- Replaces With* functional options, Must*, For[T] patterns
- New(Options) returns *Core (no error — Core handles internally)
New subsystems:
- Data: embedded content mount registry (packages mount assets)
- Drive: transport handle registry stub (API, MCP, SSH, VPN)
Renames (AX principle — predictable names):
- ErrPan → ErrorPanic, ErrLog → ErrorLog, ErrSink → ErrorSink
- srv → service, cfg → config, err → error, emb → legacy accessor
- ErrorOptions/ErrorPanicOptions/NewErrorLog/NewErrorPanic removed
- Contract/ConfigService removed (unused)
RFC-025: Agent Experience updated to match implementation.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:22:30 +00:00
|
|
|
return b
|
|
|
|
|
}
|
2026-03-24 19:17:12 +00:00
|
|
|
|
|
|
|
|
// Len returns the number of options.
|
|
|
|
|
func (o Options) Len() int {
|
|
|
|
|
return len(o.items)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Items returns a copy of the underlying option slice.
|
|
|
|
|
func (o Options) Items() []Option {
|
|
|
|
|
cp := make([]Option, len(o.items))
|
|
|
|
|
copy(cp, o.items)
|
|
|
|
|
return cp
|
|
|
|
|
}
|