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
fix(lenses): `beacon lenses show` prints the real manifest for built-ins
Claude03d0e2eebb99
diff --git a/cli/beacon/cmd/lenses.go b/cli/beacon/cmd/lenses.goindex a4bb5904..e00a3677 100644--- a/cli/beacon/cmd/lenses.go+++ b/cli/beacon/cmd/lenses.go@@ -133,14 +133,8 @@ var lensesShowCmd = &cobra.Command{SilenceUsage: true,RunE: func(cmd *cobra.Command, args []string) error {id := args[0]- builtins, err := dashboard.BuiltinLenses()- if err != nil {- return err- }- for _, l := range builtins {- if l.ID == id {- return writeIndentedJSON(cmd.OutOrStdout(), map[string]interface{}{"manifest": l, "source": l.Source})- }+ if manifest, ok := dashboard.BuiltinLensManifest(id); ok {+ return writeIndentedJSON(cmd.OutOrStdout(), map[string]interface{}{"manifest": manifest, "source": dashboard.LensSourceBuiltin})}_, manifest, err := lensstore.Read(lensesStoreDir(), id)if err != nil {diff --git a/cli/beacon/cmd/lenses_test.go b/cli/beacon/cmd/lenses_test.goindex 8ed54928..6bb91ef9 100644--- a/cli/beacon/cmd/lenses_test.go+++ b/cli/beacon/cmd/lenses_test.go@@ -80,6 +80,16 @@ func TestLensesAddListShowRemove(t *testing.T) {if err := lensesShowCmd.RunE(cmd, []string{"activity"}); err != nil || !strings.Contains(buf.String(), `"source": "builtin"`) {t.Fatalf("show builtin = %v, %s", err, buf.String())}+ // A built-in's manifest has the same shape as an installed lens's: the real manifest.+ var shown struct {+ Manifest map[string]interface{} `json:"manifest"`+ }+ if err := json.Unmarshal(buf.Bytes(), &shown); err != nil {+ t.Fatal(err)+ }+ if shown.Manifest["api"] != "beacon.lens.v1" || shown.Manifest["author"] != "Beacon" || shown.Manifest["source"] != nil {+ t.Fatalf("built-in manifest = %v", shown.Manifest)+ }cmd, buf = newCmd()if err := lensesRemoveCmd.RunE(cmd, []string{"mine"}); err != nil || !strings.HasPrefix(buf.String(), "removed mine") {diff --git a/cli/beacon/internal/endpoint/dashboard/lenses.go b/cli/beacon/internal/endpoint/dashboard/lenses.goindex 40ed5bf0..5c498347 100644--- a/cli/beacon/internal/endpoint/dashboard/lenses.go+++ b/cli/beacon/internal/endpoint/dashboard/lenses.go@@ -86,6 +86,20 @@ func BuiltinLenses() ([]LensInfo, error) {return registry.list().Lenses, nil}+// BuiltinLensManifest returns the manifest of the built-in lens with id, parsed from its file, so+// callers see the same manifest shape for a built-in lens as for an installed one.+func BuiltinLensManifest(id string) (asymptoteobserve.LensManifestV1, bool) {+ if !asymptoteobserve.ValidLensID(id) {+ return asymptoteobserve.LensManifestV1{}, false+ }+ html, err := builtinLensFiles.ReadFile("lenses/" + id + ".lens.html")+ if err != nil {+ return asymptoteobserve.LensManifestV1{}, false+ }+ manifest, err := asymptoteobserve.CheckLensFile(html)+ return manifest, err == nil+}+// BuiltinLensIDs returns the IDs the built-in lenses hold, which the lens store may not use.func BuiltinLensIDs() (map[string]bool, error) {builtins, err := BuiltinLenses()