agent/pkg/agentic/transport_example_test.go
Snider 537226bd4d feat: AX v0.8.0 upgrade — Core features + quality gates
AX Quality Gates (RFC-025):
- Eliminate os/exec from all test + production code (12+ files)
- Eliminate encoding/json from all test files (15 files, 66 occurrences)
- Eliminate os from all test files except TestMain (Go runtime contract)
- Eliminate path/filepath, net/url from all files
- String concat: 39 violations replaced with core.Concat()
- Test naming AX-7: 264 test functions renamed across all 6 packages
- Example test 1:1 coverage complete

Core Features Adopted:
- Task Composition: agent.completion pipeline (QA → PR → Verify → Ingest → Poke)
- PerformAsync: completion pipeline runs with WaitGroup + progress tracking
- Config: agents.yaml loaded once, feature flags (auto-qa/pr/merge/ingest)
- Named Locks: c.Lock("drain") for queue serialisation
- Registry: workspace state with cross-package QUERY access
- QUERY: c.QUERY(WorkspaceQuery{Status: "running"}) for cross-service queries
- Action descriptions: 25+ Actions self-documenting
- Data mounts: prompts/tasks/flows/personas/workspaces via c.Data()
- Content Actions: agentic.prompt/task/flow/persona callable via IPC
- Drive endpoints: forge + brain registered with tokens
- Drive REST helpers: DriveGet/DrivePost/DriveDo for Drive-aware HTTP
- HandleIPCEvents: auto-discovered by WithService (no manual wiring)
- Entitlement: frozen-queue gate on write Actions
- CLI dispatch: workspace dispatch wired to real dispatch method
- CLI: --quiet/-q and --debug/-d global flags
- CLI: banner, version, check (with service/action/command counts), env
- main.go: minimal — 5 services + c.Run(), no os import
- cmd tests: 84.2% coverage (was 0%)

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-26 06:38:02 +00:00

51 lines
1.3 KiB
Go

// SPDX-License-Identifier: EUPL-1.2
package agentic_test
import (
"dappco.re/go/agent/pkg/agentic"
core "dappco.re/go/core"
)
func ExampleRegisterHTTPTransport() {
c := core.New()
agentic.RegisterHTTPTransport(c)
// HTTP and HTTPS protocols are now registered with Core API.
core.Println(c.API().Protocols())
// Output: [http https]
}
func ExampleDriveGet() {
c := core.New()
// Register a Drive endpoint
c.Drive().New(core.NewOptions(
core.Option{Key: "name", Value: "forge"},
core.Option{Key: "transport", Value: "https://forge.lthn.ai"},
core.Option{Key: "token", Value: "my-token"},
))
// DriveGet reads base URL + token from the Drive handle.
// r := agentic.DriveGet(c, "forge", "/api/v1/repos/core/go-io", "token")
// if r.OK { body := r.Value.(string) }
// Verify Drive is registered
core.Println(c.Drive().Has("forge"))
// Output: true
}
func ExampleDrivePost() {
c := core.New()
c.Drive().New(core.NewOptions(
core.Option{Key: "name", Value: "brain"},
core.Option{Key: "transport", Value: "https://api.lthn.sh"},
core.Option{Key: "token", Value: "brain-key"},
))
// DrivePost reads base URL + token from the Drive handle.
// r := agentic.DrivePost(c, "brain", "/v1/brain/recall", body, "Bearer")
core.Println(c.Drive().Has("brain"))
// Output: true
}