mirror of
https://github.com/boshu2/agentops.git
synced 2026-09-14 15:08:13 +08:00
57ece9fb7b
Add explicit, recoverable private context routing through `ao config context`, binding native source, owner, task, model and destination to existing policy and external storage. Recovery reads the original Beads maintenance anchor; configuration reports native access enforcement as unattested. Add `ao provenance verify-judgments` to check required review profiles against exact native transcript receipts, independent subject and acceptance, distinct contexts, completion and permitted providers. Requested identity and unreported effort do not count as runtime evidence. The verdict schema is unchanged. Repair the existing cleanup test: a 0.3-second budget could expire during preparation before either fixture process started. A separate controlled-delay test now proves preparation cannot renew that deadline. The running-cleanup case requires parent/child readiness, preserved partial output, the postlaunch cleanup result and both processes stopped within its existing four-second bound. Production timeout behavior is unchanged. Validation: fresh author-distinct review passed the exact 55-path final subject and all T05/T21 acceptance. The complete local Bats run passed (1,333 passed, two existing skips), as did Go build/vet/test/race, all 72 full-mode gates, the aggregate and generated-output checks. Ubuntu/Windows CI, security and both installation jobs passed on the final commit. The final evidence scan found no new orphaned bindings; 73 historical bindings remain preserved. Earlier failed results and private evidence remain outside the PR.
74 lines
2.2 KiB
Go
74 lines
2.2 KiB
Go
package config
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
)
|
|
|
|
// showEnvironmentKeys deliberately omits AGENTOPS_NO_SC: it only toggles
|
|
// Search.UseSmartConnections, a dead field nothing outside config plumbing
|
|
// consumes.
|
|
var showEnvironmentKeys = []string{
|
|
"AGENTOPS_CONFIG", "AGENTOPS_OUTPUT", "AGENTOPS_BASE_DIR", "AGENTOPS_VERBOSE",
|
|
}
|
|
|
|
type ConfigFiles struct {
|
|
HomePath string
|
|
HomeExists bool
|
|
ProjectPath string
|
|
ProjectExists bool
|
|
// HomeReadPath is the home-layer path actually consulted for reads. It
|
|
// equals HomePath normally; when the deprecated ~/.agentops/config.yaml
|
|
// fallback is active it is that legacy path and HomeLegacy is true.
|
|
HomeReadPath string
|
|
HomeLegacy bool
|
|
// ProjectReadPath mirrors HomeReadPath for the project layer
|
|
// (legacy fallback: ./.agentops/config.yaml).
|
|
ProjectReadPath string
|
|
ProjectLegacy bool
|
|
}
|
|
|
|
type ShowResult struct {
|
|
Resolved *ResolvedConfig
|
|
ConfigFiles ConfigFiles
|
|
Environment map[string]string
|
|
}
|
|
|
|
type CommandGateway interface {
|
|
Resolve(string, bool) *ResolvedConfig
|
|
Files() (ConfigFiles, error)
|
|
Environment([]string) map[string]string
|
|
}
|
|
|
|
type CommandService struct {
|
|
gateway CommandGateway
|
|
}
|
|
|
|
func NewCommandService(gateway CommandGateway) *CommandService {
|
|
return &CommandService{gateway: gateway}
|
|
}
|
|
|
|
func (service *CommandService) Show(_ context.Context, output string, verbose bool) (ShowResult, error) {
|
|
files, err := service.gateway.Files()
|
|
if err != nil {
|
|
return ShowResult{}, err
|
|
}
|
|
// Overlay the read paths actually consulted (config.go owns the legacy
|
|
// fallback) so the files panel reports the file that was really loaded
|
|
// instead of contradicting the deprecation warning.
|
|
files.HomeReadPath, files.HomeLegacy = homeConfigReadInfo()
|
|
files.ProjectReadPath, files.ProjectLegacy = projectConfigReadInfo()
|
|
return ShowResult{
|
|
Resolved: service.gateway.Resolve(output, verbose), ConfigFiles: files,
|
|
Environment: service.gateway.Environment(showEnvironmentKeys),
|
|
}, nil
|
|
}
|
|
|
|
func (service *CommandService) Context(ctx context.Context, req ContextRequest) (ContextResult, error) {
|
|
gateway, ok := service.gateway.(ContextGateway)
|
|
if !ok {
|
|
return ContextResult{}, fmt.Errorf("native context adapter unavailable")
|
|
}
|
|
return ResolveContext(ctx, gateway, req)
|
|
}
|