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
feat(cli): add neutral extension points for separately distributed builds
shukieshah087df0418eb9
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 1c67777c..aadf2fc3 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -220,6 +220,12 @@ jobs:- name: Check Senpi extensionworking-directory: plugins/omo-beaconrun: bun run check && bun test+ - name: Keep enterprise-only files out of this repository+ run: |+ if git grep -n -e '^//go:build.*enterprise' -e '^// +build.*enterprise' -- '*.go'; then+ echo "Files built only with the enterprise tag live in the private overlay, not here." >&2+ exit 1+ fi- name: Build embedded hooks binaryworking-directory: cli/beacon# hooks.bin is gitignored (build-time artifact). The CLI embeds it viadiff --git a/CLAUDE.md b/CLAUDE.mdindex f74a72ec..93fcc126 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -553,6 +553,7 @@ unpacked through Chrome's developer mode.- `cli/beacon/internal/pricing` estimates list-price cost for reports: integer-microdollar math over the gen_ai.usage counts (disjoint input/output/cache read/cache write, a one-hour write subset, reasoning inside output), long-context bands only for a single request, and a strict model-name ladder (exact, canonical via `NormalizeModelName`, dotted version, Bedrock route prefix, then stripping a `[1m]` marker, snapshot date or effort suffix) that leaves a model unpriced rather than guess, including when two entries tie with different prices. Its `catalog.json` is embedded, offline and report-time only (hooks never import it); it is generated from LiteLLM's MIT-licensed `model_prices_and_context_window.json` and records the upstream URL, commit and fetch/generation dates. Regenerate with `cd cli/beacon && go run ./internal/pricing/internal/gen` (resolves LiteLLM's main with `git ls-remote` and fetches that commit; `-src`/`-commit` for a local copy) and review the one-model-per-line diff; the generator never runs in builds or tests. Operators price what the catalog cannot (internal models, new releases, gateway aliases, negotiated rates) in a local overrides file, `<BaseDir>/pricing/overrides.json` (`pricing.DefaultOverridesPath`, user or system mode; `--pricing-file` on `beacon token-usage` and `beacon pricing` names another), schema `beacon.pricing.overrides/v1`, documented in `docs/cli/pricing.mdx`. It is offline and Beacon never writes it: the CLI reads it per run, and the dashboard re-reads it per `/api/tokens` request, read-only, falling back to the catalog with `pricing.overrides.error` when it is invalid (the CLI fails instead). Rates are USD per MTok converted exactly to microdollars; zero, negative, quoted, sub-microdollar, absurd, unknown and duplicate keys are refused with the key named. `Pricer.Lookup` runs the same ladder over the file's names first and a row replaces the catalog row whole (omitted cache rates are unpublished, priced by the usual fallbacks); aliases map a reported name to an exact row or catalog key. Reports record `source` (`override`/`catalog`), `alias`, and the file's path and SHA-256. `beacon pricing show|list|info|validate` (`cli/beacon/cmd/pricing.go`) inspects resolution, the catalog, its provenance and the file.- When adding a new signal, include stable identifiers/counts/hashes alongside any retained raw content, and route raw fields through redaction, sanitization, truncation, and event-size controls.- Keep the dashboard read-only. It should inspect local status and JSONL events but must not mutate endpoint configuration or telemetry.+- A few no-op extension points let a separately distributed build compile in files of its own: `claudeExtraHookGroups` and `claudeSettingsChanged` (`cli/beacon/internal/endpoint/hooks/claude.go`), `version.Edition` (both modules; reported by `beacon version`, `endpoint status --json` and the inventory heartbeat only when it is not `community`), and `updatecheck.PublicReleases` (false turns off the startup notice, `beacon version check` and the self-updater). In this repository they stay unset, and with them unset Beacon must behave exactly as before: `TestInstallClaudeSettingsUnchangedWithoutExtensions` compares the written Claude settings to a golden file. Keep them neutral, with no product logic behind them here, and CI refuses any file built only with an `enterprise` tag.- The local trace history (`~/.beacon/endpoint/history.db`, `cli/beacon/internal/endpoint/dashboard/history_*.go`) is opt-in: only `beacon endpoint traces reindex`, a yes to the first-run prompt, or (later) `beacon mcp setup` creates it, and nothing non-interactive is ever prompted. Once it exists, `list`, `search` and `show` must return exactly what the JSONL scan returns for the same log (`TestHistoryAnswersExactlyLikeTheJSONLScan`), so it stores every event and projects it with the same code. A change to the trace projection bumps `historyDerivationVersion`, which rebuilds derived data from the stored lines. The stored lines keep only the raw keys in `historyRawKeys`, and a test fails if the dashboard reads one that is missing. The line dictionary (`historyLineDictionary`) must never change without a new codec.- The Asymptote device key has exactly one home, `<BaseDir>/asymptote/vector-secrets.json`, read by Vector's `secret` file backend. Never copy it into `config.json`, `vector.toml`, a service unit, an environment variable, a log line, or a `--json` result; `HasSecretDestinations` is unchanged because the key is not in `config.json`. `internal/auth` is flow-agnostic (PKCE, loopback callback server with an injected exchange function, browser opener, `PostJSON`); new browser flows reuse it rather than adding a second callback server. `connect` must fail before opening a browser when Vector or a service manager is missing, or when Vector rejects the rendered config, so no key is minted or rotated that cannot be used; enrollment rotates a connected device's key in place, so every local check runs ahead of it; the steps that can only fail after the exchange (storing the key, writing the config and unit, starting the service) are covered by the `asymptote/connect-pending` marker, written as soon as the key arrives and removed only when connect finishes, so status reports an incomplete connect instead of the previous connection. A failed first connect stops and removes any partial forwarder before returning, which keeps a later local-only onboarding choice local.- Keep the release readiness guidance in `README.md` up to date when install, packaging, collector, or dashboard behavior changes.diff --git a/cli/beacon-hooks/internal/version/version.go b/cli/beacon-hooks/internal/version/version.goindex e23d52c8..33685971 100644--- a/cli/beacon-hooks/internal/version/version.go+++ b/cli/beacon-hooks/internal/version/version.go@@ -2,3 +2,7 @@ package version// Version is set at build time via ldflagsvar Version = "dev"++// Edition names the build, like the beacon CLI's version.Edition. Builds from this repository are+// "community"; a build that compiles in files of its own sets it at link time.+var Edition = "community"diff --git a/cli/beacon/cmd/endpoint_diagnostics.go b/cli/beacon/cmd/endpoint_diagnostics.goindex 06b21506..94ee8101 100644--- a/cli/beacon/cmd/endpoint_diagnostics.go+++ b/cli/beacon/cmd/endpoint_diagnostics.go@@ -608,6 +608,9 @@ func writeInventorySnapshotEvents(cfg endpointconfig.Config, settings endpointco// with nobody at the console from one for an unchanged inventory."user_scope": result.UserScope,}+ if edition := version.ReportedEdition(); edition != "" {+ inventoryMeta["edition"] = edition+ }if previousDigest == "" {inventoryMeta["change_reason"] = "initial"} else if previousDigest != digest {diff --git a/cli/beacon/cmd/endpoint_update.go b/cli/beacon/cmd/endpoint_update.goindex b541f5b9..51d10d50 100644--- a/cli/beacon/cmd/endpoint_update.go+++ b/cli/beacon/cmd/endpoint_update.go@@ -14,6 +14,7 @@ import (endpointconfig "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/config""github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/lifecycle""github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/selfupdate"+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/updatecheck""github.com/asymptote-labs/agent-beacon/cli/beacon/internal/version")@@ -96,6 +97,10 @@ func runEndpointUpdate(cmd *cobra.Command, args []string) error {if endpointUpdateServiceOpts.scheduled {return runScheduledUpdate(cmd.Context())}+ if !updatecheck.PublicReleases {+ fmt.Fprintln(cmd.OutOrStdout(), notUpdatedFromPublicReleases)+ return nil+ }ctx, cancel := context.WithTimeout(cmd.Context(), 15*time.Second)defer cancel()diff --git a/cli/beacon/cmd/endpoint_update_service.go b/cli/beacon/cmd/endpoint_update_service.goindex 835c285d..5620116b 100644--- a/cli/beacon/cmd/endpoint_update_service.go+++ b/cli/beacon/cmd/endpoint_update_service.go@@ -18,6 +18,7 @@ import ("github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/selfupdate""github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/service""github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/writer"+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/updatecheck""github.com/asymptote-labs/agent-beacon/cli/beacon/internal/version")@@ -126,6 +127,10 @@ func requireRootForUpdater() error {}func runUpdateEnable(cmd *cobra.Command, args []string) error {+ if !updatecheck.PublicReleases {+ fmt.Fprintln(cmd.OutOrStdout(), notUpdatedFromPublicReleases)+ return nil+ }if err := requireRootForUpdater(); err != nil {return err}diff --git a/cli/beacon/cmd/inventory_edition_test.go b/cli/beacon/cmd/inventory_edition_test.gonew file mode 100644index 00000000..fe5e41ce--- /dev/null+++ b/cli/beacon/cmd/inventory_edition_test.go@@ -0,0 +1,74 @@+package cmd++import (+ "bufio"+ "encoding/json"+ "os"+ "path/filepath"+ "testing"++ endpointconfig "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/config"+ endpointinventory "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/inventory"+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/testenv"+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/version"+)++func TestInventoryHeartbeatReportsEditionOnlyWhenNotDefault(t *testing.T) {+ for _, tc := range []struct {+ edition string+ want interface{}+ }{+ {version.DefaultEdition, nil},+ {"partner", "partner"},+ } {+ t.Run(tc.edition, func(t *testing.T) {+ orig := version.Edition+ version.Edition = tc.edition+ t.Cleanup(func() { version.Edition = orig })+ testenv.SetHome(t, t.TempDir())+ logPath := filepath.Join(t.TempDir(), "runtime.jsonl")+ cfg := endpointconfig.Default(true, logPath)+ settings := endpointconfig.InventoryConfig(cfg)++ if _, err := writeInventoryHeartbeat(cfg, settings, false, inventoryTriggerScheduled, heartbeatScope{}); err != nil {+ t.Fatal(err)+ }+ got := heartbeatInventoryField(t, endpointinventory.LogPath(logPath, true), "edition")+ if got != tc.want {+ t.Fatalf("inventory edition = %#v, want %#v", got, tc.want)+ }+ })+ }+}++func heartbeatInventoryField(t *testing.T, path, field string) interface{} {+ t.Helper()+ f, err := os.Open(path)+ if err != nil {+ t.Fatal(err)+ }+ defer f.Close()+ scanner := bufio.NewScanner(f)+ scanner.Buffer(make([]byte, 0, 1<<20), 1<<24)+ for scanner.Scan() {+ var event struct {+ Event struct {+ Action string `json:"action"`+ } `json:"event"`+ Raw struct {+ Inventory map[string]interface{} `json:"inventory"`+ } `json:"raw"`+ }+ if err := json.Unmarshal(scanner.Bytes(), &event); err != nil {+ t.Fatal(err)+ }+ if event.Event.Action == "inventory.heartbeat" {+ return event.Raw.Inventory[field]+ }+ }+ if err := scanner.Err(); err != nil {+ t.Fatal(err)+ }+ t.Fatal("no inventory.heartbeat event written")+ return nil+}diff --git a/cli/beacon/cmd/public_releases_test.go b/cli/beacon/cmd/public_releases_test.gonew file mode 100644index 00000000..fa3153f4--- /dev/null+++ b/cli/beacon/cmd/public_releases_test.go@@ -0,0 +1,37 @@+package cmd++import (+ "bytes"+ "strings"+ "testing"++ "github.com/spf13/cobra"++ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/updatecheck"+)++// A build that is not updated from Beacon's public releases must say so, and do nothing else,+// from every command that would otherwise look at those releases. None of these touch the+// network or need root on that path.+func TestUpdateCommandsDeclineWhenBuildIsNotUpdatedFromPublicReleases(t *testing.T) {+ updatecheck.PublicReleases = false+ t.Cleanup(func() { updatecheck.PublicReleases = true })++ for name, run := range map[string]func(*cobra.Command, []string) error{+ "version check": runVersionCheck,+ "endpoint update": runEndpointUpdate,+ "update enable": runUpdateEnable,+ } {+ t.Run(name, func(t *testing.T) {+ var out bytes.Buffer+ cmd := &cobra.Command{}+ cmd.SetOut(&out)+ if err := run(cmd, nil); err != nil {+ t.Fatalf("%s returned %v", name, err)+ }+ if got := strings.TrimSpace(out.String()); got != notUpdatedFromPublicReleases {+ t.Fatalf("%s printed %q, want %q", name, got, notUpdatedFromPublicReleases)+ }+ })+ }+}diff --git a/cli/beacon/cmd/version_check.go b/cli/beacon/cmd/version_check.goindex d1e2af87..276f6abd 100644--- a/cli/beacon/cmd/version_check.go+++ b/cli/beacon/cmd/version_check.go@@ -32,6 +32,10 @@ var (versionCheckTimeout = 2 * time.Second)+// notUpdatedFromPublicReleases is what the update commands print in a build that is not updated+// from Beacon's public releases (updatecheck.PublicReleases is false).+const notUpdatedFromPublicReleases = "This build of Beacon is not updated from Beacon's public releases."+// versionRefreshCmd is the background half of the startup notice: bare `beacon` starts it// detached when the cache is stale, and it only updates the cache. It prints nothing, so a// failure leaves the previous cached release in place until the next TTL.@@ -79,6 +83,10 @@ func checkAndRecord(cmd *cobra.Command) (updatecheck.Result, error) {}func runVersionCheck(cmd *cobra.Command, args []string) error {+ if !updatecheck.PublicReleases {+ fmt.Fprintln(cmd.OutOrStdout(), notUpdatedFromPublicReleases)+ return nil+ }result, err := checkAndRecord(cmd)if err != nil {return fmt.Errorf("unable to check for Beacon updates: %w", err)diff --git a/cli/beacon/internal/endpoint/hooks/claude.go b/cli/beacon/internal/endpoint/hooks/claude.goindex d878e38e..b338dffe 100644--- a/cli/beacon/internal/endpoint/hooks/claude.go+++ b/cli/beacon/internal/endpoint/hooks/claude.go@@ -60,6 +60,23 @@ func claudeStatusFromRuntime(status runtimeStatus) ClaudeStatus {}}+// Extension points for a build of Beacon that compiles in hook subcommands of its own (see+// version.Edition). Both are nil in this build, which installs exactly the hooks listed in+// installClaudeSettings.+var (+ // claudeExtraHookGroups returns further hook groups to install for Claude Code, keyed by+ // event, given the command prefix Beacon's own hooks use. Their commands carry that prefix,+ // so repair, status and uninstall treat them as Beacon's hooks: a reinstall replaces them and+ // an uninstall removes them.+ claudeExtraHookGroups func(prefix string) map[string][]settingsHookGroup++ // claudeSettingsChanged runs after Beacon has written its hooks into a Claude Code settings+ // file (installed true) or taken them out (installed false). It runs as whoever ran the+ // install, which for a system install's per-user repair is the console user, so files kept+ // next to the settings, such as a command under .claude/commands, stay in step with the hooks.+ claudeSettingsChanged func(settingsPath string, installed bool) error+)+func installClaudeSettings(path, binaryPath, logPath, configPath string) error {prefix := endpointCommandPrefix("claude", binaryPath, logPath, configPath)endpointHooks := map[string]settingsHookGroup{@@ -74,11 +91,35 @@ func installClaudeSettings(path, binaryPath, logPath, configPath string) error {"PermissionRequest": {Matcher: "*", Hooks: []settingsHookRef{{Type: "command", Command: prefix + " permission-request"}}},"SessionEnd": {Hooks: []settingsHookRef{{Type: "command", Command: prefix + " session-end"}}},}- return installSettingsEndpointHooks(path, "claude", endpointHooks)+ groups := make(map[string][]settingsHookGroup, len(endpointHooks))+ for event, group := range endpointHooks {+ groups[event] = []settingsHookGroup{group}+ }+ if claudeExtraHookGroups != nil {+ for event, extra := range claudeExtraHookGroups(prefix) {+ groups[event] = append(groups[event], extra...)+ }+ }+ if err := installSettingsEndpointHookGroups(path, "claude", groups); err != nil {+ return err+ }+ if claudeSettingsChanged != nil {+ return claudeSettingsChanged(path, true)+ }+ return nil}func removeClaudeEndpointHooks(path string) (bool, error) {- return removeSettingsEndpointHooks(path, "claude")+ removed, err := removeSettingsEndpointHooks(path, "claude")+ if err != nil {+ return removed, err+ }+ if claudeSettingsChanged != nil {+ if err := claudeSettingsChanged(path, false); err != nil {+ return removed, err+ }+ }+ return removed, nil}func isClaudeInstalledAt(path string) bool {diff --git a/cli/beacon/internal/endpoint/hooks/claude_extension_test.go b/cli/beacon/internal/endpoint/hooks/claude_extension_test.gonew file mode 100644index 00000000..190e1c1b--- /dev/null+++ b/cli/beacon/internal/endpoint/hooks/claude_extension_test.go@@ -0,0 +1,111 @@+package hooks++import (+ "bytes"+ "os"+ "path/filepath"+ "strings"+ "testing"+)++// The extension points are nil in this build, and with them nil the settings Beacon writes must+// not change by a byte. The golden file was captured from the installer before they existed.+func TestInstallClaudeSettingsUnchangedWithoutExtensions(t *testing.T) {+ path := filepath.Join(t.TempDir(), "settings.json")+ existing := `{"env":{"EXISTING":"1"},"hooks":{"SessionStart":[{"hooks":[{"type":"command","command":"echo keep"}]}],"PreToolUse":[{"matcher":"Bash","hooks":[{"type":"http","url":"https://guard.example/check","headers":{"X":"1"}}]}]}}`+ if err := os.WriteFile(path, []byte(existing), 0600); err != nil {+ t.Fatal(err)+ }+ if err := installClaudeSettings(path, "/opt/beacon hooks/beacon-hooks", "/var/log/beacon-agent/runtime.jsonl", "/Library/Application Support/Beacon/Endpoint/config.json"); err != nil {+ t.Fatal(err)+ }+ got, err := os.ReadFile(path)+ if err != nil {+ t.Fatal(err)+ }+ want, err := os.ReadFile(filepath.Join("testdata", "claude_settings_golden.json"))+ if err != nil {+ t.Fatal(err)+ }+ if !bytes.Equal(got, want) {+ t.Fatalf("settings changed without extensions:\ngot:\n%s\nwant:\n%s", got, want)+ }+}++func TestClaudeExtraHookGroupsFollowBeaconHooks(t *testing.T) {+ type change struct {+ path string+ installed bool+ }+ var changes []change+ claudeExtraHookGroups = func(prefix string) map[string][]settingsHookGroup {+ return map[string][]settingsHookGroup{+ "PreToolUse": {{Matcher: "mcp__.*", Hooks: []settingsHookRef{{Type: "command", Command: prefix + " extra-tool", Timeout: 15}}}},+ "UserPromptExpansion": {{Matcher: "extra-command", Hooks: []settingsHookRef{{Type: "command", Command: prefix + " extra-expansion", Timeout: 10}}}},+ }+ }+ claudeSettingsChanged = func(path string, installed bool) error {+ changes = append(changes, change{path, installed})+ return nil+ }+ t.Cleanup(func() {+ claudeExtraHookGroups = nil+ claudeSettingsChanged = nil+ })++ path := filepath.Join(t.TempDir(), "settings.json")+ existing := `{"hooks":{"PreToolUse":[{"matcher":"Bash","hooks":[{"type":"command","command":"echo keep"}]}]}}`+ if err := os.WriteFile(path, []byte(existing), 0600); err != nil {+ t.Fatal(err)+ }++ // Installing twice must leave one copy of each group: the second install removes the first+ // install's groups, extra ones included, before writing them again.+ for i := 0; i < 2; i++ {+ if err := installClaudeSettings(path, "/tmp/beacon-hooks", "/tmp/runtime.jsonl", "/tmp/config.json"); err != nil {+ t.Fatal(err)+ }+ }+ settings, err := readSettingsHooks(path)+ if err != nil {+ t.Fatal(err)+ }+ pre := settings.hooks["PreToolUse"]+ if len(pre) != 3 {+ t.Fatalf("PreToolUse groups = %d, want the user's, Beacon's and the extra one: %+v", len(pre), pre)+ }+ if pre[0].Hooks[0].Command != "echo keep" || !strings.HasSuffix(pre[1].Hooks[0].Command, " pre-tool") || pre[2].Matcher != "mcp__.*" || !strings.HasSuffix(pre[2].Hooks[0].Command, " extra-tool") {+ t.Fatalf("PreToolUse groups out of order: %+v", pre)+ }+ expansion := settings.hooks["UserPromptExpansion"]+ if len(expansion) != 1 || expansion[0].Matcher != "extra-command" || expansion[0].Hooks[0].Timeout != 10 {+ t.Fatalf("UserPromptExpansion = %+v", expansion)+ }+ if !isClaudeInstalledAt(path) {+ t.Fatal("status does not see the installed hooks")+ }++ if _, err := removeClaudeEndpointHooks(path); err != nil {+ t.Fatal(err)+ }+ data, err := os.ReadFile(path)+ if err != nil {+ t.Fatal(err)+ }+ if strings.Contains(string(data), "beacon-hooks") || strings.Contains(string(data), "UserPromptExpansion") {+ t.Fatalf("uninstall left Beacon's or the extra hooks behind:\n%s", data)+ }+ if !strings.Contains(string(data), "echo keep") {+ t.Fatalf("uninstall removed the user's hook:\n%s", data)+ }++ want := []change{{path, true}, {path, true}, {path, false}}+ if len(changes) != len(want) {+ t.Fatalf("settings-changed calls = %+v, want %+v", changes, want)+ }+ for i := range want {+ if changes[i] != want[i] {+ t.Fatalf("settings-changed calls = %+v, want %+v", changes, want)+ }+ }+}diff --git a/cli/beacon/internal/endpoint/hooks/settings_hooks.go b/cli/beacon/internal/endpoint/hooks/settings_hooks.goindex 683fa1b1..68b77bd1 100644--- a/cli/beacon/internal/endpoint/hooks/settings_hooks.go+++ b/cli/beacon/internal/endpoint/hooks/settings_hooks.go@@ -189,13 +189,29 @@ func (settings settingsHooksFile) marshal() ([]byte, error) {}func installSettingsEndpointHooks(path, platform string, endpointHooks map[string]settingsHookGroup) error {+ groups := make(map[string][]settingsHookGroup, len(endpointHooks))+ for eventName, group := range endpointHooks {+ groups[eventName] = []settingsHookGroup{group}+ }+ return installSettingsEndpointHookGroups(path, platform, groups)+}++// installSettingsEndpointHookGroups is installSettingsEndpointHooks for events that carry more+// than one Beacon group, such as two PreToolUse groups with different matchers. Beacon's existing+// groups are removed once, up front, and every group for an event is appended after the user's+// own, in the order given.+func installSettingsEndpointHookGroups(path, platform string, endpointHooks map[string][]settingsHookGroup) error {settings, err := readSettingsHooks(path)if err != nil {return err}removeSettingsEndpointHooksFromLoaded(&settings, platform)- for eventName, group := range endpointHooks {- settings.hooks[eventName] = mergeSettingsEndpointHook(settings.hooks[eventName], group, platform)+ for eventName, groups := range endpointHooks {+ if len(groups) == 0 {+ continue+ }+ merged := mergeSettingsEndpointHook(settings.hooks[eventName], groups[0], platform)+ settings.hooks[eventName] = append(merged, groups[1:]...)}data, err := settings.marshal()if err != nil {diff --git a/cli/beacon/internal/endpoint/hooks/testdata/claude_settings_golden.json b/cli/beacon/internal/endpoint/hooks/testdata/claude_settings_golden.jsonnew file mode 100644index 00000000..7017fa99--- /dev/null+++ b/cli/beacon/internal/endpoint/hooks/testdata/claude_settings_golden.json@@ -0,0 +1,133 @@+{+ "env": {+ "EXISTING": "1"+ },+ "hooks": {+ "PermissionRequest": [+ {+ "matcher": "*",+ "hooks": [+ {+ "type": "command",+ "command": "'/opt/beacon hooks/beacon-hooks' --platform claude --log '/var/log/beacon-agent/runtime.jsonl' --config '/Library/Application Support/Beacon/Endpoint/config.json' permission-request"+ }+ ]+ }+ ],+ "PostToolUse": [+ {+ "matcher": "*",+ "hooks": [+ {+ "type": "command",+ "command": "'/opt/beacon hooks/beacon-hooks' --platform claude --log '/var/log/beacon-agent/runtime.jsonl' --config '/Library/Application Support/Beacon/Endpoint/config.json' post-tool"+ }+ ]+ }+ ],+ "PostToolUseFailure": [+ {+ "matcher": "*",+ "hooks": [+ {+ "type": "command",+ "command": "'/opt/beacon hooks/beacon-hooks' --platform claude --log '/var/log/beacon-agent/runtime.jsonl' --config '/Library/Application Support/Beacon/Endpoint/config.json' post-tool"+ }+ ]+ }+ ],+ "PreToolUse": [+ {+ "matcher": "Bash",+ "hooks": [+ {+ "type": "http",+ "url": "https://guard.example/check",+ "headers": {+ "X": "1"+ }+ }+ ]+ },+ {+ "matcher": "Bash|Edit|Write|MultiEdit|Read|Glob|Grep|WebFetch|WebSearch|Agent|mcp__.*",+ "hooks": [+ {+ "type": "command",+ "command": "'/opt/beacon hooks/beacon-hooks' --platform claude --log '/var/log/beacon-agent/runtime.jsonl' --config '/Library/Application Support/Beacon/Endpoint/config.json' pre-tool"+ }+ ]+ }+ ],+ "SessionEnd": [+ {+ "hooks": [+ {+ "type": "command",+ "command": "'/opt/beacon hooks/beacon-hooks' --platform claude --log '/var/log/beacon-agent/runtime.jsonl' --config '/Library/Application Support/Beacon/Endpoint/config.json' session-end"+ }+ ]+ }+ ],+ "SessionStart": [+ {+ "hooks": [+ {+ "type": "command",+ "command": "echo keep"+ }+ ]+ },+ {+ "hooks": [+ {+ "type": "command",+ "command": "'/opt/beacon hooks/beacon-hooks' --platform claude --log '/var/log/beacon-agent/runtime.jsonl' --config '/Library/Application Support/Beacon/Endpoint/config.json' session-start"+ }+ ]+ }+ ],+ "Stop": [+ {+ "hooks": [+ {+ "type": "command",+ "command": "'/opt/beacon hooks/beacon-hooks' --platform claude --log '/var/log/beacon-agent/runtime.jsonl' --config '/Library/Application Support/Beacon/Endpoint/config.json' stop",+ "timeout": 45+ }+ ]+ }+ ],+ "SubagentStart": [+ {+ "hooks": [+ {+ "type": "command",+ "command": "'/opt/beacon hooks/beacon-hooks' --platform claude --log '/var/log/beacon-agent/runtime.jsonl' --config '/Library/Application Support/Beacon/Endpoint/config.json' subagent-start"+ }+ ]+ }+ ],+ "SubagentStop": [+ {+ "hooks": [+ {+ "type": "command",+ "command": "'/opt/beacon hooks/beacon-hooks' --platform claude --log '/var/log/beacon-agent/runtime.jsonl' --config '/Library/Application Support/Beacon/Endpoint/config.json' subagent-stop"+ }+ ]+ }+ ],+ "UserPromptSubmit": [+ {+ "hooks": [+ {+ "type": "command",+ "command": "'/opt/beacon hooks/beacon-hooks' --platform claude --log '/var/log/beacon-agent/runtime.jsonl' --config '/Library/Application Support/Beacon/Endpoint/config.json' prompt-submit",+ "timeout": 30+ }+ ]+ }+ ]+ }+}\ No newline at end of filediff --git a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go b/cli/beacon/internal/endpoint/lifecycle/lifecycle.goindex 56988b70..ec624e48 100644--- a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go+++ b/cli/beacon/internal/endpoint/lifecycle/lifecycle.go@@ -253,7 +253,9 @@ type InstallResult struct {}type Status struct {- Version string `json:"version"`+ Version string `json:"version"`+ // Edition is set only for a build that is not the default edition (see version.Edition).+ Edition string `json:"edition,omitempty"`ConfigPath string `json:"config_path"`LogPath string `json:"log_path"`RuntimeLog RuntimeLogSource `json:"runtime_log"`@@ -879,6 +881,7 @@ func buildStatus(requestedUserMode bool, effectiveCfg endpointconfig.Config, run}return Status{Version: version.GetVersion(),+ Edition: version.ReportedEdition(),ConfigPath: endpointconfig.ConfigPath(effectiveCfg.UserMode),LogPath: effectiveCfg.LogPath,RuntimeLog: runtimeLog,diff --git a/cli/beacon/internal/endpoint/selfupdate/mode.go b/cli/beacon/internal/endpoint/selfupdate/mode.goindex c4ca03f4..ca10a5df 100644--- a/cli/beacon/internal/endpoint/selfupdate/mode.go+++ b/cli/beacon/internal/endpoint/selfupdate/mode.go@@ -5,6 +5,8 @@ import ("os""path/filepath""strings"++ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/updatecheck")// Mode controls self-updater behavior.@@ -77,6 +79,9 @@ func loadManagedConfig() (managedConfig, bool) {// A managed layer can therefore always override the local default without a// code change, which keeps the door open for an enterprise update path.func ResolveMode(localMode string) Mode {+ if !updatecheck.PublicReleases {+ return ModeOff+ }if env := os.Getenv(AutoUpdateEnv); strings.TrimSpace(env) != "" {if m, ok := ParseMode(env); ok {return mdiff --git a/cli/beacon/internal/endpoint/selfupdate/public_releases_test.go b/cli/beacon/internal/endpoint/selfupdate/public_releases_test.gonew file mode 100644index 00000000..62474d40--- /dev/null+++ b/cli/beacon/internal/endpoint/selfupdate/public_releases_test.go@@ -0,0 +1,29 @@+package selfupdate++import (+ "path/filepath"+ "testing"++ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/updatecheck"+)++func TestResolveModeIsOffWhenBuildIsNotUpdatedFromPublicReleases(t *testing.T) {+ origManaged := ManagedConfigPath+ ManagedConfigPath = filepath.Join(t.TempDir(), "managed.json")+ t.Cleanup(func() {+ ManagedConfigPath = origManaged+ updatecheck.PublicReleases = true+ })+ if err := writeFile(ManagedConfigPath, `{"auto_update":{"mode":"auto"}}`); err != nil {+ t.Fatal(err)+ }+ t.Setenv(AutoUpdateEnv, "auto")++ if got := ResolveMode("auto"); got != ModeAuto {+ t.Fatalf("ResolveMode() = %q, want auto", got)+ }+ updatecheck.PublicReleases = false+ if got := ResolveMode("auto"); got != ModeOff {+ t.Fatalf("ResolveMode() = %q, want off for a build that is not updated from public releases", got)+ }+}diff --git a/cli/beacon/internal/updatecheck/cache.go b/cli/beacon/internal/updatecheck/cache.goindex 463ad2a9..79664ab9 100644--- a/cli/beacon/internal/updatecheck/cache.go+++ b/cli/beacon/internal/updatecheck/cache.go@@ -33,6 +33,9 @@ type Cache struct {// Disabled reports whether the automatic update check is turned off by the environment.// CI runs never check: nobody is there to read the notice.func Disabled(getenv func(string) string) bool {+ if !PublicReleases {+ return true+ }switch strings.ToLower(strings.TrimSpace(getenv(DisableEnv))) {case "0", "false", "off", "no":return truediff --git a/cli/beacon/internal/updatecheck/public_releases_test.go b/cli/beacon/internal/updatecheck/public_releases_test.gonew file mode 100644index 00000000..c6d5564c--- /dev/null+++ b/cli/beacon/internal/updatecheck/public_releases_test.go@@ -0,0 +1,16 @@+package updatecheck++import "testing"++func TestDisabledWhenBuildIsNotUpdatedFromPublicReleases(t *testing.T) {+ t.Cleanup(func() { PublicReleases = true })+ getenv := func(string) string { return "" }++ if Disabled(getenv) {+ t.Fatal("Disabled() with no environment = true, want false")+ }+ PublicReleases = false+ if !Disabled(getenv) {+ t.Fatal("Disabled() = false for a build that is not updated from public releases")+ }+}diff --git a/cli/beacon/internal/updatecheck/source.go b/cli/beacon/internal/updatecheck/source.goindex e7cdc950..0293b295 100644--- a/cli/beacon/internal/updatecheck/source.go+++ b/cli/beacon/internal/updatecheck/source.go@@ -9,6 +9,12 @@ import (const DefaultLatestReleaseURL = "https://api.github.com/repos/asymptote-labs/agent-beacon/releases/latest"+// PublicReleases says whether this build updates from Beacon's public GitHub releases. It is true+// for every build of this repository. A build distributed through another channel sets it to+// false, which turns off the startup notice, `beacon version check`, and the endpoint+// self-updater, so a public release never replaces that build.+var PublicReleases = true+// Release is the latest Beacon release known to an update source.type Release struct {Version stringdiff --git a/cli/beacon/internal/version/edition_test.go b/cli/beacon/internal/version/edition_test.gonew file mode 100644index 00000000..eeab4331--- /dev/null+++ b/cli/beacon/internal/version/edition_test.go@@ -0,0 +1,27 @@+package version++import "testing"++func TestEditionIsReportedOnlyWhenNotDefault(t *testing.T) {+ origVersion, origCommit, origDate, origEdition := Version, GitCommit, BuildDate, Edition+ t.Cleanup(func() {+ Version, GitCommit, BuildDate, Edition = origVersion, origCommit, origDate, origEdition+ })+ Version, GitCommit, BuildDate = "1.2.3", "abc1234", "2026-10-13"++ Edition = DefaultEdition+ if got := GetFullVersion(); got != "1.2.3 (abc1234) built on 2026-10-13" {+ t.Fatalf("default edition changed the version line: %q", got)+ }+ if got := ReportedEdition(); got != "" {+ t.Fatalf("ReportedEdition() = %q for the default edition", got)+ }++ Edition = "partner"+ if got := GetFullVersion(); got != "1.2.3 (abc1234) built on 2026-10-13, partner edition" {+ t.Fatalf("GetFullVersion() = %q", got)+ }+ if got := ReportedEdition(); got != "partner" {+ t.Fatalf("ReportedEdition() = %q", got)+ }+}diff --git a/cli/beacon/internal/version/version.go b/cli/beacon/internal/version/version.goindex a539671b..13de8075 100644--- a/cli/beacon/internal/version/version.go+++ b/cli/beacon/internal/version/version.go@@ -1,5 +1,8 @@package version+// DefaultEdition is the edition of every build made from this repository.+const DefaultEdition = "community"+// These variables are set at build time using ldflagsvar (// Version is the semantic version of the CLI@@ -8,6 +11,10 @@ var (GitCommit = "unknown"// BuildDate is the date the binary was builtBuildDate = "unknown"+ // Edition names the build. A build that compiles in files of its own sets it at link time+ // (-X .../internal/version.Edition=<name>), and `beacon version`, endpoint status and the+ // inventory report it so a fleet can tell its builds apart.+ Edition = DefaultEdition)// GetVersion returns the full version string@@ -15,7 +22,22 @@ func GetVersion() string {return Version}-// GetFullVersion returns the version with commit and build date+// GetFullVersion returns the version with commit and build date, and the edition when it is not+// the default. The edition goes last: the self-updater's health check reads the word right after+// "version" in `beacon version` output and compares it with the version it just installed.func GetFullVersion() string {- return Version + " (" + GitCommit + ") built on " + BuildDate+ full := Version + " (" + GitCommit + ") built on " + BuildDate+ if edition := ReportedEdition(); edition != "" {+ full += ", " + edition + " edition"+ }+ return full+}++// ReportedEdition returns the edition to report, or "" for the default edition, so builds from+// this repository report nothing new.+func ReportedEdition() string {+ if Edition == "" || Edition == DefaultEdition {+ return ""+ }+ return Edition}diff --git a/pkg/asymptoteobserve/privacy.go b/pkg/asymptoteobserve/privacy.goindex a55618dc..4ab914cf 100644--- a/pkg/asymptoteobserve/privacy.go+++ b/pkg/asymptoteobserve/privacy.go@@ -175,7 +175,7 @@ var redactionRules = concatRules([]redactionRule{{regexp.MustCompile(`\b(AIza)[0-9A-Za-z_-]{35}`), "${1}" + redactedValue, nil}, // Google API key{regexp.MustCompile(`\b(npm_)[A-Za-z0-9]{36}`), "${1}" + redactedValue, nil}, // npm{regexp.MustCompile(`\b(hf_)[A-Za-z0-9]{30,}`), "${1}" + redactedValue, nil}, // Hugging Face- {regexp.MustCompile(`\b(bcn_(?:api|device|mcp)_)[A-Za-z0-9_-]{8,}`), "${1}" + redactedValue, nil}, // Beacon's own keys+ {regexp.MustCompile(`\b(bcn_(?:api|device|mcp|enfdev)_)[A-Za-z0-9_-]{8,}`), "${1}" + redactedValue, nil}, // Beacon's own keys{regexp.MustCompile(`\b(eyJ)[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}`), "${1}" + redactedValue, nil}, // JWT})diff --git a/pkg/asymptoteobserve/privacy_test.go b/pkg/asymptoteobserve/privacy_test.goindex b7dd885b..8bd3237f 100644--- a/pkg/asymptoteobserve/privacy_test.go+++ b/pkg/asymptoteobserve/privacy_test.go@@ -139,6 +139,7 @@ func TestRedactStringRedactsCommonCredentialFormats(t *testing.T) {{"google", "AIzaSyA-abcdefghijklmnopqrstuvwxyz012345", "abcdefghijklmnopqrstuvwxyz012345"},{"jwt", "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.dozjgNryP4J3jVmNHl0w5N_XgL0n3I9PlFUP0THsR8U", "dozjgNryP4J3jVmNHl0w5N_XgL0n3I9PlFUP0THsR8U"},{"beacon device key", "bcn_device_abcdefgh_0123456789abcdef", "0123456789abcdef"},+ {"beacon machine credential", "bcn_enfdev_abcdefgh_0123456789abcdef", "0123456789abcdef"},{"rsa key", "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAsecretbody\n-----END RSA PRIVATE KEY-----", "MIIEowIBAAKCAQEAsecretbody"},{"openssh key cut short", "cat ~/.ssh/id_ed25519\n-----BEGIN OPENSSH PRIVATE KEY-----\nb3BlbnNzaC1rZXktdjEAAAAA", "b3BlbnNzaC1rZXktdjEAAAAA"},}