The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
Add Senpi installer, discovery and CLI wiring (--harness omo)
Clauded432aa4af806
diff --git a/cli/beacon/cmd/endpoint_diagnostics.go b/cli/beacon/cmd/endpoint_diagnostics.goindex 66330c70..fb3ee91a 100644--- a/cli/beacon/cmd/endpoint_diagnostics.go+++ b/cli/beacon/cmd/endpoint_diagnostics.go@@ -957,7 +957,7 @@ var userScopeOnlyHookTargets = map[string]bool{}func allHookTargetsForLevel() []string {- all := []string{"cursor", "codex", "vscode", "factory", "opencode", "openhands", "kiro", "cline", "pi", "omp", "prime", "openclaw", "grok", "qwen", "muse", "hermes", "devin-cli", "devin-desktop", "antigravity"}+ all := []string{"cursor", "codex", "vscode", "factory", "opencode", "openhands", "kiro", "cline", "pi", "omp", "prime", "omo", "openclaw", "grok", "qwen", "muse", "hermes", "devin-cli", "devin-desktop", "antigravity"}if endpointOpts.hookLevel != "project" {return all}@@ -1017,6 +1017,9 @@ func hookStatusesWithConfig(targets []string, cfg endpointconfig.Config) map[strcase "prime":status := endpointhooks.PrimeHookStatus(endpointhooks.PrimeOptions{Level: endpointhooks.Level(endpointOpts.hookLevel), LogPath: cfg.LogPath, UserMode: cfg.UserMode})statuses[name] = hookTargetResult{Target: name, Status: targetStatus(status.Installed), Installed: status.Installed, Message: status.Message, Path: status.ExtensionPath, Raw: status}+ case "omo":+ status := endpointhooks.OmoHookStatus(endpointhooks.OmoOptions{Level: endpointhooks.Level(endpointOpts.hookLevel), LogPath: cfg.LogPath, UserMode: cfg.UserMode})+ statuses[name] = hookTargetResult{Target: name, Status: targetStatus(status.Installed), Installed: status.Installed, Message: status.Message, Path: status.ExtensionPath, Raw: status}case "openclaw":status := endpointhooks.OpenClawHookStatus(endpointhooks.OpenClawOptions{Level: endpointhooks.Level(endpointOpts.hookLevel), LogPath: cfg.LogPath, UserMode: cfg.UserMode})statuses[name] = hookTargetResult{Target: name, Status: targetStatus(status.Installed), Installed: status.Installed, Message: status.Message, Path: status.PluginPath, Raw: status}diff --git a/cli/beacon/cmd/endpoint_hooks.go b/cli/beacon/cmd/endpoint_hooks.goindex 9f0e87a4..cabe2686 100644--- a/cli/beacon/cmd/endpoint_hooks.go+++ b/cli/beacon/cmd/endpoint_hooks.go@@ -180,6 +180,16 @@ func installEndpointHookTarget(name string, cfg endpointconfig.Config) error {return err}fmt.Printf("Prime Agent extension installed: %s\n", status.ExtensionPath)+ case "omo":+ status, err := endpointhooks.InstallOmo(endpointhooks.OmoOptions{+ Level: endpointhooks.Level(endpointOpts.hookLevel),+ LogPath: cfg.LogPath,+ UserMode: cfg.UserMode,+ })+ if err != nil {+ return err+ }+ fmt.Printf("Senpi extension installed: %s\n", status.ExtensionPath)case "openclaw":status, err := endpointhooks.InstallOpenClaw(endpointhooks.OpenClawOptions{Level: endpointhooks.Level(endpointOpts.hookLevel),@@ -454,6 +464,16 @@ func uninstallEndpointHookTarget(name string, cfg endpointconfig.Config) error {return err}fmt.Println(status.Message)+ case "omo":+ status, err := endpointhooks.UninstallOmo(endpointhooks.OmoOptions{+ Level: endpointhooks.Level(endpointOpts.hookLevel),+ LogPath: cfg.LogPath,+ UserMode: cfg.UserMode,+ })+ if err != nil {+ return err+ }+ fmt.Println(status.Message)case "openclaw":status, err := endpointhooks.UninstallOpenClaw(endpointhooks.OpenClawOptions{Level: endpointhooks.Level(endpointOpts.hookLevel),@@ -626,6 +646,12 @@ func runEndpointHooksStatus(cmd *cobra.Command, args []string) error {LogPath: cfg.LogPath,UserMode: cfg.UserMode,})+ case "omo":+ statuses["omo"] = endpointhooks.OmoHookStatus(endpointhooks.OmoOptions{+ Level: endpointhooks.Level(endpointOpts.hookLevel),+ LogPath: cfg.LogPath,+ UserMode: cfg.UserMode,+ })case "openclaw":statuses["openclaw"] = endpointhooks.OpenClawHookStatus(endpointhooks.OpenClawOptions{Level: endpointhooks.Level(endpointOpts.hookLevel),@@ -730,6 +756,10 @@ func runEndpointHooksStatus(cmd *cobra.Command, args []string) error {status := statuses["prime"].(endpointhooks.PrimeStatus)fmt.Printf("Prime Agent extension: installed=%t path=%s\n", status.Installed, status.ExtensionPath)fmt.Println(status.Message)+ case "omo":+ status := statuses["omo"].(endpointhooks.OmoStatus)+ fmt.Printf("Senpi extension: installed=%t path=%s\n", status.Installed, status.ExtensionPath)+ fmt.Println(status.Message)case "openclaw":status := statuses["openclaw"].(endpointhooks.OpenClawStatus)fmt.Printf("OpenClaw plugin: installed=%t path=%s\n", status.Installed, status.PluginPath)diff --git a/cli/beacon/cmd/endpoint_hooks_repair.go b/cli/beacon/cmd/endpoint_hooks_repair.goindex be64fed3..22069db4 100644--- a/cli/beacon/cmd/endpoint_hooks_repair.go+++ b/cli/beacon/cmd/endpoint_hooks_repair.go@@ -148,7 +148,7 @@ func installedHookTargetsForUser(homeDir, logPath string) ([]string, error) {}func repairTargetOrder() []string {- return []string{"claude", "codex", "cursor", "vscode", "factory", "opencode", "openhands", "kiro", "cline", "pi", "omp", "prime", "openclaw", "grok", "qwen", "muse", "hermes", "devin-cli", "devin-desktop", "antigravity"}+ return []string{"claude", "codex", "cursor", "vscode", "factory", "opencode", "openhands", "kiro", "cline", "pi", "omp", "prime", "omo", "openclaw", "grok", "qwen", "muse", "hermes", "devin-cli", "devin-desktop", "antigravity"}}// withUserHome runs fn as if it were executing inside another user's profile.diff --git a/cli/beacon/cmd/endpoint_targets.go b/cli/beacon/cmd/endpoint_targets.goindex e316451c..a48ed907 100644--- a/cli/beacon/cmd/endpoint_targets.go+++ b/cli/beacon/cmd/endpoint_targets.go@@ -65,6 +65,19 @@ var harnessTargets = []harnessTarget{// runtime it names. Prime Intellect's model names are deliberately not aliases -- accepting one// would let someone ask to install an extension for a model.{name: "prime", endpointKind: endpointTargetHook, endpointAliases: []string{"prime", "prime-agent", "prime_agent", "primeagent"}, hookAliases: []string{"prime", "prime-agent", "prime_agent", "primeagent"}},+ // Senpi (the standalone edition of oh-my-openagent) is a fourth row rather than an alias of any+ // of the above, for the reason Prime Agent is a third: it is a separately installed product with+ // its own config root, and folding a spelling into another runtime would install that runtime's+ // extension while the operator asked for this one. "omo" is the --platform value, the binary the+ // operator runs, and the config directory Beacon installs into; "omo_senpi" and "omo-senpi" are+ // the canonical harness name events are written under, so a row read out of the runtime log and+ // passed back to --harness resolves to the runtime it names. Bare "senpi" and+ // "oh-my-openagent" are deliberately not aliases: upstream Senpi is a separately installable+ // engine a user can run without OMO at all, and "oh-my-openagent" also names OMO's OpenCode and+ // Codex CLI editions, which install through the existing "opencode" and hook-config paths rather+ // than through this extension -- accepting either spelling here would claim a name that belongs+ // to a different install, exactly the reason NormalizeHarnessName keeps them unmapped too.+ {name: "omo", endpointKind: endpointTargetHook, endpointAliases: []string{"omo", "omo_senpi", "omo-senpi"}, hookAliases: []string{"omo", "omo_senpi", "omo-senpi"}},// OpenHands. "open-hands" is accepted because the product is written as two words as often as// one, and normalizeHarnessKey folds "open_hands" onto it. "openhands" is also the canonical// harness name events are written under, so a row read out of the runtime log and passed backdiff --git a/cli/beacon/internal/endpoint/harness/harness.go b/cli/beacon/internal/endpoint/harness/harness.goindex cd0e6ea8..a9b6618d 100644--- a/cli/beacon/internal/endpoint/harness/harness.go+++ b/cli/beacon/internal/endpoint/harness/harness.go@@ -61,6 +61,7 @@ func DiscoverAll() []Harness {DiscoverOmp(),DiscoverOpenClaw(),DiscoverPrime(),+ DiscoverOmo(),DiscoverFx(),DiscoverQwen(),DiscoverHermes(),diff --git a/cli/beacon/internal/endpoint/harness/omo.go b/cli/beacon/internal/endpoint/harness/omo.gonew file mode 100644index 00000000..f2cf382f--- /dev/null+++ b/cli/beacon/internal/endpoint/harness/omo.go@@ -0,0 +1,79 @@+package harness++import (+ "os"+ "path/filepath"+ "strings"++ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/hooks"+)++// DiscoverOmo reports whether Senpi (the standalone edition of oh-my-openagent) is present and+// whether Beacon is observing it.+//+// Its capability is "plugin" rather than "hooks" or "otel_env" for the same reason Pi's, Oh My+// Pi's and Prime Agent's are: it has neither surface -- no hooks configuration file to merge into+// and no OpenTelemetry export to point at the local collector. Its documented observation surface+// is the TypeScript extension API, so what Beacon installs is one extension file, and what this+// function reports is the state of that file.+func DiscoverOmo() Harness {+ h := Harness{Name: "omo_senpi", DisplayName: "Senpi", Capability: "plugin"}+ // The distributed command is `omo`. It is deliberately probed for over `senpi`: `senpi` is the+ // upstream engine's own binary name, and a machine could have plain, un-OMO'd Senpi installed+ // without oh-my-openagent at all -- reporting that as this harness would claim an install this+ // function did not verify.+ detectExecutable(&h, "omo")++ // A missing home directory leaves the config path empty rather than resolving to a relative+ // path like ".omo/agent/extensions/beacon.ts", which would make discovery report on whatever+ // happens to sit under the current working directory. DiscoverPi, DiscoverOmp and DiscoverPrime+ // guard the same way.+ extensionPath, err := hooks.OmoExtensionPath(hooks.LevelUser)+ if err != nil {+ h.TelemetryStatus = TelemetryMissing+ h.Message = "Senpi extension directory could not be resolved: " + err.Error()+ return h+ }+ h.ConfigPath = extensionPath++ // Senpi installed through the omo-ai npm package, into any directory this process did not+ // inherit on PATH, is still detectable by its state directory -- a shell alias, a version+ // manager, or a per-project install all hide the binary while the directory remains. Treating+ // that directory as evidence keeps `endpoint discover` from reporting "not detected" for a+ // runtime the operator is actively using, the same fallback the Pi, Oh My Pi, Prime Agent,+ // opencode, Cursor and Hermes probes make.+ //+ // The directory checked is the one the resolved extension path lives under rather than a+ // rebuilt `~/.omo/agent`, so an OMO_CODING_AGENT_DIR override (or its legacy SENPI_/PI_ fallback)+ // is detected where it actually is instead of being missed at the default location.+ if !h.Detected && dirExists(filepath.Dir(filepath.Dir(extensionPath))) {+ h.Detected = true+ }++ h.TelemetryStatus, h.Message = omoStatus(extensionPath)+ return h+}++// omoStatus classifies the extension file at path.+//+// The middle case is the one worth spelling out: a beacon.ts that exists without Beacon's marker+// is somebody else's extension sharing the filename, so it is reported as disabled rather than+// enabled. Reporting it as enabled would claim telemetry Beacon is not collecting, and install+// refuses to overwrite the same file for the same reason.+//+// A file carrying Pi's, Oh My Pi's or Prime Agent's marker at this path is also not a Senpi+// install. The four runtimes read different directories today, so it should not happen -- but the+// markers are distinct precisely so that the answer does not depend on that staying true.+func omoStatus(path string) (TelemetryStatus, string) {+ data, err := os.ReadFile(path)+ if err != nil {+ if os.IsNotExist(err) {+ return TelemetryMissing, "Beacon Senpi extension was not found"+ }+ return TelemetryMissing, err.Error()+ }+ if !strings.Contains(string(data), hooks.OmoManagedExtensionMarker) {+ return TelemetryDisabled, "Senpi extension file exists but Beacon endpoint extension was not found"+ }+ return TelemetryEnabled, "Beacon Senpi extension is configured"+}diff --git a/cli/beacon/internal/endpoint/harness/omo_test.go b/cli/beacon/internal/endpoint/harness/omo_test.gonew file mode 100644index 00000000..62ce371d--- /dev/null+++ b/cli/beacon/internal/endpoint/harness/omo_test.go@@ -0,0 +1,176 @@+package harness++import (+ "os"+ "path/filepath"+ "testing"++ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/hooks"+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/testenv"+ "github.com/asymptote-labs/agent-beacon/pkg/asymptoteobserve"+)++// writeOmoExtension creates a user-level Senpi extension file with the given contents.+func writeOmoExtension(t *testing.T, home, contents string) string {+ t.Helper()+ path := filepath.Join(home, ".omo", "agent", "extensions", "beacon.ts")+ if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {+ t.Fatalf("mkdir omo extensions dir: %v", err)+ }+ if err := os.WriteFile(path, []byte(contents), 0644); err != nil {+ t.Fatalf("write omo extension: %v", err)+ }+ return path+}++// Every Senpi discovery test empties PATH and the variables that move its extension directory.+// Without that, the result depends on whether the machine running the suite happens to have `omo`+// installed -- exactly the kind of environment-dependent assertion the repo's deterministic-test+// rule exists to prevent.+func setupOmoDiscovery(t *testing.T) string {+ t.Helper()+ home := t.TempDir()+ testenv.SetHome(t, home)+ t.Setenv("PATH", t.TempDir())+ t.Setenv("OMO_CODING_AGENT_DIR", "")+ t.Setenv("SENPI_CODING_AGENT_DIR", "")+ t.Setenv("PI_CODING_AGENT_DIR", "")+ return home+}++func TestDiscoverOmoReportsMissingExtension(t *testing.T) {+ home := setupOmoDiscovery(t)++ h := DiscoverOmo()+ if h.Detected {+ t.Fatalf("DiscoverOmo detected Senpi with no executable and no state directory: %#v", h)+ }+ want := filepath.Join(home, ".omo", "agent", "extensions", "beacon.ts")+ if h.ConfigPath != want {+ t.Fatalf("ConfigPath = %q, want %q", h.ConfigPath, want)+ }+ if h.TelemetryStatus != TelemetryMissing {+ t.Fatalf("TelemetryStatus = %q, want %q", h.TelemetryStatus, TelemetryMissing)+ }+ if h.Capability != "plugin" {+ t.Fatalf("Capability = %q, want %q -- Senpi has no hooks file and no OTel export, so the "++ "integration is extension-shaped", h.Capability, "plugin")+ }+}++// Senpi installed through the omo-ai npm package into a directory this process did not inherit on+// PATH is not visible as an executable, so the state directory has to count as evidence. The+// alternative is reporting "not detected" for a runtime the operator is actively running, which+// reads as "Beacon cannot see this" when the truth is "Beacon has not been installed into it yet".+func TestDiscoverOmoTreatsTheStateDirectoryAsEvidence(t *testing.T) {+ home := setupOmoDiscovery(t)+ if err := os.MkdirAll(filepath.Join(home, ".omo", "agent"), 0755); err != nil {+ t.Fatal(err)+ }++ h := DiscoverOmo()+ if !h.Detected {+ t.Fatal("DiscoverOmo reported not detected with a Senpi agent directory present")+ }+ if h.TelemetryStatus != TelemetryMissing {+ t.Fatalf("TelemetryStatus = %q, want %q -- the runtime is present but Beacon is not "++ "installed into it", h.TelemetryStatus, TelemetryMissing)+ }+}++// The directory checked is the one the resolved extension path lives under, not a rebuilt+// `~/.omo/agent`, so an overridden install is detected where it actually is rather than being+// missed at the default location.+func TestDiscoverOmoFollowsTheAgentDirOverride(t *testing.T) {+ home := setupOmoDiscovery(t)+ agentDir := filepath.Join(home, "elsewhere", "agent")+ t.Setenv("OMO_CODING_AGENT_DIR", agentDir)+ if err := os.MkdirAll(agentDir, 0755); err != nil {+ t.Fatal(err)+ }++ h := DiscoverOmo()+ want := filepath.Join(agentDir, "extensions", "beacon.ts")+ if h.ConfigPath != want {+ t.Fatalf("ConfigPath = %q, want %q", h.ConfigPath, want)+ }+ if !h.Detected {+ t.Fatal("DiscoverOmo reported not detected with an overridden agent directory present")+ }+}++func TestDiscoverOmoReportsAManagedExtensionAsEnabled(t *testing.T) {+ home := setupOmoDiscovery(t)+ writeOmoExtension(t, home, "// "+hooks.OmoManagedExtensionMarker+"\nexport default function () {}\n")++ h := DiscoverOmo()+ if h.TelemetryStatus != TelemetryEnabled {+ t.Fatalf("TelemetryStatus = %q, want %q", h.TelemetryStatus, TelemetryEnabled)+ }+ if !h.Detected {+ t.Fatal("an installed Beacon extension implies the runtime is present")+ }+}++// Somebody else's extension can legitimately be called beacon.ts. Reporting it as enabled would+// claim telemetry Beacon is not collecting -- and install refuses to overwrite it for the same+// reason, so "disabled" is the honest reading rather than a pessimistic one.+func TestDiscoverOmoReportsAnUnmanagedExtensionAsDisabled(t *testing.T) {+ home := setupOmoDiscovery(t)+ writeOmoExtension(t, home, "// somebody else's extension\nexport default function () {}\n")++ h := DiscoverOmo()+ if h.TelemetryStatus != TelemetryDisabled {+ t.Fatalf("TelemetryStatus = %q, want %q", h.TelemetryStatus, TelemetryDisabled)+ }+}++// A sibling runtime's extension is not a Senpi install. The four read different directories today,+// so this should not arise -- but the markers are distinct precisely so the answer does not depend+// on that staying true.+func TestDiscoverOmoDoesNotAcceptASiblingsMarker(t *testing.T) {+ for name, marker := range map[string]string{+ "pi": hooks.PiManagedExtensionMarker,+ "omp": hooks.OmpManagedExtensionMarker,+ "prime": hooks.PrimeManagedExtensionMarker,+ } {+ t.Run(name, func(t *testing.T) {+ home := setupOmoDiscovery(t)+ writeOmoExtension(t, home, "// "+marker+"\nexport default function () {}\n")++ if h := DiscoverOmo(); h.TelemetryStatus == TelemetryEnabled {+ t.Fatalf("DiscoverOmo reported %s's extension as a Senpi install", name)+ }+ })+ }+}++// The harness name discovery reports must be the canonical one events are written under, or the+// dashboard groups a runtime's discovery row and its telemetry rows separately.+func TestDiscoverOmoUsesTheCanonicalHarnessName(t *testing.T) {+ setupOmoDiscovery(t)++ h := DiscoverOmo()+ if got := asymptoteobserve.NormalizeHarnessName(h.Name); got != h.Name {+ t.Fatalf("DiscoverOmo reports %q, which normalizes to %q; discovery and telemetry would "++ "not join", h.Name, got)+ }+ for _, sibling := range []Harness{DiscoverPi(), DiscoverOmp(), DiscoverPrime()} {+ if h.Name == sibling.Name {+ t.Fatalf("Senpi and %s discovery report the same harness name", sibling.DisplayName)+ }+ }+}++// A runtime absent from DiscoverAll is a runtime `beacon endpoint discover` never mentions, which+// is how support ships without anyone being able to find it.+func TestDiscoverAllIncludesOmo(t *testing.T) {+ setupOmoDiscovery(t)++ for _, h := range DiscoverAll() {+ if h.Name == "omo_senpi" {+ return+ }+ }+ t.Fatal("DiscoverAll does not include Senpi")+}diff --git a/cli/beacon/internal/endpoint/hooks/omo.go b/cli/beacon/internal/endpoint/hooks/omo.gonew file mode 100644index 00000000..03a8741c--- /dev/null+++ b/cli/beacon/internal/endpoint/hooks/omo.go@@ -0,0 +1,239 @@+package hooks++import (+ "fmt"+ "os"+ "path/filepath"+ "strings"++ omoextension "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/hooks/assets/omo"+)++// Senpi is the standalone edition of oh-my-openagent (OMO): an in-flight fork of pi-mono+// (code-yeongyu/senpi) that OMO brands and bundles its own extension into, distributed as the+// `omo` command. It is integrated the same shape as Pi and Prime Agent, which it shares an+// extension API with: no hooks configuration file to merge into and no OpenTelemetry export, so+// the TypeScript extension API is the only observation surface. Beacon writes one extension file+// that forwards runtime events to the `beacon-hooks` binary, and managedExtension handles it+// exactly as it handles Pi's, Oh My Pi's and Prime Agent's.+//+// The extension file is a separate source from the other three rather than the same file installed+// twice. It carries its own debug variable, its own test-sender symbol and its own comments about+// which of Senpi's events exist, and -- more to the point -- its own marker, so an install of one+// runtime is never mistaken for an install of another.+const (+ omoExtensionFileName = "beacon.ts"++ // OmoManagedExtensionMarker identifies an extension file as one Beacon wrote for Senpi.+ //+ // Distinct from PiManagedExtensionMarker, OmpManagedExtensionMarker and+ // PrimeManagedExtensionMarker on purpose. The four runtimes install to different directories+ // today, but a shared marker would mean a status or repair pass could not tell which runtime's+ // extension it had found if any of them ever moved -- and an uninstall keyed on the wrong+ // marker removes the wrong file. Exported for the same three-package reason Pi's is: `hooks`+ // writes it, `harness` reads it to report telemetry status, and `inventory` reads it to decide+ // whether a file it found is Beacon-managed.+ //+ // The version suffix is part of the contract with the extension source. Bump it when the+ // extension's behavior changes in a way that makes an older installed copy wrong, which is+ // what lets a repair recognize a stale file rather than leave it in place.+ OmoManagedExtensionMarker = "beacon-managed-omo-extension:v1"++ // omoConfigDirName is the config directory OMO's Senpi engine keeps, at both scopes.+ //+ // Two path segments rather than one, and that is the runtime's own shape rather than a+ // convenience here, exactly as it is for Prime Agent: this brand's CONFIG_DIR_NAME is ".omo",+ // its config layout is not flat, and its own directory resolver+ // (findNearestParentConfigDir(cwd, homeDir, ".omo", "agent")) joins the "agent" segment under+ // the working directory just as it does under the home directory. So its project scope has the+ // `agent` segment that Pi's and Oh My Pi's project scopes do not. Copying either of those+ // layouts would write the file where Senpi does not look -- and the install would report+ // success and collect nothing.+ //+ // Unlike Prime Agent, Beacon's installer does not replicate the runtime's own upward parent-+ // directory search: Senpi walks from the working directory toward home looking for an existing+ // `.omo/agent`, falling back to `~/.omo/agent` only when none is found. The project-level+ // install here always targets `<cwd>/.omo/agent`, matching the convention every other pi-family+ // installer in this package uses -- an install run from the same directory the operator later+ // runs `omo` from still lands exactly where the runtime looks.+ omoConfigDirName = ".omo/agent"++ // omoAgentDirEnv replaces the user-level agent directory outright.+ //+ // Senpi's own package.json brands this build's envPrefix as OMO, so the shipped `omo` binary+ // reads OMO_CODING_AGENT_DIR first. Its brand profile also keeps two legacy prefixes readable+ // -- SENPI (the upstream engine's own name) and PI (pi-mono's) -- checked in that order when+ // the OMO-prefixed variable is unset, so Beacon's install lands where the runtime actually+ // looks even for an operator who set one of those before OMO existed. PI_CODING_AGENT_DIR is+ // deliberately not read ahead of SENPI_CODING_AGENT_DIR: that is the runtime's own declared+ // precedence, most specific first.+ omoAgentDirEnv = "OMO_CODING_AGENT_DIR"+ omoAgentDirLegacyEnv = "SENPI_CODING_AGENT_DIR"+ omoAgentDirPiEnv = "PI_CODING_AGENT_DIR"+)++// omoAgentDirEnvNames lists the environment variables Senpi itself consults for its agent+// directory, most specific first, so omoAgentDirOverride can mirror the runtime's own precedence+// exactly rather than reading only the newest of the three.+var omoAgentDirEnvNames = []string{omoAgentDirEnv, omoAgentDirLegacyEnv, omoAgentDirPiEnv}++type OmoOptions struct {+ Level Level+ LogPath string+ UserMode bool+}++type OmoStatus struct {+ Installed bool `json:"installed"`+ BinaryPath string `json:"binary_path,omitempty"`+ ExtensionPath string `json:"extension_path,omitempty"`+ Message string `json:"message,omitempty"`+}++var omoExtension = managedExtension{+ platform: "omo",+ displayName: "Senpi",+ marker: OmoManagedExtensionMarker,+ template: omoextension.Template,+ configPath: OmoExtensionPath,+}++var omoRuntime = omoExtension.runtime()++func InstallOmo(opts OmoOptions) (OmoStatus, error) {+ status, err := installRuntimeHooks(omoRuntime, RuntimeOptions(opts))+ if err != nil {+ return OmoStatus{}, err+ }+ return omoStatusFromRuntime(status), nil+}++func UninstallOmo(opts OmoOptions) (OmoStatus, error) {+ status, err := uninstallRuntimeHooks(omoRuntime, RuntimeOptions(opts))+ if err != nil {+ return OmoStatus{}, err+ }+ return omoStatusFromRuntime(status), nil+}++func OmoHookStatus(opts OmoOptions) OmoStatus {+ return omoStatusFromRuntime(runtimeHookStatus(omoRuntime, RuntimeOptions(opts)))+}++func IsOmoInstalled(opts OmoOptions) bool {+ return isRuntimeInstalled(omoRuntime, RuntimeOptions(opts))+}++// omoStatusFromRuntime reports installed only when the extension can actually reach the binary.+func omoStatusFromRuntime(status runtimeStatus) OmoStatus {+ status = omoExtension.reachableStatus(status)+ return OmoStatus{+ Installed: status.Installed,+ BinaryPath: status.BinaryPath,+ ExtensionPath: status.ConfigPath,+ Message: status.Message,+ }+}++func omoEmbeddedExtensionSourcePath() string {+ return filepath.Clean(filepath.Join("assets", "omo", "beacon.ts"))+}++func omoRootExtensionSourcePath() string {+ return filepath.Clean(filepath.Join("..", "..", "..", "..", "..", "plugins", "omo-beacon", "src", "beacon.ts"))+}++// OmoExtensionPath returns the extension file Beacon manages for a given install level.+//+// Senpi auto-discovers extension modules from both scopes with no trust prompt on either. A+// user-level install is still the default, because it follows the operator rather than one+// checkout.+func OmoExtensionPath(level Level) (string, error) {+ home, err := os.UserHomeDir()+ if err != nil {+ // Only the user level needs a home directory. Failing here for a project install would+ // refuse a path that does not depend on the value that could not be read.+ if level == LevelProject {+ return OmoExtensionPathForHome("", level)+ }+ return "", err+ }+ return OmoExtensionPathForHome(home, level)+}++// OmoExtensionPathForHome is OmoExtensionPath against a caller-supplied home directory.+//+// Exported for inventory, which scans a home directory it was handed rather than the process's own+// -- a scan of another user's tree, or of a fixture. Sharing the resolution rather than rebuilding+// the path there is what keeps inventory from reporting on a file the installer does not write:+// this path is not a fixed string, since OMO_CODING_AGENT_DIR (or its legacy fallbacks) moves it.+func OmoExtensionPathForHome(home string, level Level) (string, error) {+ dir, err := omoExtensionDir(home, level)+ if err != nil {+ return "", err+ }+ return filepath.Join(dir, omoExtensionFileName), nil+}++// omoAgentDirOverride returns the first defined agent-directory override, checked in the same+// order Senpi's own brandEnvNames does. An explicitly empty value still counts as defined and+// short-circuits the fallback, matching the runtime's documented "first DEFINED value" semantics+// -- os.Getenv alone cannot distinguish "set to empty" from "unset", so LookupEnv is used here+// even though the other pi-family installers in this package do not need to make that distinction.+func omoAgentDirOverride() string {+ for _, name := range omoAgentDirEnvNames {+ if value, ok := os.LookupEnv(name); ok {+ return value+ }+ }+ return ""+}++// omoExtensionDir resolves the directory Senpi actually scans for extension modules.+//+// The env override applies only to the user root, matching the runtime: it replaces+// getAgentDir(), and the project root is joined from the working directory with no variable+// consulted at all.+func omoExtensionDir(home string, level Level) (string, error) {+ switch level {+ case "", LevelUser:+ if agentDir := omoAgentDirOverride(); agentDir != "" {+ expanded, err := omoExpandTilde(agentDir, home)+ if err != nil {+ return "", err+ }+ return filepath.Join(expanded, "extensions"), nil+ }+ if home == "" {+ return "", fmt.Errorf("home directory is required to resolve the Senpi extension path")+ }+ return filepath.Join(home, filepath.FromSlash(omoConfigDirName), "extensions"), nil+ case LevelProject:+ cwd, err := os.Getwd()+ if err != nil {+ return "", err+ }+ return filepath.Join(cwd, filepath.FromSlash(omoConfigDirName), "extensions"), nil+ default:+ return "", fmt.Errorf("unknown hook level %q", level)+ }+}++// omoExpandTilde resolves a leading `~` in the agent-directory override.+//+// Senpi expands it itself before using the value, so a Beacon install that did not would create a+// literal `~` directory beside the working directory and report success while the runtime kept+// reading the real home. Only a bare `~` or a `~/`-rooted path is expanded, which is the runtime's+// own rule -- `~user/...` is left alone by both.+func omoExpandTilde(path, home string) (string, error) {+ if path != "~" && !strings.HasPrefix(path, "~/") && !strings.HasPrefix(path, `~\`) {+ return path, nil+ }+ if home == "" {+ return "", fmt.Errorf("home directory is required to resolve %q", path)+ }+ if path == "~" {+ return home, nil+ }+ return filepath.Join(home, filepath.FromSlash(path[2:])), nil+}diff --git a/cli/beacon/internal/endpoint/hooks/omo_test.go b/cli/beacon/internal/endpoint/hooks/omo_test.gonew file mode 100644index 00000000..ee0fcd50--- /dev/null+++ b/cli/beacon/internal/endpoint/hooks/omo_test.go@@ -0,0 +1,394 @@+package hooks++import (+ "encoding/json"+ "os"+ "path/filepath"+ "regexp"+ "strings"+ "testing"++ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/testenv"+)++// An empty level means "the default", and the default has to be the user level. Every caller that+// does not care about scope passes the zero value, so treating "" as unknown would turn status,+// repair and uninstall into errors for the ordinary install.+func TestOmoExtensionPathDefaultsToUserLevel(t *testing.T) {+ home := t.TempDir()+ testenv.SetHome(t, home)+ for _, name := range omoAgentDirEnvNames {+ t.Setenv(name, "")+ }++ want := filepath.Join(home, ".omo", "agent", "extensions", "beacon.ts")+ for _, level := range []Level{"", LevelUser} {+ got, err := OmoExtensionPath(level)+ if err != nil {+ t.Fatalf("OmoExtensionPath(%q) returned error: %v", level, err)+ }+ if got != want {+ t.Fatalf("OmoExtensionPath(%q) = %q, want %q", level, got, want)+ }+ }+}++// Senpi's project extension directory keeps the `agent` segment -- `.omo/agent/extensions` --+// where Pi's and Oh My Pi's project directories drop it, the same shape Prime Agent uses. That is+// the runtime's own layout: its resolveAgentDir joins the literal "agent" segment under the+// working directory as well as under the home directory. Copying either sibling's layout would+// write the file where Senpi does not look, and the install would report success and collect+// nothing.+func TestOmoExtensionPathProjectLevelKeepsAgentSegment(t *testing.T) {+ cwd := t.TempDir()+ t.Chdir(cwd)++ got, err := OmoExtensionPath(LevelProject)+ if err != nil {+ t.Fatalf("OmoExtensionPath(project) returned error: %v", err)+ }+ want := filepath.Join(cwd, ".omo", "agent", "extensions", "beacon.ts")+ if got != want {+ t.Fatalf("OmoExtensionPath(project) = %q, want %q", got, want)+ }+}++// OMO_CODING_AGENT_DIR replaces the user agent directory outright. The runtime reads it itself, so+// an install has to land where the runtime will look.+func TestOmoExtensionPathHonorsTheAgentDirOverride(t *testing.T) {+ home := t.TempDir()+ testenv.SetHome(t, home)+ agentDir := filepath.Join(home, "elsewhere", "agent")+ t.Setenv(omoAgentDirEnv, agentDir)++ got, err := OmoExtensionPath(LevelUser)+ if err != nil {+ t.Fatalf("OmoExtensionPath returned error: %v", err)+ }+ want := filepath.Join(agentDir, "extensions", "beacon.ts")+ if got != want {+ t.Fatalf("OmoExtensionPath = %q, want %q -- an install that ignores the override writes "++ "where the runtime does not look", got, want)+ }+}++// unsetenv clears an environment variable for the duration of the test, restoring whatever was+// there before. Used instead of t.Setenv(name, "") where the test needs the variable genuinely+// absent: omoAgentDirOverride reads with os.LookupEnv, which treats an explicitly empty value as+// defined -- matching Senpi's own "first DEFINED value" semantics -- so t.Setenv(name, "") would+// stop the fallback chain rather than skip past it.+func unsetenv(t *testing.T, name string) {+ t.Helper()+ previous, had := os.LookupEnv(name)+ if err := os.Unsetenv(name); err != nil {+ t.Fatalf("could not unset %s: %v", name, err)+ }+ t.Cleanup(func() {+ if had {+ os.Setenv(name, previous)+ } else {+ os.Unsetenv(name)+ }+ })+}++// SENPI_CODING_AGENT_DIR and PI_CODING_AGENT_DIR are the legacy prefixes Senpi's own brand profile+// keeps readable when OMO_CODING_AGENT_DIR is unset -- upstream Senpi's own name, then pi-mono's,+// most specific first. An install that ignored them would land somewhere the runtime does not look+// for an operator who set one before OMO existed.+func TestOmoExtensionPathFallsBackToLegacyAgentDirOverrides(t *testing.T) {+ home := t.TempDir()+ testenv.SetHome(t, home)+ unsetenv(t, omoAgentDirEnv)++ t.Run("senpi", func(t *testing.T) {+ senpiDir := filepath.Join(home, "senpi-profile", "agent")+ t.Setenv(omoAgentDirLegacyEnv, senpiDir)+ unsetenv(t, omoAgentDirPiEnv)++ got, err := OmoExtensionPath(LevelUser)+ if err != nil {+ t.Fatalf("OmoExtensionPath returned error: %v", err)+ }+ want := filepath.Join(senpiDir, "extensions", "beacon.ts")+ if got != want {+ t.Fatalf("OmoExtensionPath = %q, want %q", got, want)+ }+ })++ t.Run("pi", func(t *testing.T) {+ unsetenv(t, omoAgentDirLegacyEnv)+ piDir := filepath.Join(home, "pi-profile", "agent")+ t.Setenv(omoAgentDirPiEnv, piDir)++ got, err := OmoExtensionPath(LevelUser)+ if err != nil {+ t.Fatalf("OmoExtensionPath returned error: %v", err)+ }+ want := filepath.Join(piDir, "extensions", "beacon.ts")+ if got != want {+ t.Fatalf("OmoExtensionPath = %q, want %q", got, want)+ }+ })++ t.Run("omo wins over both legacy names", func(t *testing.T) {+ omoDir := filepath.Join(home, "omo-profile", "agent")+ t.Setenv(omoAgentDirEnv, omoDir)+ t.Setenv(omoAgentDirLegacyEnv, filepath.Join(home, "senpi-profile", "agent"))+ t.Setenv(omoAgentDirPiEnv, filepath.Join(home, "pi-profile", "agent"))++ got, err := OmoExtensionPath(LevelUser)+ if err != nil {+ t.Fatalf("OmoExtensionPath returned error: %v", err)+ }+ want := filepath.Join(omoDir, "extensions", "beacon.ts")+ if got != want {+ t.Fatalf("OmoExtensionPath = %q, want %q -- the OMO-prefixed variable must win over "++ "either legacy spelling", got, want)+ }+ })+}++// The runtime expands a leading `~` in that variable before using it. An install that did not+// would create a literal `~` directory beside the working directory and report success while+// Senpi went on reading the real home.+func TestOmoExtensionPathExpandsTildeInTheAgentDirOverride(t *testing.T) {+ home := t.TempDir()+ testenv.SetHome(t, home)+ t.Setenv(omoAgentDirEnv, "~/custom/agent")++ got, err := OmoExtensionPath(LevelUser)+ if err != nil {+ t.Fatalf("OmoExtensionPath returned error: %v", err)+ }+ want := filepath.Join(home, "custom", "agent", "extensions", "beacon.ts")+ if got != want {+ t.Fatalf("OmoExtensionPath = %q, want %q", got, want)+ }+}++// The override applies to the user root only. The runtime joins the project directory from the+// working directory with no variable consulted at all, so an install that applied it to both+// would miss the project directory entirely.+func TestOmoAgentDirOverrideDoesNotMoveTheProjectPath(t *testing.T) {+ home := t.TempDir()+ cwd := t.TempDir()+ testenv.SetHome(t, home)+ t.Chdir(cwd)+ t.Setenv(omoAgentDirEnv, filepath.Join(home, "elsewhere", "agent"))++ got, err := OmoExtensionPath(LevelProject)+ if err != nil {+ t.Fatalf("OmoExtensionPath(project) returned error: %v", err)+ }+ want := filepath.Join(cwd, ".omo", "agent", "extensions", "beacon.ts")+ if got != want {+ t.Fatalf("OmoExtensionPath(project) = %q, want %q", got, want)+ }+}++func TestOmoExtensionPathRejectsUnknownLevel(t *testing.T) {+ if _, err := OmoExtensionPath(Level("machine")); err == nil {+ t.Fatal("OmoExtensionPath accepted an unknown level; a typo in a scope flag must fail " ++ "loudly rather than silently installing at the default scope")+ }+}++// The pi-family runtimes are separately installed products that one machine can run side by side.+// One writing into another's extension directory would attribute a whole runtime's activity to the+// wrong harness.+func TestOmoPiAndPrimeInstallToDifferentDirectories(t *testing.T) {+ home := t.TempDir()+ cwd := t.TempDir()+ testenv.SetHome(t, home)+ t.Chdir(cwd)+ for _, name := range omoAgentDirEnvNames {+ t.Setenv(name, "")+ }+ t.Setenv(primeAgentDirEnv, "")+ t.Setenv(ompAgentDirEnv, "")+ t.Setenv(ompConfigDirEnv, "")++ for _, level := range []Level{LevelUser, LevelProject} {+ omo, err := OmoExtensionPath(level)+ if err != nil {+ t.Fatal(err)+ }+ pi, err := PiExtensionPath(level)+ if err != nil {+ t.Fatal(err)+ }+ omp, err := OmpExtensionPath(level)+ if err != nil {+ t.Fatal(err)+ }+ prime, err := PrimeExtensionPath(level)+ if err != nil {+ t.Fatal(err)+ }+ if omo == pi || omo == omp || omo == prime {+ t.Fatalf("Senpi shares its %s extension path %q with another pi-family runtime", level, omo)+ }+ }+}++// The marker is the only thing that distinguishes a file Beacon may overwrite from one it must+// not, and it is read by three packages. Pinning the literal here means a change to it is a+// deliberate edit to a test rather than a silent break of install/uninstall/status agreement.+func TestOmoManagedExtensionMarkerIsStable(t *testing.T) {+ if OmoManagedExtensionMarker != "beacon-managed-omo-extension:v1" {+ t.Fatalf("OmoManagedExtensionMarker = %q; changing it strands extensions installed by "++ "earlier builds, which uninstall then refuses to remove", OmoManagedExtensionMarker)+ }+}++// Each pi-family runtime's marker has to be its own. Extending this table from the existing+// TestPiFamilyMarkersAreDistinct-style check to include Senpi.+func TestOmoMarkerIsDistinctFromOtherPiFamilyMarkers(t *testing.T) {+ markers := map[string]string{+ "pi": PiManagedExtensionMarker,+ "omp": OmpManagedExtensionMarker,+ "prime": PrimeManagedExtensionMarker,+ "omo": OmoManagedExtensionMarker,+ }+ seen := map[string]string{}+ for runtime, marker := range markers {+ if other, ok := seen[marker]; ok {+ t.Fatalf("%s and %s share the marker %q", runtime, other, marker)+ }+ seen[marker] = runtime+ }+}++// omoRenderedArgv extracts the argv the installer substituted into the extension.+//+// Parsed back out of the source rather than compared as a string: argv is the whole point of this+// template, and a test that compared text would pass on a file the runtime cannot execute.+func omoRenderedArgv(t *testing.T, source string) []string {+ t.Helper()+ matches := regexp.MustCompile(`const beaconArgv: string\[\] = (\[.*\])`).FindStringSubmatch(source)+ if len(matches) != 2 {+ t.Fatalf("rendered extension has no beaconArgv array:\n%s", source)+ }+ var argv []string+ if err := json.Unmarshal([]byte(matches[1]), &argv); err != nil {+ t.Fatalf("beaconArgv is not a JSON array: %v", err)+ }+ return argv+}++func TestInstallOmoExtensionWritesAnExecutableInvocation(t *testing.T) {+ path := filepath.Join(t.TempDir(), "beacon.ts")+ binary := "/opt/beacon/bin/beacon-hooks"+ logPath := "/var/log/beacon-agent/runtime.jsonl"++ if err := omoExtension.install(path, binary, logPath, "/etc/beacon/endpoint.yaml"); err != nil {+ t.Fatalf("install returned error: %v", err)+ }++ data, err := os.ReadFile(path)+ if err != nil {+ t.Fatal(err)+ }+ source := string(data)+ if !strings.Contains(source, OmoManagedExtensionMarker) {+ t.Fatal("the installed extension carries no Beacon marker; uninstall would refuse to remove it")+ }++ argv := omoRenderedArgv(t, source)+ if argv[0] != binary {+ t.Fatalf("argv[0] = %q, want the hook binary %q", argv[0], binary)+ }+ if argv[len(argv)-1] != "omo-event" {+ t.Fatalf("argv ends with %q, want omo-event -- any other subcommand attributes Senpi's "++ "payloads to a different runtime", argv[len(argv)-1])+ }+ joined := strings.Join(argv, " ")+ for _, want := range []string{"--platform omo", "--log " + logPath, "--config /etc/beacon/endpoint.yaml"} {+ if !strings.Contains(joined, want) {+ t.Fatalf("argv %v is missing %q", argv, want)+ }+ }+}++// A file at this path that Beacon did not write belongs to somebody else. Overwriting it would+// destroy an operator's own extension, and the refusal is what makes the marker load-bearing.+func TestInstallOmoRefusesToOverwriteAnUnmanagedExtension(t *testing.T) {+ path := filepath.Join(t.TempDir(), "beacon.ts")+ if err := os.WriteFile(path, []byte("export default function () {}\n"), 0o644); err != nil {+ t.Fatal(err)+ }++ if err := omoExtension.install(path, "/opt/beacon/bin/beacon-hooks", "/tmp/runtime.jsonl", ""); err == nil {+ t.Fatal("install overwrote an extension Beacon did not write")+ }++ data, _ := os.ReadFile(path)+ if string(data) != "export default function () {}\n" {+ t.Fatalf("the operator's extension was modified: %s", data)+ }+}++// Uninstall removes only a file carrying this runtime's marker. A Pi, Oh My Pi or Prime Agent+// extension found at this path -- which should not happen, since the four read different+// directories, but the markers are distinct precisely so the answer does not depend on that+// staying true -- is left alone.+func TestUninstallOmoLeavesAnotherRuntimesExtensionAlone(t *testing.T) {+ path := filepath.Join(t.TempDir(), "beacon.ts")+ if err := os.WriteFile(path, []byte("// "+PrimeManagedExtensionMarker+"\n"), 0o644); err != nil {+ t.Fatal(err)+ }++ removed, err := omoExtension.remove(path)+ if err != nil {+ t.Fatalf("remove returned error: %v", err)+ }+ if removed {+ t.Fatal("uninstalling Senpi removed a file carrying Prime Agent's marker")+ }+ if _, err := os.Stat(path); err != nil {+ t.Fatalf("the Prime Agent extension was deleted: %v", err)+ }+}++// A Windows path is the case that makes argv worth encoding as JSON rather than as a command line.+func TestRenderOmoExtensionEncodesWindowsPaths(t *testing.T) {+ source, err := omoExtension.render(`C:\Program Files\beacon\beacon-hooks.exe`, `C:\ProgramData\beacon\runtime.jsonl`, "")+ if err != nil {+ t.Fatalf("render returned error: %v", err)+ }+ argv := omoRenderedArgv(t, source)+ if argv[0] != `C:\Program Files\beacon\beacon-hooks.exe` {+ t.Fatalf("argv[0] = %q; the Windows path did not survive rendering", argv[0])+ }+}++// The checked-in extension and the copy embedded in the binary must be byte-identical. They drift+// the moment somebody edits one and forgets `bun run sync`, and the drift is invisible until an+// install ships behavior nobody reviewed.+func TestOmoEmbeddedExtensionMatchesRootSource(t *testing.T) {+ embedded, err := os.ReadFile(omoEmbeddedExtensionSourcePath())+ if err != nil {+ t.Fatalf("embedded extension source is unreadable: %v", err)+ }+ root, err := os.ReadFile(omoRootExtensionSourcePath())+ if err != nil {+ t.Fatalf("root extension source is unreadable: %v", err)+ }+ if string(embedded) != string(root) {+ t.Fatal("plugins/omo-beacon/src/beacon.ts and its embedded copy have drifted; " ++ "run `bun run sync` in plugins/omo-beacon")+ }+}++// Senpi publishes no approval event, and Beacon refuses to synthesize one from a blocking tool+// handler. Asserted against the shipped source so the absence is a property of what installs+// rather than of what somebody remembered not to add.+func TestOmoExtensionSubscribesToNoApprovalEvent(t *testing.T) {+ for _, forbidden := range []string{"tool_approval_requested", "tool_approval_resolved", "user_python"} {+ if strings.Contains(omoExtension.template, `"`+forbidden+`"`) {+ t.Fatalf("the Senpi extension subscribes to %q, which this runtime does not publish; "++ "those are Oh My Pi's events", forbidden)+ }+ }+}diff --git a/cli/beacon/internal/endpoint/inventory/inventory.go b/cli/beacon/internal/endpoint/inventory/inventory.goindex 0821da8d..69fc8138 100644--- a/cli/beacon/internal/endpoint/inventory/inventory.go+++ b/cli/beacon/internal/endpoint/inventory/inventory.go@@ -239,6 +239,7 @@ func candidates(home, wd string) []candidate {items = append(items, ompCandidates(home, wd)...)items = append(items, openClawCandidates(home, wd)...)items = append(items, primeCandidates(home, wd)...)+ items = append(items, omoCandidates(home, wd)...)items = append(items, hermesCandidates(home)...)items = append(items, devinCandidates(home, wd)...)items = append(items, grokCandidates(home, wd)...)@@ -444,6 +445,34 @@ func primeCandidates(home, wd string) []candidate {return items}+// omoCandidates covers both Senpi extension locations.+//+// Like primeCandidates, the user path comes from the installer rather than being rebuilt here,+// because it is not a fixed string: OMO_CODING_AGENT_DIR (and its legacy SENPI_/PI_ fallbacks)+// moves it, and only the installer knows that rule. The project path keeps the `agent` segment the+// user path has -- Senpi's own resolveAgentDir joins the same two-segment literal at both scopes,+// unlike Pi and Oh My Pi, whose project directories drop it.+func omoCandidates(home, wd string) []candidate {+ items := []candidate{}+ if home != "" {+ if path, err := hooks.OmoExtensionPathForHome(home, hooks.LevelUser); err == nil {+ items = append(items, candidate{+ runtime: "omo_senpi",+ path: path,+ scope: ScopeUser, format: formatMetadataOnly, kind: KindPlugin,+ })+ }+ }+ if wd != "" {+ items = append(items, candidate{+ runtime: "omo_senpi",+ path: filepath.Join(wd, ".omo", "agent", "extensions", "beacon.ts"),+ scope: ScopeProject, format: formatMetadataOnly, kind: KindPlugin,+ })+ }+ return items+}+func hermesCandidates(home string) []candidate {return []candidate{{runtime: "hermes", path: filepath.Join(home, ".hermes", "config.yaml"), scope: ScopeUser, format: formatYAML, kind: KindNativeConfig}}}@@ -925,6 +954,11 @@ func beaconManaged(item candidate, data []byte) bool {// whichever case ran first.case "prime_agent":return strings.Contains(text, hooks.PrimeManagedExtensionMarker)+ // Fourth distinct marker in this family, matched separately for the same reason: a file found+ // at any of the four paths is attributed to the runtime that actually loads it rather than to+ // whichever case ran first.+ case "omo_senpi":+ return strings.Contains(text, hooks.OmoManagedExtensionMarker)case "grok":return strings.Contains(text, "beacon-managed-grok-hooks:v1")// Matched on the hook command rather than on a marker, because Beacon merges into Qwen's owndiff --git a/cli/beacon/internal/endpoint/inventory/inventory_test.go b/cli/beacon/internal/endpoint/inventory/inventory_test.goindex d393f241..a3e14d42 100644--- a/cli/beacon/internal/endpoint/inventory/inventory_test.go+++ b/cli/beacon/internal/endpoint/inventory/inventory_test.go@@ -310,6 +310,10 @@ func TestScanIncludesAllSupportedCurrentUserAndProjectConfigs(t *testing.T) {// otherwise see this test fail on a path that is correct for their machine.t.Setenv("PI_CODING_AGENT_DIR", "")t.Setenv("PI_CONFIG_DIR", "")+ // Senpi reads the same PI_CODING_AGENT_DIR as its last fallback, plus two of its own; all three+ // are cleared for the same reason.+ t.Setenv("OMO_CODING_AGENT_DIR", "")+ t.Setenv("SENPI_CODING_AGENT_DIR", "")result := Scan(Options{HomeDir: home,@@ -358,6 +362,10 @@ func TestScanIncludesAllSupportedCurrentUserAndProjectConfigs(t *testing.T) {// Oh My Pi drop it, so a path derived from either sibling would be wrong here.{runtime: "prime_agent", path: filepath.Join(home, ".prime", "agent", "extensions", "beacon.ts"), scope: ScopeUser, format: formatMetadataOnly, kind: KindPlugin},{runtime: "prime_agent", path: filepath.Join(work, ".prime", "agent", "extensions", "beacon.ts"), scope: ScopeProject, format: formatMetadataOnly, kind: KindPlugin},+ // Senpi, the fourth pi-family runtime, under its own `.omo` root. Both scopes carry the+ // `agent` segment, the same shape Prime Agent uses and Pi and Oh My Pi do not.+ {runtime: "omo_senpi", path: filepath.Join(home, ".omo", "agent", "extensions", "beacon.ts"), scope: ScopeUser, format: formatMetadataOnly, kind: KindPlugin},+ {runtime: "omo_senpi", path: filepath.Join(work, ".omo", "agent", "extensions", "beacon.ts"), scope: ScopeProject, format: formatMetadataOnly, kind: KindPlugin},// OpenClaw's candidate is the plugin entry rather than its directory, because the entry is// what carries Beacon's marker -- the two manifests beside it are byte-identical for every// install and identify nothing. Both scopes are reported: OpenClaw discovers a workspace