feat(v0.8.0): full AX migration — ServiceRuntime, Actions, quality gates, transport
go-process:
- Register factory, Result lifecycle, 5 named Action handlers
- Start/Run/StartWithOptions/RunWithOptions all return core.Result
- core.ID() replaces fmt.Sprintf, core.As replaces errors.As
core/agent:
- PrepSubsystem + monitor.Subsystem + setup.Service embed ServiceRuntime[T]
- 22 named Actions + agent.completion Task pipeline in OnStartup
- ChannelNotifier removed — all IPC via c.ACTION(messages.X{})
- proc.go: all methods via s.Core().Process(), returns core.Result
- status.go: WriteAtomic + JSONMarshalString
- paths.go: Fs.NewUnrestricted() replaces unsafe.Pointer
- transport.go: ONE net/http file — HTTPGet/HTTPPost/HTTPDo/MCP transport
- All disallowed imports eliminated from source files (13 quality gates)
- String concat eliminated — core.Concat() throughout
- 1:1 _test.go + _example_test.go for every source file
- Reference docs synced from core/go v0.8.0
- RFC-025 updated with net/http, net/url, io/fs quality gates
- lib.go: io/fs eliminated via Data.ListNames, Array[T].Deduplicate
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-26 01:27:46 +00:00
|
|
|
// SPDX-License-Identifier: EUPL-1.2
|
|
|
|
|
|
|
|
|
|
package lib
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
core "dappco.re/go/core"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func ExamplePrompt() {
|
|
|
|
|
r := Prompt("coding")
|
|
|
|
|
core.Println(r.OK)
|
|
|
|
|
// Output: true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ExampleTask() {
|
|
|
|
|
r := Task("bug-fix")
|
|
|
|
|
core.Println(r.OK)
|
|
|
|
|
// Output: true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ExampleFlow() {
|
|
|
|
|
r := Flow("go")
|
|
|
|
|
core.Println(r.OK)
|
|
|
|
|
// Output: true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ExampleListPrompts() {
|
|
|
|
|
prompts := ListPrompts()
|
|
|
|
|
core.Println(len(prompts) > 0)
|
|
|
|
|
// Output: true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ExampleListFlows() {
|
|
|
|
|
flows := ListFlows()
|
|
|
|
|
core.Println(len(flows) > 0)
|
|
|
|
|
// Output: true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ExampleListTasks() {
|
|
|
|
|
tasks := ListTasks()
|
|
|
|
|
core.Println(len(tasks) > 0)
|
|
|
|
|
// Output: true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ExampleListWorkspaces() {
|
|
|
|
|
workspaces := ListWorkspaces()
|
|
|
|
|
core.Println(len(workspaces) > 0)
|
|
|
|
|
// Output: true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ExampleListPersonas() {
|
|
|
|
|
personas := ListPersonas()
|
|
|
|
|
core.Println(len(personas) > 0)
|
|
|
|
|
// Output: true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ExampleTemplate() {
|
|
|
|
|
r := Template("coding")
|
|
|
|
|
core.Println(r.OK)
|
|
|
|
|
// Output: true
|
|
|
|
|
}
|
2026-03-26 06:38:02 +00:00
|
|
|
|
|
|
|
|
func ExampleMountData() {
|
|
|
|
|
c := core.New()
|
|
|
|
|
MountData(c)
|
|
|
|
|
|
|
|
|
|
// Other services can now access content via Core
|
|
|
|
|
r := c.Data().ReadString("prompts/coding.md")
|
|
|
|
|
core.Println(r.OK)
|
|
|
|
|
// Output: true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ExampleTaskBundle() {
|
|
|
|
|
r := TaskBundle("code/review")
|
|
|
|
|
if r.OK {
|
|
|
|
|
b := r.Value.(Bundle)
|
|
|
|
|
core.Println(b.Main != "")
|
|
|
|
|
core.Println(len(b.Files) > 0)
|
|
|
|
|
}
|
|
|
|
|
// Output:
|
|
|
|
|
// true
|
|
|
|
|
// true
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-30 00:20:03 +00:00
|
|
|
func ExampleWorkspaceData() {
|
|
|
|
|
data := &WorkspaceData{
|
|
|
|
|
Repo: "go-io",
|
|
|
|
|
Task: "fix tests",
|
|
|
|
|
Agent: "codex",
|
|
|
|
|
BuildCmd: "go build ./...",
|
|
|
|
|
}
|
|
|
|
|
core.Println(data.Repo, data.Agent, data.BuildCmd)
|
|
|
|
|
// Output: go-io codex go build ./...
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-26 06:38:02 +00:00
|
|
|
func ExampleExtractWorkspace() {
|
|
|
|
|
dir := (&core.Fs{}).NewUnrestricted().TempDir("example-ws")
|
|
|
|
|
defer (&core.Fs{}).NewUnrestricted().DeleteAll(dir)
|
|
|
|
|
|
|
|
|
|
err := ExtractWorkspace("default", dir, &WorkspaceData{
|
|
|
|
|
Repo: "go-io", Task: "fix tests",
|
|
|
|
|
})
|
|
|
|
|
core.Println(err == nil)
|
|
|
|
|
// Output: true
|
|
|
|
|
}
|