Documentation
¶
Overview ¶
Package tapper — on-disk cache of Hub API discovery.
Every CLI invocation used to start with GET /api/version before its first REST request. apiDiscoveryCache remembers each success under CacheRoot so the next invocation within the TTL skips it (see apicontract.Session.Cache). Only successes are written, and a stale one is harmless: the Hub still validates the contract on every request, and its typed rejection evicts the entry.
Package tapper — shared OAuth2 hub helpers.
This file holds the hub-auth building blocks that are independent of any single grant type: RFC 8414 authorization-server metadata discovery, hub URL normalization/canonicalization, and opening the user's browser. The device authorization grant (auth_device_flow.go) composes these; there is no longer a loopback/PKCE flow — `tap auth login` standardizes on the device flow for browser-based login.
The metadata + browser helpers take their external dependencies (HTTP client, runtime) as arguments so the flow stays trivially testable against an httptest.Server mock hub.
Package tapper — OAuth2 refresh-token renewal for cached hub credentials.
The device-login flow now persists a refresh token (plus the client_id and token endpoint it must be presented to) alongside the short-lived access token. RefreshHubToken exchanges that refresh token for a fresh access token so a command whose cached token has expired renews silently instead of forcing the user back through `tap auth login`.
Package tapper — hub authentication store.
AuthStore is the on-disk credentials cache used by the hub-auth flow. It maps a canonical hub URL to an access token and token metadata. The store is intentionally minimal — it does not know how to refresh tokens, talk to a hub, or check expiry. Those concerns live in the caller so the store can stay time-agnostic (no clock dependency) and therefore trivially testable under a frozen clock.
File layout: YAML at <StateRoot>/auth.yaml, mode 0600, parent dir 0700 when we create it. Writes go through rt.AtomicWriteFile so a crash or concurrent reader never sees a half-written credential file.
Package tapper — hub token validation via the whoami probe.
ValidateToken confirms a bearer token resolves to a user on the hub. It backs the "paste an authentication token" login path: the token the user pastes (an API token minted on the hub's account page) is checked against GET /api/v1/whoami before it is written to the AuthStore, so a typo or a revoked token fails fast at login rather than on the first real request.
Package tapper — the Hub's one-call caller context.
GET /api/v1/info answers, in one round trip, what `tap info` otherwise asks the selected Hub in three: who the token belongs to, the active flight, and the identity KEG catalog. Hubs that predate the endpoint answer 404; the client then issues the three requests concurrently and remembers the 404 for the life of the Tap.
Package tapper — hub keg-administration client calls (grants + visibility).
These talk to a remote hub's per-keg admin endpoints under /api/v1/@{namespace}/kegs/{keg}: listing/creating/revoking grants and updating visibility. Like ValidateToken (auth_whoami.go) and CreateKeg (hub_kegs.go) they are slim, dependency-free functions over http.DefaultClient so tests can point hubURL at an httptest.Server.
Package tapper — hub invitation client calls.
Org membership and keg grants are offered, not imposed: adding someone creates an invitation, and access starts only when its invitee accepts it. These talk to the hub's /api/v1/invitations endpoints over doHubJSON.
Package tapper — hub keg-catalog client calls.
These talk to a remote hub's namespace/keg-catalog endpoints (as opposed to the per-keg operation API in pkg/keg/keg_remote.go): creating a keg and listing the kegs a user can reach. They mirror the slim, dependency-free shape of ValidateToken (auth_whoami.go) — a stand-alone function over http.DefaultClient so tests can point hubURL at an httptest.Server.
Package tapper — hub namespace-administration client calls.
These talk to a remote hub's namespace endpoints under /api/v1/namespaces and /api/v1/@{namespace}/members: listing namespaces and managing membership roles. Slim, dependency-free functions over http.DefaultClient (via doHubJSON) so tests can point hubURL at an httptest.Server.
Index ¶
- Constants
- Variables
- func BuildOrientationPayload(flight *Flight, flightNote, launch string, kegs []OrientationKeg, ...) (string, error)
- func CanonicalConfiguredHubURL(s string) string
- func CanonicalHubURL(s string) string
- func CanonicalKegRef(target *keg.Target) string
- func CatViewDocument(ctx context.Context, view keg.NodeView, opts CatOptions) (content, meta, stats string)
- func CheckSearchCover(flight *Flight, kegs []string) error
- func CreateHubKeg(ctx context.Context, hubURL, token, namespace string, in HubKegCreate) error
- func CreateKeg(ctx context.Context, hubURL, token, namespace, alias, title, visibility string) error
- func DeleteHubAgent(ctx context.Context, hubURL, token, namespace, name string) error
- func DeleteHubFlight(ctx context.Context, hubURL, token, namespace, slug, expectedHash string) error
- func DeleteKeg(ctx context.Context, hubURL, token, namespace, alias string) error
- func DescriptionPreview(value string) string
- func EffectiveOrientationRole(row OrientationKeg) string
- func FlightManifestHash(m FlightManifest) string
- func FormatCatViews(ctx context.Context, views []keg.NodeView, opts CatOptions) string
- func HighlightSnippet(snippet string, spans []tapapi.Span, open, close string) string
- func IntegrateHosts() []string
- func IntegratePlugins(host string) ([]string, error)
- func IntegrateScopes(host string) []string
- func IsClaudeModel(model string) bool
- func IsFlightRef(raw string) bool
- func IsHubAgentRef(s string) bool
- func KegBackendLabel(target *keg.Target) string
- func KegLocation(target *keg.Target) string
- func KegTitleWithVersion(title, version string) string
- func KegVersionLabel(version string) string
- func LaunchHarnesses() []string
- func ListHubRelayToolNames(ctx context.Context, hubURL, token string) ([]string, error)
- func LocalGitData(ctx context.Context, rt *toolkit.Runtime, projectPath, key string) ([]byte, error)
- func NewAPIDiscoveryCache(rt *toolkit.Runtime, paths *PathService) apicontract.DiscoveryCache
- func NewAuthAccountKey() string
- func NewAuthStoreTokenResolver(store *AuthStore, rt *toolkit.Runtime, storePath string) keg.TokenResolver
- func NewRunnerMCPServer(svc *RunnerService, version string) *sdkmcp.Server
- func NormalizeKegVersion(raw string) (string, error)
- func OpenBrowser(ctx context.Context, rt *toolkit.Runtime, rawURL string) error
- func OrientationGuide(topic string) (string, error)
- func OrientationOperatingRules() string
- func ParseCanonicalKegRef(raw string) (string, string, error)
- func ParseHubAgentRef(s string) (namespace, name string, err error)
- func ParseKegCreationRef(raw string) (string, string, error)
- func RemoveNamespaceMember(ctx context.Context, hubURL, token, namespace, username string) error
- func RenameKeg(ctx context.Context, hubURL, token, namespace, oldAlias, newAlias string) error
- func ResolveLoginHubURL(cfg *Config, explicit string) (string, error)
- func RevokeGrant(ctx context.Context, hubURL, token, namespace, alias, username string) error
- func RevokeInvitation(ctx context.Context, hubURL, token string, id int64) error
- func SaveAuthLogin(ctx context.Context, rt *toolkit.Runtime, storePath, hubKey string, ...) error
- func SearchHitLines(hits []tapapi.SearchHit, open, close string) []string
- func SearchNextCursorLine(cursor string) string
- func SetKegVisibility(ctx context.Context, hubURL, token, namespace, alias, visibility string) error
- func SetNamespaceMemberRole(ctx context.Context, hubURL, token, namespace, username, role string) error
- func ValidExploreKind(kind ExploreKind) bool
- func ValidateBrowserURL(rawURL, hubURL string) error
- func ValidateKegAlias(alias string) error
- func ValidateNamespace(ns string) error
- func WalkConfigsUp(rt *toolkit.Runtime, start, rel string) []string
- func WithRelationshipResultObserver(ctx context.Context, observer RelationshipResultObserver) context.Context
- type AccessChange
- type AuthEntry
- type AuthLoginDeviceOptions
- type AuthLogoutOptions
- type AuthLogoutResult
- type AuthStatusHub
- type AuthStatusOptions
- type AuthStatusResult
- type AuthStore
- func (s *AuthStore) Delete(hubURL string) bool
- func (s *AuthStore) Get(hubURL string) (*AuthEntry, bool)
- func (s *AuthStore) Hubs() []string
- func (s *AuthStore) IsEmpty() bool
- func (s *AuthStore) Save(ctx context.Context, rt *toolkit.Runtime, path string) error
- func (s *AuthStore) Set(hubURL string, entry AuthEntry)
- type BacklinksOptions
- type BatchCreateNode
- type BatchCreateOptions
- type BatchEditItem
- type BatchEditOptions
- type BatchSnapshotItem
- type BatchSnapshotOptions
- type BootstrapOptions
- type BootstrapResult
- type CatOptions
- type Config
- func (cfg *Config) AddKegMap(entry KegMapEntry) error
- func (cfg *Config) Clone() *Config
- func (cfg *Config) DeleteHub(name string) (bool, error)
- func (cfg *Config) DisableAtlasHub() bool
- func (cfg *Config) DisableTelemetry() bool
- func (cfg *Config) Flight() string
- func (cfg *Config) Hub(name string) (HubEntry, bool)
- func (cfg *Config) HubName() string
- func (cfg *Config) Hubs() map[string]HubEntry
- func (cfg *Config) Keg() string
- func (cfg *Config) KegMap() []KegMapEntry
- func (cfg *Config) LaunchHarness() string
- func (cfg *Config) LaunchModel() string
- func (cfg *Config) LogFile() string
- func (cfg *Config) LogLevel() string
- func (cfg *Config) LookupAlias(rt *toolkit.Runtime, root string) string
- func (cfg *Config) LookupAliasForTarget(_ *toolkit.Runtime, _ string) string
- func (cfg *Config) LookupMapping(rt *toolkit.Runtime, root string) (KegMapEntry, bool)
- func (cfg *Config) Relay() *RelayConfig
- func (cfg *Config) ResolveAlias(rt *toolkit.Runtime, alias string) (*keg.Target, error)
- func (cfg *Config) ResolveDefault(rt *toolkit.Runtime) (*keg.Target, error)
- func (cfg *Config) ResolveKegMap(rt *toolkit.Runtime, projectRoot string) (*keg.Target, error)
- func (cfg *Config) ResolveRef(_ *toolkit.Runtime, ref KegRef) (*keg.Target, error)
- func (cfg *Config) SetDisableAtlasHub(disable bool) error
- func (cfg *Config) SetDisableTelemetry(disable bool) error
- func (cfg *Config) SetFlight(flight string) error
- func (cfg *Config) SetHub(name string, entry HubEntry) error
- func (cfg *Config) SetHubName(_ context.Context, hub string) error
- func (cfg *Config) SetKeg(keg string) error
- func (cfg *Config) SetLogFile(_ context.Context, path string) error
- func (cfg *Config) SetLogLevel(level string) error
- func (cfg *Config) ToYAML() ([]byte, error)
- func (cfg *Config) Write(rt *toolkit.Runtime, path string) error
- type ConfigEditOptions
- type ConfigExplainOptions
- type ConfigExplainResult
- type ConfigLoadWarning
- type ConfigOptions
- type ConfigService
- func (s *ConfigService) Config() (*Config, error)
- func (s *ConfigService) Load() (*Config, []ConfigLoadWarning, error)
- func (s *ConfigService) PinHub() error
- func (s *ConfigService) ProjectConfig() (*Config, error)
- func (s *ConfigService) ReadProjectConfigFile() (*Config, error)
- func (s *ConfigService) ReadUserConfigFile() (*Config, error)
- func (s *ConfigService) Reload()
- func (s *ConfigService) ResolveTarget(alias, nsOverride, hubOverride string) (*keg.Target, error)
- func (s *ConfigService) SelectedHub(explicit string) (string, HubEntry, error)
- func (s *ConfigService) UserConfig() (*Config, error)
- func (s *ConfigService) UserConfigExists() bool
- type ConfigSlot
- type ConfigTemplateOptions
- type ConfigWarning
- type ContextInfoFlight
- type ContextInfoFlightKeg
- type ContextInfoHub
- type ContextInfoKeg
- type ContextInfoResult
- type CreateAgentOptions
- type CreateFlightOptions
- type CreateKegOptions
- type CreateOptions
- type DefaultOperations
- type DeleteAgentOptions
- type DeleteFileOptions
- type DeleteFlightOptions
- type DeleteImageOptions
- type DeleteVideoOptions
- type DeviceUserPrompt
- type DoctorOptions
- type DownloadFileOptions
- type DownloadImageOptions
- type DownloadVideoOptions
- type EditAgentOptions
- type EditFlightOptions
- type EditOptions
- type EditSchemaOptions
- type EmptyEditError
- type ExploreKind
- type ExploreOptions
- type ExploreRequest
- type ExploreResult
- type ExploreRow
- type ExportOptions
- type Flight
- type FlightCover
- type FlightGraph
- type FlightManifest
- type FlightRef
- type FlightRestrictionError
- type FlightRole
- type FlightService
- func (s *FlightService) FlightCatalog(ctx context.Context, hub string, warnings *[]string) ([]*Flight, error)
- func (s *FlightService) GetFlight(ctx context.Context, name string) (*Flight, error)
- func (s *FlightService) GetFlightFresh(ctx context.Context, name string) (*Flight, error)
- func (s *FlightService) ListFlights(ctx context.Context, hub string, warnings *[]string) ([]string, error)
- func (s *FlightService) ResolveFlightGraph(ctx context.Context, root *Flight) (*FlightGraph, error)
- func (s *FlightService) StoreSessionFlight(name string, f *Flight)
- type ForceUnlockOptions
- type GetAgentOptions
- type GetFlightOptions
- type GrepOptions
- type HubAddOptions
- type HubAgent
- func CreateHubAgent(ctx context.Context, hubURL, token, namespace string, in HubAgentWrite) (*HubAgent, error)
- func GetHubAgent(ctx context.Context, hubURL, token, namespace, name string) (*HubAgent, error)
- func ListHubAgents(ctx context.Context, hubURL, token, namespace string) ([]HubAgent, error)
- func UpdateHubAgent(ctx context.Context, hubURL, token, namespace, name string, in HubAgentWrite) (*HubAgent, error)
- type HubAgentWrite
- type HubEffectiveKeg
- type HubEntry
- type HubFlight
- func CreateHubFlight(ctx context.Context, hubURL, token, namespace string, flight HubFlight) (*HubFlight, error)
- func GetHubFlight(ctx context.Context, hubURL, token, namespace, slug string) (*HubFlight, error)
- func ListUserFlights(ctx context.Context, hubURL, token string) ([]HubFlight, error)
- func UpdateHubFlight(ctx context.Context, hubURL, token, namespace, slug string, flight HubFlight, ...) (*HubFlight, error)
- type HubFlightCover
- type HubGrant
- type HubInfo
- type HubInvitation
- type HubKeg
- type HubKegCreate
- type HubListOptions
- type HubMember
- type HubModel
- type HubNamespace
- type HubRemoveOptions
- type HubSetDefaultOptions
- type HubToolCatalog
- type IndexCatOptions
- type IndexOptions
- type InfoOptions
- type InitOptions
- type InstalledRunner
- type IntegrateOptions
- type IntegrateResult
- type InvitationOptions
- type InvocationEvent
- type InvocationReporter
- type Issue
- type KegDeleteOptions
- type KegGrantOptions
- type KegGrantsOptions
- type KegMapEntry
- type KegRef
- type KegRenameOptions
- type KegRevokeOptions
- type KegService
- type KegSettingsEditOptions
- type KegSettingsOptions
- type KegTargetOptions
- type KegVersionNotAppliedError
- type KegVisibilityOptions
- type LaunchOptions
- type LaunchResult
- type LinksOptions
- type ListAgentsOptions
- type ListFilesOptions
- type ListFlightsOptions
- type ListImagesOptions
- type ListOptions
- type ListSortType
- type ListVideosOptions
- type LocalOperations
- type LockOptions
- type LockStatusOptions
- type MergeOptions
- type MetaOptions
- type MoveOptions
- type NamespaceAddMemberOptions
- type NamespaceCreateOptions
- type NamespaceCreateResult
- type NamespaceListOptions
- type NamespaceListResult
- type NamespaceMembersOptions
- type NamespaceRemoveMemberOptions
- type NamespaceSetRoleOptions
- type NodeHistoryOptions
- type NodeRestoreOptions
- type NodeSnapshotOptions
- type NodeSnapshotViewOptions
- type Operations
- type OrientOptions
- type OrientationAuthority
- type OrientationKeg
- type PathService
- type ReadAttachmentOptions
- type ReadImageOptions
- type ReadVideoOptions
- type RefContext
- type Relationship
- type RelationshipResultObserver
- type RelayClaudeRunner
- type RelayConfig
- type RelayMCPServer
- type RelayModelFilter
- type RelayModelMeta
- type RelayOptions
- type RelayProvider
- type RelayRunner
- type RelayRunners
- type RelayToolFilter
- type RelayVariant
- type RemoveOptions
- type ReplaceOptions
- type ResolveKegOptions
- type RunnerInput
- type RunnerOutput
- type RunnerService
- type RunnerSpec
- type SchemaOptions
- type SearchOptions
- type StatsOptions
- type TagsOptions
- type Tap
- func (t *Tap) ActiveAgent() string
- func (t *Tap) ActiveFlightName(explicit string) string
- func (t *Tap) ActiveLaunch() string
- func (t *Tap) AuthLogout(ctx context.Context, opts AuthLogoutOptions) (*AuthLogoutResult, error)
- func (t *Tap) AuthRefreshAll(ctx context.Context)
- func (t *Tap) AuthStatus(ctx context.Context, opts AuthStatusOptions) (*AuthStatusResult, error)
- func (t *Tap) Backlinks(ctx context.Context, opts BacklinksOptions) ([]string, error)
- func (t *Tap) Bootstrap(ctx context.Context, opts BootstrapOptions) (*BootstrapResult, error)
- func (t *Tap) Cat(ctx context.Context, opts CatOptions) (string, error)
- func (t *Tap) CatViews(ctx context.Context, opts CatOptions) ([]keg.NodeView, error)
- func (t *Tap) Config(opts ConfigOptions) (string, error)
- func (t *Tap) ConfigEdit(ctx context.Context, opts ConfigEditOptions) error
- func (t *Tap) ConfigExplain(ctx context.Context, opts ConfigExplainOptions) ([]ConfigExplainResult, error)
- func (t *Tap) ConfigTemplate(opts ConfigTemplateOptions) (string, error)
- func (t *Tap) ContextInfo(ctx context.Context, opts KegTargetOptions) (ContextInfoResult, error)
- func (t *Tap) Create(ctx context.Context, opts CreateOptions) (keg.NodeId, error)
- func (t *Tap) CreateAgent(ctx context.Context, opts CreateAgentOptions) (*HubAgent, error)
- func (t *Tap) CreateBatch(ctx context.Context, opts BatchCreateOptions) ([]keg.CreateNodeResult, error)
- func (t *Tap) CreateFlight(ctx context.Context, opts CreateFlightOptions) (*Flight, error)
- func (t *Tap) CreateSchema(ctx context.Context, opts SchemaOptions) error
- func (t *Tap) DeleteAgent(ctx context.Context, opts DeleteAgentOptions) error
- func (t *Tap) DeleteFile(ctx context.Context, opts DeleteFileOptions) error
- func (t *Tap) DeleteFlight(ctx context.Context, opts DeleteFlightOptions) error
- func (t *Tap) DeleteImage(ctx context.Context, opts DeleteImageOptions) error
- func (t *Tap) DeleteSchema(ctx context.Context, opts SchemaOptions) error
- func (t *Tap) DeleteVideo(ctx context.Context, opts DeleteVideoOptions) error
- func (t *Tap) Doctor(ctx context.Context, opts DoctorOptions) ([]Issue, error)
- func (t *Tap) DoctorConfig() []Issue
- func (t *Tap) DownloadFile(ctx context.Context, opts DownloadFileOptions) (string, error)
- func (t *Tap) DownloadImage(ctx context.Context, opts DownloadImageOptions) (string, error)
- func (t *Tap) DownloadVideo(ctx context.Context, opts DownloadVideoOptions) (string, error)
- func (t *Tap) Edit(ctx context.Context, opts EditOptions) error
- func (t *Tap) EditAgent(ctx context.Context, opts EditAgentOptions) (*HubAgent, error)
- func (t *Tap) EditBatch(ctx context.Context, opts BatchEditOptions) ([]keg.NodeUpdateResult, error)
- func (t *Tap) EditFlight(ctx context.Context, opts EditFlightOptions) (*Flight, error)
- func (t *Tap) EditSchema(ctx context.Context, opts EditSchemaOptions) error
- func (t *Tap) ExploreFlights(ctx context.Context, opts ExploreOptions) (ExploreResult, error)
- func (t *Tap) ExploreKegs(ctx context.Context, opts ExploreOptions) (ExploreResult, error)
- func (t *Tap) ExplorePeople(ctx context.Context, opts ExploreOptions) (ExploreResult, error)
- func (t *Tap) Export(ctx context.Context, opts ExportOptions) (string, error)
- func (t *Tap) ForceUnlock(ctx context.Context, opts ForceUnlockOptions) error
- func (t *Tap) GetAgent(ctx context.Context, opts GetAgentOptions) (*HubAgent, error)
- func (t *Tap) GetFlight(ctx context.Context, opts GetFlightOptions) (*Flight, error)
- func (t *Tap) Grep(ctx context.Context, opts GrepOptions) ([]string, error)
- func (t *Tap) HubAdd(_ context.Context, opts HubAddOptions) error
- func (t *Tap) HubAgent(ctx context.Context, ref string) (*HubAgent, error)
- func (t *Tap) HubList(_ context.Context) ([]HubInfo, error)
- func (t *Tap) HubListKegs(ctx context.Context, opts HubListOptions) ([]string, error)
- func (t *Tap) HubRelayTools(agent string) (endpoint string, token func() string, ok bool)
- func (t *Tap) HubRemove(_ context.Context, opts HubRemoveOptions) error
- func (t *Tap) HubSetDefault(ctx context.Context, opts HubSetDefaultOptions) error
- func (t *Tap) IdentityKegCatalog(ctx context.Context) ([]OrientationKeg, []string, error)
- func (t *Tap) Index(ctx context.Context, opts IndexOptions) (string, error)
- func (t *Tap) IndexCat(ctx context.Context, opts IndexCatOptions) (string, error)
- func (t *Tap) Info(ctx context.Context, opts InfoOptions) (string, error)
- func (t *Tap) InitKeg(ctx context.Context, options InitOptions) (*keg.Target, error)
- func (t *Tap) Integrate(ctx context.Context, opts IntegrateOptions) (*IntegrateResult, error)
- func (t *Tap) InvitationAccept(ctx context.Context, opts InvitationOptions) (*HubInvitation, error)
- func (t *Tap) InvitationDecline(ctx context.Context, opts InvitationOptions) (*HubInvitation, error)
- func (t *Tap) InvitationList(ctx context.Context, opts InvitationOptions) ([]HubInvitation, error)
- func (t *Tap) InvitationRevoke(ctx context.Context, opts InvitationOptions) error
- func (t *Tap) KegDelete(ctx context.Context, opts KegDeleteOptions) (string, error)
- func (t *Tap) KegGrant(ctx context.Context, opts KegGrantOptions) (AccessChange, error)
- func (t *Tap) KegGrants(ctx context.Context, opts KegGrantsOptions) ([]HubGrant, error)
- func (t *Tap) KegRename(ctx context.Context, opts KegRenameOptions) error
- func (t *Tap) KegRevoke(ctx context.Context, opts KegRevokeOptions) error
- func (t *Tap) KegSettings(ctx context.Context, opts KegSettingsOptions) (string, error)
- func (t *Tap) KegSettingsEdit(ctx context.Context, opts KegSettingsEditOptions) error
- func (t *Tap) KegSettingsHash(ctx context.Context, opts KegTargetOptions) (string, error)
- func (t *Tap) KegVisibility(ctx context.Context, opts KegVisibilityOptions) error
- func (t *Tap) Launch(ctx context.Context, opts LaunchOptions) (*LaunchResult, error)
- func (t *Tap) Links(ctx context.Context, opts LinksOptions) ([]string, error)
- func (t *Tap) List(ctx context.Context, opts ListOptions) ([]string, error)
- func (t *Tap) ListAgents(ctx context.Context, opts ListAgentsOptions) ([]HubAgent, error)
- func (t *Tap) ListFiles(ctx context.Context, opts ListFilesOptions) ([]string, error)
- func (t *Tap) ListFlights(ctx context.Context, opts ListFlightsOptions) ([]string, error)
- func (t *Tap) ListImages(ctx context.Context, opts ListImagesOptions) ([]string, error)
- func (t *Tap) ListIndexes(ctx context.Context, opts IndexCatOptions) ([]string, error)
- func (t *Tap) ListSchemas(ctx context.Context, opts SchemaOptions) ([]string, error)
- func (t *Tap) ListVideos(ctx context.Context, opts ListVideosOptions) ([]string, error)
- func (t *Tap) Lock(ctx context.Context, opts LockOptions) (keg.LockToken, error)
- func (t *Tap) LockStatus(ctx context.Context, opts LockStatusOptions) (keg.LockInfo, error)
- func (t *Tap) LookupKeg(ctx context.Context, kegAlias string) (keg.Keg, error)
- func (t *Tap) Merge(ctx context.Context, opts MergeOptions) (keg.MergeNodesResult, error)
- func (t *Tap) Meta(ctx context.Context, opts MetaOptions) (string, error)
- func (t *Tap) Move(ctx context.Context, opts MoveOptions) error
- func (t *Tap) NamespaceAddMember(ctx context.Context, opts NamespaceAddMemberOptions) (AccessChange, error)
- func (t *Tap) NamespaceCreate(ctx context.Context, opts NamespaceCreateOptions) (*NamespaceCreateResult, error)
- func (t *Tap) NamespaceList(ctx context.Context, opts NamespaceListOptions) (NamespaceListResult, error)
- func (t *Tap) NamespaceMembers(ctx context.Context, opts NamespaceMembersOptions) ([]HubMember, error)
- func (t *Tap) NamespaceRemoveMember(ctx context.Context, opts NamespaceRemoveMemberOptions) error
- func (t *Tap) NamespaceSetRole(ctx context.Context, opts NamespaceSetRoleOptions) error
- func (t *Tap) NodeHash(ctx context.Context, opts KegTargetOptions, rawID string) (string, error)
- func (t *Tap) NodeHistory(ctx context.Context, opts NodeHistoryOptions) ([]keg.Snapshot, error)
- func (t *Tap) NodeRestore(ctx context.Context, opts NodeRestoreOptions) error
- func (t *Tap) NodeSnapshot(ctx context.Context, opts NodeSnapshotOptions) (keg.Snapshot, error)
- func (t *Tap) NodeSnapshotBatch(ctx context.Context, opts BatchSnapshotOptions) ([]keg.Snapshot, error)
- func (t *Tap) NodeSnapshotView(ctx context.Context, opts NodeSnapshotViewOptions) ([]byte, error)
- func (t *Tap) Orient(ctx context.Context, opts OrientOptions) (string, error)
- func (t *Tap) OrientationKegsForFlight(ctx context.Context, flight *Flight) ([]OrientationKeg, []string, error)
- func (t *Tap) ReadAttachment(ctx context.Context, opts ReadAttachmentOptions) ([]byte, string, error)
- func (t *Tap) ReadImage(ctx context.Context, opts ReadImageOptions) ([]byte, string, error)
- func (t *Tap) ReadSchema(ctx context.Context, opts SchemaOptions) ([]byte, error)
- func (t *Tap) ReadVideo(ctx context.Context, opts ReadVideoOptions) ([]byte, string, error)
- func (t *Tap) Relay(ctx context.Context, opts RelayOptions) error
- func (t *Tap) Remove(ctx context.Context, opts RemoveOptions) error
- func (t *Tap) Replace(ctx context.Context, opts ReplaceOptions) (keg.ReplaceTextResult, error)
- func (t *Tap) ResolveLaunch(opts LaunchOptions) (*LaunchResult, error)
- func (t *Tap) ResolveLaunchContext(ctx context.Context, opts LaunchOptions) (*LaunchResult, error)
- func (t *Tap) ResolveNodeRef(ctx context.Context, ref *keg.NodeRef, rc RefContext) (keg.Keg, keg.NodeId, error)
- func (t *Tap) SchemaHash(ctx context.Context, opts SchemaOptions) (string, error)
- func (t *Tap) Search(ctx context.Context, opts SearchOptions) (*tapapi.SearchResponse, error)
- func (t *Tap) SelectedHubIdentity(ctx context.Context) (*WhoAmI, error)
- func (t *Tap) SetBootstrapFlight(ctx context.Context, ref string) error
- func (t *Tap) SetKeg(ctx context.Context, ref string) error
- func (t *Tap) Stats(ctx context.Context, opts StatsOptions) (string, error)
- func (t *Tap) Tags(ctx context.Context, opts TagsOptions) ([]string, error)
- func (t *Tap) TrashList(ctx context.Context, opts KegTargetOptions) ([]keg.TrashEntry, error)
- func (t *Tap) TrashRestore(ctx context.Context, opts TrashRestoreOptions) error
- func (t *Tap) Unlock(ctx context.Context, opts UnlockOptions) error
- func (t *Tap) UpdateFlight(ctx context.Context, opts UpdateFlightOptions) (*Flight, error)
- func (t *Tap) UploadFile(ctx context.Context, opts UploadFileOptions) (string, error)
- func (t *Tap) UploadImage(ctx context.Context, opts UploadImageOptions) (string, error)
- func (t *Tap) UploadVideo(ctx context.Context, opts UploadVideoOptions) (string, error)
- func (t *Tap) Use(ctx context.Context, opts UseOptions) error
- func (t *Tap) UseStatus(_ context.Context, opts KegTargetOptions) (string, error)
- func (t *Tap) Validate(ctx context.Context, opts ValidateOptions) ([]keg.SchemaValidationResult, error)
- func (t *Tap) WatchNode(ctx context.Context, opts WatchNodeOptions) (<-chan keg.NodeEvent, error)
- func (t *Tap) WebURL(ctx context.Context, opts WebURLOptions) (WebURL, error)
- type TapOptions
- type ToolCategory
- type ToolCategoryInfo
- type TrashRestoreOptions
- type UnlockOptions
- type UpdateFlightOptions
- type UploadFileOptions
- type UploadImageOptions
- type UploadVideoOptions
- type UseOptions
- type ValidateOptions
- type WatchNodeOptions
- type WebURL
- type WebURLOptions
- type WhoAmI
Constants ¶
const ( TapConfigSchemaURL = schemas.TapConfigURL // DefaultHubName is the compiled-in name of the default remote hub. DefaultHubName = "atlas" // DefaultHubURL is the compiled-in fallback hub used by ResolveLoginHubURL // and Config.Hub when no selected or explicitly configured // configured hub is available and the implicit default has not been // disabled. The constant exists so the fallback target is auditable: a // deployment that needs to prove no implicit network calls happen sets // disableAtlasHub: true (or TAP_DISABLE_ATLAS_HUB=1) and the chain // errors out instead of falling through here. DefaultHubURL = "https://atlas.foldwise.ai" // DefaultHubTokenEnv is the conventional environment variable name for // explicitly configured Atlas API credentials. Defaults do not require it. DefaultHubTokenEnv = "ATLAS_API_KEY" )
const ( // DefaultAppName is the base directory name used for Tapper user // configuration. Helpers use this value to build platform specific config // paths, for example: // $XDG_CONFIG_HOME/tapper (or ~/.config/tapper) on Unix-like systems // %APPDATA%\tapper on Windows // Example config file: // $XDG_CONFIG_HOME/tapper/aliases.yaml DefaultAppName = "tapper" // DefaultLocalConfigDir is the directory name used for repository or // project local configuration. DefaultLocalConfigDir = ".tapper" )
Config version strings identify KEG settings schema versions. Each constant is a stable identifier for a particular config schema. When a new schema is introduced add a new constant and update the Config alias to point to the latest version. These values are used by parsing and migration code (for example ParseConfigData) to detect older formats and perform upgrades. Use a YYYY-MM format for easy sorting and human readability.
const ( // FlightRoleNone blocks a KEG: listed with it, the KEG is out of the // flight's cover however its links reach it, and grants nothing. FlightRoleNone FlightRole = "none" FlightRoleViewer FlightRole = "viewer" FlightRoleEditor FlightRole = "editor" FlightRoleAdmin FlightRole = "admin" FlightVisibilityPrivate = "private" FlightVisibilityPublic = "public" // MaxFlightSubflights bounds the ordered direct allowlist on one manifest. MaxFlightSubflights = 64 // MaxFlightGraphDescendants bounds unique reachable flights, excluding the // pinned root. Shared descendants count once. This is the only bound on // traversal: it is enforced inline during the breadth-first walk and is // dedup-based, so it holds regardless of the graph's shape. MaxFlightGraphDescendants = 256 )
const ( // RunnerRootsEnv lists the directories (os.PathListSeparator-separated) // a task's cwd must be under. Unset means $HOME. RunnerRootsEnv = "TAP_RUNNER_ROOTS" // RunnerTimeoutEnv bounds one task, as a Go duration. Unset means // DefaultRunnerTimeout. RunnerTimeoutEnv = "TAP_RUNNER_TIMEOUT" // RunnerDepthEnv counts how many runner delegations deep a process is. // A runner's child gets it incremented; a server that sees 1 or more // refuses every call, so a delegated agent cannot delegate again. RunnerDepthEnv = "TAP_RUNNER_DEPTH" // RelayToolsEnv set to "off" keeps `tap mcp` from offering relayed tools. // Runner children get it so they cannot reach back into the relay. RelayToolsEnv = "TAP_RELAY_TOOLS" )
Environment variables `tap runner serve` reads and sets.
const ( // BootstrapKindCloud targets the compiled-in atlas remote hub. BootstrapKindCloud = "cloud" // BootstrapKindEnterprise registers a user-supplied remote HTTP endpoint. BootstrapKindEnterprise = "enterprise" )
Bootstrap deployment kinds. Each maps onto an existing hub kind/shape — there is no new config field, only a guided way to pick one.
const ( // LaunchInferenceSplit keeps Claude Code on the user's own Claude login // for Claude models and adds the Hub catalog beside them: the forwarder // routes each request by the model it names. LaunchInferenceSplit = "split" // LaunchInferenceHub sends every model request to Hub. LaunchInferenceHub = "hub" // LaunchInferenceSubscription leaves model requests alone entirely; // Hub supplies only tools and agents. LaunchInferenceSubscription = "subscription" )
Inference modes for a Claude Code launch.
const ( WebURLKindNamespace = "namespace" WebURLKindKeg = "keg" WebURLKindNode = "node" WebURLKindFlight = "flight" )
WebURL kinds: what a Hub web page shows.
const DefaultAnthropicURL = "https://api.anthropic.com"
DefaultAnthropicURL is where a split launch sends Claude models when the launching environment names no ANTHROPIC_BASE_URL of its own.
const DefaultRunnerTimeout = 30 * time.Minute
DefaultRunnerTimeout bounds one runner task when nothing else is set.
const DevPluginVersion = "0.0.0-dev"
DevPluginVersion is the version an unreleased binary reports. Manifests must carry something semver-shaped, and the goreleaser ldflags default (pkg/cli.Version == "dev") is not.
const ( // FlightManifestSchemaURL is the published JSON Schema for flight manifest // YAML. Editor modelines prefer the local copy materialized by pkg/schemas // and fall back to this. FlightManifestSchemaURL = schemas.FlightManifestURL )
const IDOnlyFormat = "%i"
IDOnlyFormat is the listing format that prints only node IDs, which every surface's id-only shorthand expands to.
const ( // InvocationTelemetryInFlightWait bounds how long Close waits for a send // that is already in flight. Close never starts a send of its own. InvocationTelemetryInFlightWait = 100 * time.Millisecond )
const RelayClaudeToolsServer = "claude-tools"
RelayClaudeToolsServer names the built-in server that offers Claude Code's own tools. Each runner server is named for its harness (RunnerSpec.Name).
Variables ¶
var ConfigExplainFields = []string{
"keg",
"flight",
"logFile",
"logLevel",
"hub",
"disableAtlasHub",
"disableTelemetry",
}
ConfigExplainFields lists the scalar config fields eligible for explain.
var DefaultSubagentBuiltins = []string{"Read", "Grep", "Glob"}
DefaultSubagentBuiltins are the Claude Code built-in tools a Hub subagent gets: read-only, so a Hub agent's authority stays what its tools say.
var ErrAtlasHubDisabled = errors.New("no hub configured; implicit atlas hub disabled")
ErrAtlasHubDisabled is returned by ResolveLoginHubURL when the chain would fall through to the compiled-in DefaultHubURL but the deployment has opted out via Config.DisableAtlasHub. Callers surface it verbatim so SOC2-conscious users see a stable string they can grep for.
var ErrFlightSubflightNotAllowed = errors.New("flight is not available from the pinned root")
ErrFlightSubflightNotAllowed marks a selection outside the immutable root's live, identity-accessible transitive graph. The historical name is retained for callers that classify this authority denial; selection is no longer limited to direct children.
var ErrInvitationVoid = errors.New("invitation is no longer valid")
ErrInvitationVoid reports an invitation that can no longer be accepted because whoever sent it can no longer extend the access.
var ErrNoCreateContent = errors.New("no content to create a node from: pipe the node on stdin, or run in a terminal to open an editor")
ErrNoCreateContent is returned when there is nothing to build a node from: no piped stdin and no terminal to open an editor on. A node's title is its content's H1 and there is no other source, so an empty create has nothing to title the node with. Creating one anyway is what produced the opaque "node title is required" rejection from the hub.
var ErrNotBootstrapped = errors.New("tapper is not set up on this machine; run `tap bootstrap` to get started")
ErrNotBootstrapped is returned by hub/namespace-dependent operations on the full `tap` surface when no user config exists yet — i.e. `tap bootstrap` has not been run.
ErrRankedSearchUnavailable reports that ranked search cannot run for the target: it is not a Hub KEG, or its Hub predates ranked search. Regex matching (Tap.Grep, `tap node grep`, node_grep) still works in both cases. It matches keg.ErrNotSupported, so every surface reports NOT_SUPPORTED and points the caller at a supported tool rather than at a partial write.
var ErrRefreshRejected = errors.New("auth refresh: hub rejected refresh token")
ErrRefreshRejected means the hub refused the refresh token itself: its token endpoint answered with an OAuth error body whose `error` is invalid_grant or invalid_client, whatever the HTTP status. The sign-in is gone and only a new `tap auth login` restores it. Every other failure is not a refusal and may succeed on a later attempt: an unreachable hub, a 5xx, a server_error or invalid_request answer, or a body that does not parse as an OAuth error.
var ErrRelayDisabled = errors.New("the relay is disabled in your user config (relay.enabled: false)")
ErrRelayDisabled means the user config turns the relay off.
var ErrRelayNotConfigured = errors.New("nothing to relay; add a relay.providers or relay.mcp block to your user config, or install a coding agent CLI for the built-in runners")
ErrRelayNotConfigured means the relay has nothing to offer: no providers, no MCP servers, and no built-in server (no coding agent CLI on PATH, or relay.runners turned off).
var ErrTokenRejected = errors.New("hub rejected the token")
ErrTokenRejected marks a token the hub actively refused (HTTP 401/403), as distinct from a transport failure (hub unreachable). Callers use errors.Is to tell "your token is bad" apart from "we couldn't reach the hub" — see Tap.AuthStatus, which renders those two cases differently.
var Runners = []RunnerSpec{
{Name: "claude", Binary: "claude", Tool: "claude_code_run", Title: "Claude Code",
Permissions: "Claude Code applies your permission settings; in print mode it denies any action that would need an interactive prompt."},
{Name: "codex", Binary: "codex", Tool: "codex_run", Title: "Codex",
Permissions: "Codex applies your config; `codex exec` runs in a read-only sandbox unless your config grants more."},
{Name: "opencode", Binary: "opencode", Tool: "opencode_run", Title: "opencode",
Permissions: "opencode applies your permission config to every tool it uses."},
{Name: "pi", Binary: "pi", Tool: "pi_run", Title: "pi",
Permissions: "pi runs with the tools and settings of your pi configuration."},
}
Runners are the coding agent CLIs `tap runner serve` knows, in tool order.
var ToolCategories = []ToolCategoryInfo{ {ToolCategorySession, "who you are and what this session may do; always available."}, {ToolCategoryMemory, "read and write notes in the KEGs this session covers. Your own KEGs, flights, schemas, and tags are listed, never searched; node_search finds notes."}, {ToolCategoryExplore, "search the hub's public directory of KEGs, flights, and people. Read-only, and a result never grants access."}, {ToolCategoryManage, "change the memory system itself: create and delete KEGs, edit settings and schemas, repair indexes and locks, and manage flights and agents. Writing a note never needs these."}, }
ToolCategories lists the categories in the order agents see them.
Functions ¶
func BuildOrientationPayload ¶ added in v0.35.0
func BuildOrientationPayload(flight *Flight, flightNote, launch string, kegs []OrientationKeg, warnings []string, authority *OrientationAuthority) (string, error)
BuildOrientationPayload renders the provider-neutral orientation document from one flight snapshot and its effective KEG listing. launch describes the `tap launch` session driving the process (see Tap.ActiveLaunch), or "" when a human is.
func CanonicalConfiguredHubURL ¶ added in v0.39.0
CanonicalConfiguredHubURL returns the AuthStore identity for a configured hub URL. Config accepts bare hosts and gives them an HTTPS default, while CanonicalHubURL deliberately operates only on the URL it is handed. Keep that distinction explicit at alias-to-auth identity boundaries.
func CanonicalHubURL ¶ added in v0.20.0
CanonicalHubURL returns the canonical form used as the AuthStore key. It strips trailing slashes, lowercases the scheme and host, and preserves the path exactly (per RFC 3986 the path is case-sensitive). Invalid URLs fall through to TrimRight'd input so callers don't have to pre-validate — they'll hit a clearer error at the login step.
func CanonicalKegRef ¶ added in v0.37.0
CanonicalKegRef returns the @namespace/keg reference for a resolved target, or "" when the target names no namespaced keg.
func CatViewDocument ¶ added in v0.40.0
func CatViewDocument(ctx context.Context, view keg.NodeView, opts CatOptions) (content, meta, stats string)
CatViewDocument returns the machine-readable parts of one node view under opts, for callers handing structured data to a client instead of rendering it for a human.
The fields deliberately mirror the write surface: content and meta are exactly what `node_edit` accepts, so a read result can be modified and sent back without parsing the rendered output. That is why this does not return the composed `---meta---body` document — `node_edit` rejects frontmatter inside content, so a composed blob could not be round-tripped.
func CheckSearchCover ¶ added in v0.47.0
CheckSearchCover refuses a search that names KEGs outside the flight's cover, naming every one of them. Naming KEGs only narrows a flight's search; it never reaches past the cover. kegs are canonical "@namespace/alias" references, as SearchOptions.Validate returns them. A nil flight (no-flight full access) restricts nothing.
func CreateHubKeg ¶ added in v0.46.0
func CreateHubKeg(ctx context.Context, hubURL, token, namespace string, in HubKegCreate) error
CreateHubKeg asks the hub to create a KEG in namespace via POST /api/v1/@{namespace}/kegs. A 409 maps by the error envelope's code: KEG_VERSION_UNSUPPORTED (the Hub does not offer the requested KEG version, such as KEGv2 while its preview is off) wraps keg.ErrKegVersionUnsupported, and EXIST, CONFLICT, or a 409 without a code wraps keg.ErrExist so callers can detect "already exists" with errors.Is. 400 wraps keg.ErrInvalid (an unknown KEG version, for example); 401 wraps ErrTokenRejected; 403 wraps keg.ErrForbidden; other non-2xx statuses surface the hub's status line.
func CreateKeg ¶ added in v0.23.0
func CreateKeg(ctx context.Context, hubURL, token, namespace, alias, title, visibility string) error
CreateKeg asks the hub to create @namespace/alias with the Hub's default KEG version. See CreateHubKeg.
func DeleteHubAgent ¶ added in v0.44.0
DeleteHubAgent removes an agent. The caller must be a namespace owner or admin.
func DeleteHubFlight ¶ added in v0.23.0
func DeleteKeg ¶ added in v0.41.0
DeleteKeg permanently deletes a KEG and all dependent data, including snapshots. There is no expected hash: the settings hash does not cover a whole KEG.
func DescriptionPreview ¶ added in v0.41.0
DescriptionPreview collapses whitespace and bounds discovery text to 240 Unicode characters.
func EffectiveOrientationRole ¶ added in v0.39.0
func EffectiveOrientationRole(row OrientationKeg) string
EffectiveOrientationRole intersects the identity role with the flight cap. Identity catalog rows have no cap and therefore retain their identity role only for metadata search; operational projections always carry a cap.
func FlightManifestHash ¶ added in v0.39.0
func FlightManifestHash(m FlightManifest) string
FlightManifestHash returns the deterministic revision token for a manifest.
func FormatCatViews ¶ added in v0.39.0
FormatCatViews renders views the way Cat does. It is exported so a caller that already holds the views — one that needed CatViews for the per-node hashes — can produce the same text without reading the nodes a second time. Re-reading would also double every access touch.
func HighlightSnippet ¶ added in v0.46.0
HighlightSnippet wraps each highlight span of snippet, given in rune offsets, in open and close markers. Spans are applied in order; a span that is empty, inverted, out of range, or overlaps an earlier one is clamped or skipped rather than trusted.
func IntegrateHosts ¶ added in v0.19.0
func IntegrateHosts() []string
IntegrateHosts returns the hosts `tap integrate` can install for, sorted. It backs the positional argument's shell completion.
func IntegratePlugins ¶ added in v0.30.0
IntegratePlugins returns the plugin names advertised by the host's embedded rendered marketplace. The marketplace, rather than installer code, is the source of truth as new optional plugins are added.
func IntegrateScopes ¶ added in v0.43.0
IntegrateScopes returns the --scope values a host accepts, most-default first. An unknown host returns nil, which shell completion renders as no suggestions rather than an error.
func IsClaudeModel ¶ added in v0.45.0
IsClaudeModel reports whether model names one of Anthropic's own models (claude-*, or an alias Claude Code resolves) rather than a Hub catalog id. A [1m]-style context suffix is ignored.
func IsFlightRef ¶ added in v0.46.0
IsFlightRef reports whether raw is spelled as a flight reference: a bare +slug or @namespace/+slug.
func IsHubAgentRef ¶ added in v0.44.0
IsHubAgentRef reports whether s names a Hub agent (@namespace/name) rather than an entry in the local agents config.
func KegBackendLabel ¶ added in v0.22.0
KegBackendLabel returns a stable, path-free identifier for a keg target suitable for user-facing output. It is used by surfaces that must describe "what kind of keg is this" without leaking the remote URL or other location-revealing details.
Mapping by scheme:
- hub: "keg:@<namespace>/<kegName>"
- http(s): "http" or "https"
- other/unknown: the scheme string, or "" when target is nil
The hub label is the canonical keg reference (Target.String): the real "keg" scheme with the hub resolved from the namespace, never encoded in the string.
func KegLocation ¶ added in v0.23.0
KegLocation renders where a remotely hosted keg lives for user-facing output after `tap keg create`: "on <hubURL>", or "" when no concrete location is known. Unlike KegBackendLabel it intentionally reveals the URL so a fresh create says exactly where the keg landed.
func KegTitleWithVersion ¶ added in v0.46.0
KegTitleWithVersion appends a KEG's version label to its display title.
func KegVersionLabel ¶ added in v0.46.0
KegVersionLabel names a non-default KEG version for display. KEGv1, the default, and an unreported version both yield "", so their output is unchanged.
func LaunchHarnesses ¶ added in v0.37.0
func LaunchHarnesses() []string
LaunchHarnesses returns the launchable harness names, sorted. It backs shell completion the way IntegrateHosts does for `tap integrate`.
func ListHubRelayToolNames ¶ added in v0.45.0
ListHubRelayToolNames returns the names of the relayed MCP tools the caller can reach, as Hub lists them to an agent that allows relayed tools.
func LocalGitData ¶
func LocalGitData(ctx context.Context, rt *toolkit.Runtime, projectPath, key string) ([]byte, error)
LocalGitData attempts to run `git -C projectPath config --local --get key`.
If git is not present or the command fails it returns an error. The returned bytes are trimmed of surrounding whitespace. The function logs diagnostic messages using the logger from rt.
func NewAPIDiscoveryCache ¶ added in v0.47.0
func NewAPIDiscoveryCache(rt *toolkit.Runtime, paths *PathService) apicontract.DiscoveryCache
NewAPIDiscoveryCache returns the discovery cache under paths' CacheRoot, or nil when there is nowhere to keep it.
func NewAuthAccountKey ¶ added in v0.47.0
func NewAuthAccountKey() string
NewAuthAccountKey mints a fresh AuthEntry.AccountKey.
func NewAuthStoreTokenResolver ¶ added in v0.20.0
func NewAuthStoreTokenResolver(store *AuthStore, rt *toolkit.Runtime, storePath string) keg.TokenResolver
NewAuthStoreTokenResolver returns a keg.TokenResolver backed by store. rt and storePath enable in-place refresh of expired OAuth2 tokens; pass the same runtime and AuthStorePath the store was loaded from. A nil store yields a resolver that always returns "", matching AuthStore's nil-safe contract.
func NewRunnerMCPServer ¶ added in v0.45.0
func NewRunnerMCPServer(svc *RunnerService, version string) *sdkmcp.Server
NewRunnerMCPServer returns the `tap runner serve` MCP server: one tool per installed runner.
func NormalizeKegVersion ¶ added in v0.46.0
NormalizeKegVersion trims a requested KEG version and rejects an unknown one with keg.ErrInvalid. Empty stays empty: the Hub chooses the default.
func OpenBrowser ¶ added in v0.23.0
OpenBrowser launches the platform-native "open URL" command and returns once the process has been started. We do NOT wait for exit because most browsers daemonize and exec.Wait would deadlock the CLI behind the user's window manager.
Quarantined stdlib exception (like pkg/tapper/editor_live.go): this spawns an external browser process whose timing is governed by the user's environment rather than any in-process clock. Routing through exec.CommandContext keeps cancellation working if the caller ctx is cancelled before the command launches.
On unrecognized platforms or launch failure, we print the URL to rt.Stream().Err so the user can copy-paste it manually — that's a successful fallback, not a hard error.
func OrientationGuide ¶ added in v0.41.0
OrientationGuide serves canonical detailed guidance on demand.
func OrientationOperatingRules ¶ added in v0.39.0
func OrientationOperatingRules() string
OrientationOperatingRules returns the static KEG operating preamble: what a KEG is, and the rules for working in one. It carries no session state, so an MCP server can deliver it once at initialization and let a caller that already knows which flight to pass start work without orienting first.
Orientation carries a concise reminder after context resets. The guide tool serves this full preamble and canonical operating guidance on demand.
func ParseCanonicalKegRef ¶ added in v0.42.0
ParseCanonicalKegRef splits an explicit @namespace/keg reference into its two validated segments. Every surface that accepts a canonical reference parses through here, so the reference rule has exactly one implementation.
func ParseHubAgentRef ¶ added in v0.44.0
ParseHubAgentRef splits "@namespace/name".
func ParseKegCreationRef ¶ added in v0.42.0
ParseKegCreationRef validates the single creation destination before any I/O. The message names the expected shape rather than a command, because callers include hosted MCP clients that have no CLI to run.
func RemoveNamespaceMember ¶ added in v0.23.0
RemoveNamespaceMember removes a member via DELETE /api/v1/@{namespace}/members/@{username}.
func RenameKeg ¶ added in v0.25.0
RenameKeg updates a keg alias in-place within the same namespace via POST .../rename. The hub keeps the immutable keg id and does not create redirects for the old selector.
func ResolveLoginHubURL ¶ added in v0.20.0
ResolveLoginHubURL returns the selected Hub URL. An explicit URL or saved name wins; otherwise selection follows Config's Hub precedence and fallback.
func RevokeGrant ¶ added in v0.23.0
RevokeGrant removes a grant via DELETE .../grants/@{username}.
func RevokeInvitation ¶ added in v0.44.0
RevokeInvitation withdraws a pending invitation the caller could extend.
func SaveAuthLogin ¶ added in v0.47.0
func SaveAuthLogin(ctx context.Context, rt *toolkit.Runtime, storePath, hubKey string, entry AuthEntry) error
SaveAuthLogin stores entry as the login for hubKey in the auth store at storePath, replacing any earlier login for that hub. It holds the auth store lock while it reads and saves, so a refresh running in another tap process neither loses the write nor overwrites it with the earlier login's tokens.
func SearchHitLines ¶ added in v0.46.0
SearchHitLines renders one tab-separated line per hit: reference, score, title, and the snippet with its highlights wrapped in open and close. CLI and MCP share it so both surfaces show a hit the same way.
func SearchNextCursorLine ¶ added in v0.46.0
SearchNextCursorLine renders the line that hands a text reader the next page's cursor. The CLI prints it to stderr and node_search ends its text with it, so both surfaces show the cursor the same way.
func SetKegVisibility ¶ added in v0.23.0
func SetKegVisibility(ctx context.Context, hubURL, token, namespace, alias, visibility string) error
SetKegVisibility updates a keg's visibility via PATCH .../access. visibility is public|private.
func SetNamespaceMemberRole ¶ added in v0.23.0
func SetNamespaceMemberRole(ctx context.Context, hubURL, token, namespace, username, role string) error
SetNamespaceMemberRole changes a member's role via PATCH /api/v1/@{namespace}/members/@{username}.
func ValidExploreKind ¶ added in v0.46.0
func ValidExploreKind(kind ExploreKind) bool
ValidExploreKind reports whether kind names a directory section.
func ValidateBrowserURL ¶ added in v0.44.0
ValidateBrowserURL accepts web URLs only. Device login supplies hubURL to require the configured origin before displaying or opening server input.
func ValidateKegAlias ¶ added in v0.22.0
ValidateKegAlias returns nil when alias matches the canonical segment shape and a wrapped keg.ErrInvalid otherwise. Empty input is rejected explicitly so callers can distinguish missing-alias errors from shape errors when reading the wrapped chain.
func ValidateNamespace ¶ added in v0.23.0
ValidateNamespace returns nil when ns is a legal namespace segment and a wrapped keg.ErrInvalid otherwise. Empty input is rejected explicitly. The "@" sigil is never part of the stored value; pass the bare namespace.
func WalkConfigsUp ¶ added in v0.23.0
WalkConfigsUp returns the absolute paths of every existing rel file found by walking from start up to the filesystem root, ordered DEEPEST-FIRST (nearest to start first). Missing candidates are skipped. The user-global config is not included; callers layer it underneath the returned project configs.
func WithRelationshipResultObserver ¶ added in v0.41.0
func WithRelationshipResultObserver(ctx context.Context, observer RelationshipResultObserver) context.Context
WithRelationshipResultObserver scopes observation to one explicit operation.
Types ¶
type AccessChange ¶ added in v0.44.0
type AccessChange struct {
Status string `json:"status,omitempty"`
InvitationID int64 `json:"invitation_id,omitempty"`
Username string `json:"username,omitempty"`
Role string `json:"role,omitempty"`
}
AccessChange is the result of adding a member or grant. Invited means the hub created an invitation: nothing changes until the invitee accepts it. Mirrors the hub's 202 body; a 200/201 role change leaves Invited false.
func AddNamespaceMember ¶ added in v0.23.0
func AddNamespaceMember(ctx context.Context, hubURL, token, namespace, username, role string) (AccessChange, error)
AddNamespaceMember invites a member, or changes an existing member's role, via POST /api/v1/@{namespace}/members. role is owner|admin|member. A new member joins only when they accept, which the result reports.
func CreateGrant ¶ added in v0.23.0
func CreateGrant(ctx context.Context, hubURL, token, namespace, alias, username, role string) (AccessChange, error)
CreateGrant sets a grant via POST .../grants. role is viewer|editor|admin. An existing grantee's role changes immediately; anyone else is invited and gains access only when they accept, which the result reports.
func (AccessChange) Invited ¶ added in v0.44.0
func (c AccessChange) Invited() bool
Invited reports whether the change became an invitation.
type AuthEntry ¶ added in v0.20.0
type AuthEntry struct {
AccessToken string `yaml:"access_token"`
TokenType string `yaml:"token_type,omitempty"`
ExpiresAt time.Time `yaml:"expires_at,omitempty"`
Scope string `yaml:"scope,omitempty"`
// RefreshToken, ClientID, and TokenEndpoint are populated by the OAuth2
// device-login flow so the CLI can silently renew an expired AccessToken
// without a re-login (see RefreshHubToken). All three are empty for a
// pasted `thub_` API token, which never expires and cannot be refreshed.
RefreshToken string `yaml:"refresh_token,omitempty"`
ClientID string `yaml:"client_id,omitempty"`
TokenEndpoint string `yaml:"token_endpoint,omitempty"`
// AccountKey is a random, local-only name for the login this entry
// holds. It is minted at login and kept across token refreshes, so state
// that belongs to the login (the telemetry spool) stays put while its
// credentials rotate. It is never sent to a hub.
AccountKey string `yaml:"account_key,omitempty"`
}
AuthEntry is a single hub's cached credential. Plain value type — callers hold copies returned from Get, and pass values into Set.
Fields match the typical OAuth 2.0 shape so we can store whatever a hub returns without transformation. TokenType / ExpiresAt / Scope are all optional: a hub that only returns a bare bearer token will serialize as a single access_token field.
func AuthLoginDevice ¶ added in v0.20.0
func AuthLoginDevice(ctx context.Context, rt *toolkit.Runtime, opts AuthLoginDeviceOptions) (*AuthEntry, error)
AuthLogin runs the device authorization grant against the hub described by opts and returns a populated AuthEntry. The store is not touched — the caller persists the result via AuthStore.Set + Save, mirroring the browser-based AuthLogin contract.
func RefreshHubToken ¶ added in v0.23.0
func RefreshHubToken(ctx context.Context, rt *toolkit.Runtime, hubURL string, entry *AuthEntry) (*AuthEntry, error)
RefreshHubToken exchanges entry.RefreshToken at the hub's token endpoint and returns a new AuthEntry carrying the rotated access + refresh tokens and a recomputed expiry. The hub rotates refresh tokens single-use, so the caller must persist the returned entry (the old refresh token is now spent).
Endpoint/client resolution: the device-login flow records TokenEndpoint and ClientID on the entry, so a refresh is a single POST with no rediscovery. Entries that predate that (or omit the fields) fall back to rediscovering the token endpoint from hubURL and to the stock public client id.
type AuthLoginDeviceOptions ¶ added in v0.20.0
type AuthLoginDeviceOptions struct {
// HubURL is the hub base (e.g. "https://hub.example.com"). Required.
HubURL string
// ClientID is the OAuth2 public client identifier the hub will validate
// against its registered clients. Required.
ClientID string
// Scope is an optional space-separated scope string. Omitted from the
// device_authorization request when empty.
Scope string
// DeviceLabel is an optional human-readable label for this login session.
// Hubs may display it in account/session views.
DeviceLabel string
// Timeout bounds the whole flow including the user's browser action;
// zero uses defaultDeviceTimeout.
Timeout time.Duration
// HTTPClient executes the metadata GET, device_authorization POST, and
// token POSTs. Default: http.DefaultClient.
HTTPClient *http.Client
// PromptOut is the writer that receives the user-facing prompt
// ("Open <URL> and enter <CODE>"). Default: os.Stderr via the runtime
// stream when Out is nil; an in-memory buffer in tests.
PromptOut io.Writer
// OnUserCode, when non-nil, is invoked once the hub has issued the
// user_code + verification URI and before polling begins. It owns the
// user-facing presentation: the CLI installs a handler that prints the
// code, offers to open the browser (gh-style "press Enter to open"),
// and falls back to printing the URL for manual copy/paste. When nil,
// the flow prints a plain copy/paste prompt to PromptOut — the library
// default never opens a browser, keeping pkg/tapper free of any
// interactive/TTY dependency. A non-nil error aborts the login.
OnUserCode func(context.Context, DeviceUserPrompt) error
// Now returns the current time. Default: time.Now. Tests inject a fake
// clock to control timeout behavior deterministically.
Now func() time.Time
// Sleep blocks for d. Default: time.Sleep. Tests inject a no-op or
// channel-coordinated stub so polling loops don't actually wait.
Sleep func(d time.Duration)
}
AuthLoginDeviceOptions is the dependency envelope for AuthLoginDevice. Required: HubURL, ClientID. Everything else has a production default.
type AuthLogoutOptions ¶ added in v0.20.0
type AuthLogoutOptions struct {
// Hub is the raw or canonical hub URL. When empty and exactly one
// hub is stored, auto-resolves to that single entry; otherwise an
// empty Hub with multiple stored hubs surfaces a directed error.
Hub string
}
AuthLogoutOptions selects which hub to log out of. Flat (no KegTargetOptions) because auth state is a user-level concern that spans kegs — a login is per-hub, not per-keg.
type AuthLogoutResult ¶ added in v0.20.0
type AuthLogoutResult struct {
// Removed is true when an entry was actually deleted from the store.
// False when the store was empty or the hub was not found; both of
// those cases are soft-successes (no error returned).
Removed bool
// HubURL is the canonical hub that was targeted, or "" when the
// store was empty.
HubURL string
// Formatted is the authoritative output line terminated with \n.
// CLI routes to stdout when Removed=true, stderr otherwise.
Formatted string
}
AuthLogoutResult is the pre-formatted output plus structured fields for callers that need to route streams or surface structured output. Formatted is authoritative: the CLI emits it verbatim to stdout when Removed=true and stderr otherwise.
type AuthStatusHub ¶ added in v0.28.1
type AuthStatusHub struct {
// Present is false when no matching entry exists.
Present bool
// HubURL is the canonical key that matched.
HubURL string
// TokenPrefix is the first 12 chars of the access token followed by
// "..." — matching the non-secret prefix the hub stores and shows in
// its account UI — or "[set]" when the token is too short for a
// meaningful prefix. The raw token is never exposed here.
TokenPrefix string
// TokenType mirrors the stored entry (e.g. "Bearer"). Empty when
// the hub returned a bare token with no type.
TokenType string
// Account is the username the hub reported for this token via the
// live whoami probe. Empty when validation was skipped (--offline) or
// failed.
Account string
// DisplayName is the human name the hub reported alongside Account.
// Empty when the hub omits it or validation didn't run.
DisplayName string
// PersonalNamespace is the personal namespace the hub reported for the
// account. Nil when the hub didn't say (older hub, --offline, failed
// probe); a pointer to "" when the hub found none.
PersonalNamespace *string
// Valid is true when the live whoami probe confirmed the token. False
// when the token was rejected, the hub was unreachable, or --offline
// skipped the check.
Valid bool
// ValidationError is the error message from a failed/ skipped probe,
// empty on success. Lets structured consumers branch without parsing
// Formatted.
ValidationError string
// Scope mirrors the stored entry. Empty when no scope was granted.
Scope string
// ExpiresAt mirrors the stored entry; zero when no expiry is known.
ExpiresAt time.Time
// ExpiryStatus is a three-way tag: "unknown" | "valid" | "expired".
// Made explicit so callers (and future JSON consumers) don't have
// to re-derive from ExpiresAt vs clock.
ExpiryStatus string
// LoginMethod records how the credential was obtained: "device" for the
// OAuth2 browser/device flow (carries client + refresh + token endpoint),
// "token" for a pasted API token. Lets structured consumers branch without
// parsing Formatted.
LoginMethod string
// Renewable is true when a refresh token is stored — i.e. the access token
// renews silently on expiry rather than forcing a re-login. Always false
// for a pasted API token.
Renewable bool
// Formatted is the exact block rendered for this hub. Terminated with a
// trailing newline.
Formatted string
}
AuthStatusHub is the per-hub structured status used by AuthStatusResult.Hubs. Formatted is the exact block rendered for this hub, terminated with a trailing newline.
type AuthStatusOptions ¶ added in v0.20.0
type AuthStatusOptions struct {
// Hub is a raw or canonical hub URL. When empty, AuthStatus reports every
// stored hub login; an empty store surfaces a directed empty message (see
// AuthStatus docs).
Hub string
// Offline skips the live whoami probe and reports purely from the
// on-disk store (no network, no account name). Useful for scripts,
// air-gapped use, or when an agent must not make outbound calls.
Offline bool
}
AuthStatusOptions selects which hub to report on. Flat (no KegTargetOptions) because auth state is a user-level concern that spans kegs — a login is per-hub, not per-keg.
type AuthStatusResult ¶ added in v0.20.0
type AuthStatusResult struct {
// Present is false when no matching entry exists (empty store
// with no --hub, or --hub that isn't in the store).
Present bool
// HubURL is the canonical key that matched. Zero-value when the
// caller omitted --hub and the store is empty.
HubURL string
// TokenPrefix is the first 12 chars of the access token followed by
// "..." — matching the non-secret prefix the hub stores and shows in
// its account UI — or "[set]" when the token is too short for a
// meaningful prefix. The raw token is never exposed here.
TokenPrefix string
// TokenType mirrors the stored entry (e.g. "Bearer"). Empty when
// the hub returned a bare token with no type.
TokenType string
// Account is the username the hub reported for this token via the
// live whoami probe. Empty when validation was skipped (--offline) or
// failed.
Account string
// DisplayName is the human name the hub reported alongside Account.
// Empty when the hub omits it or validation didn't run.
DisplayName string
// PersonalNamespace is the personal namespace the hub reported for the
// account. Nil when the hub didn't say (older hub, --offline, failed
// probe); a pointer to "" when the hub found none.
PersonalNamespace *string
// Valid is true when the live whoami probe confirmed the token. False
// when the token was rejected, the hub was unreachable, or --offline
// skipped the check.
Valid bool
// ValidationError is the error message from a failed/ skipped probe,
// empty on success. Lets structured consumers branch without parsing
// Formatted.
ValidationError string
// Scope mirrors the stored entry. Empty when no scope was granted.
Scope string
// ExpiresAt mirrors the stored entry; zero when no expiry is known.
ExpiresAt time.Time
// ExpiryStatus is a three-way tag: "unknown" | "valid" | "expired".
// Made explicit so callers (and future JSON consumers) don't have
// to re-derive from ExpiresAt vs clock.
ExpiryStatus string
// LoginMethod records how the credential was obtained: "device" for the
// OAuth2 browser/device flow (carries client + refresh + token endpoint),
// "token" for a pasted API token. Lets structured consumers branch without
// parsing Formatted.
LoginMethod string
// Renewable is true when a refresh token is stored — i.e. the access token
// renews silently on expiry rather than forcing a re-login. Always false
// for a pasted API token.
Renewable bool
// Hubs contains structured per-hub status. It has one entry for single-hub
// status responses and multiple entries when Hub was omitted with multiple
// stored logins.
Hubs []AuthStatusHub
// Formatted is the exact string the CLI prints; MCP returns it
// verbatim as text content. Terminated with a trailing newline.
Formatted string
}
AuthStatusResult is the pre-formatted human-readable status output plus structured fields for the MCP surface and any future renderers. Formatted is authoritative: both CLI and MCP emit it verbatim. Scalar fields are populated for single-hub responses; Hubs carries per-hub status entries.
type AuthStore ¶ added in v0.20.0
type AuthStore struct {
// contains filtered or unexported fields
}
AuthStore is the opaque wrapper exposing getters/setters over an authStoreDTO. All methods are nil-safe on the receiver: a (*AuthStore)(nil) reads as an empty store and writes are no-ops. This lets callers skip the "did Load return something?" dance when the file didn't exist.
mu guards data: the token resolver reads the store from concurrent hub requests while a refresh may be writing a rotated entry.
func LoadAuthStore ¶ added in v0.20.0
LoadAuthStore reads the auth store file at path and parses it. A missing file is NOT an error: we return an empty store and nil so first-run callers can treat "no file" and "empty file" identically. Every other read error is wrapped and returned.
func ParseAuthStore ¶ added in v0.20.0
ParseAuthStore parses raw YAML bytes into an AuthStore. Pure: no I/O, no clock. Empty input (including whitespace-only) is treated as an empty store rather than a YAML error — first-run and "user cleared the file" look the same to us.
func (*AuthStore) Delete ¶ added in v0.20.0
Delete removes the entry for hubURL. Returns whether it existed — callers can use this to decide whether to log "logged out" vs "was already logged out".
func (*AuthStore) Get ¶ added in v0.20.0
Get returns a copy of the entry for hubURL and a present flag. We return a value (not a pointer into the map) so callers can't mutate the stored entry by accident — all edits must go through Set.
func (*AuthStore) Hubs ¶ added in v0.20.0
Hubs returns the hub URL keys, sorted, for enumeration. Sorted output makes CLI listings stable without callers having to re-sort.
func (*AuthStore) IsEmpty ¶ added in v0.20.0
IsEmpty reports whether the store has no hubs. Used by Save to decide whether to delete the file rather than write an empty document.
func (*AuthStore) Save ¶ added in v0.20.0
Save writes the store to path. When the store is empty we remove the file instead of writing an empty YAML doc — keeps the filesystem tidy after a `tap auth logout` of the last hub and makes "no file" the canonical empty state (matches LoadAuthStore's contract). Parent directory is created at 0700 if it doesn't exist. If it already exists we don't touch its mode — users/admins may have intentionally widened it, and tightening on every Save would surprise them.
type BacklinksOptions ¶
type BacklinksOptions struct {
KegTargetOptions
// NodeIDs are the target nodes to inspect incoming links for.
// Results from all node IDs are merged and deduplicated.
NodeIDs []string
// Format is the output template. Legacy verbs %i (id), %t (title),
// %d (updated), %c (created), %a (accessed) remain supported, and %%
// renders a literal percent. Named selectors use %{...}: a bare word
// names a metadata key (%{type}), a leading dot names a statistics field
// (%{.accessCount}), and %{tags} is the tag list. Selectors other than
// id, title, and the three dates are resolved by the keg for the
// returned page in one batch.
Format string
Reverse bool
// Limit caps the number of results returned. 0 means no limit.
Limit int
// Offset skips the first N results before applying limit. Must be >= 0.
Offset int
}
type BatchCreateNode ¶ added in v0.38.0
type BatchCreateOptions ¶ added in v0.38.0
type BatchCreateOptions struct {
KegTargetOptions
Nodes []BatchCreateNode
}
type BatchEditItem ¶ added in v0.38.0
type BatchEditItem struct {
NodeID string
Schema string
Content string
HasContent bool
// ContentPatch is a unified diff against the node's current content,
// an alternative to Content.
ContentPatch string
HasContentPatch bool
Meta string
HasMeta bool
// ExpectedHash is the combined content+metadata token (node_read's
// hash). It is used only when neither part token is set; the CLI and
// other single-token callers rely on it.
ExpectedHash string
// ExpectedContentHash and ExpectedMetaHash are the per-part tokens
// (node_read's content_hash and meta_hash). When either is set, each
// supplied part must carry its own token and ExpectedHash is ignored.
ExpectedContentHash string
ExpectedMetaHash string
}
type BatchEditOptions ¶ added in v0.38.0
type BatchEditOptions struct {
KegTargetOptions
Edits []BatchEditItem
}
type BatchSnapshotItem ¶ added in v0.38.0
type BatchSnapshotOptions ¶ added in v0.38.0
type BatchSnapshotOptions struct {
KegTargetOptions
Nodes []BatchSnapshotItem
}
type BootstrapOptions ¶ added in v0.23.0
type BootstrapOptions struct {
// Kind selects the deployment: cloud | enterprise. Empty defaults
// to cloud (atlas is the compiled-in default hub).
Kind string
// Endpoint is the hub base URL; required when Kind == enterprise, ignored
// otherwise. A bare host is upgraded to https://.
Endpoint string
// HubName overrides the hub key written for an enterprise endpoint. Empty
// derives it from the endpoint host (see deriveHubName).
HubName string
// Namespace selects the namespace for guided KEG creation.
Namespace string
}
BootstrapOptions configures Tap.Bootstrap, the first-run onboarding that materializes or refreshes the user-level tapper config around a deployment kind.
type BootstrapResult ¶ added in v0.23.0
type BootstrapResult struct {
Path string // user config path written
Created bool // true when a fresh file was created, false on update
Kind string // normalized deployment kind
Hub string // hub name written as hub
HubURL string // login/display URL
Namespace string // transient creation namespace
Warnings []ConfigWarning // semantic warnings from ValidateConfig
}
BootstrapResult reports what Bootstrap wrote so the CLI can phrase its output, drive an optional login, and surface non-fatal config warnings.
type CatOptions ¶
type CatOptions struct {
// NodeIDs are the node identifiers to read (e.g., "0", "42").
// Multiple IDs produce concatenated output separated by blank lines.
NodeIDs []string
// Query is an optional boolean expression (same syntax as tap tag list) used
// to select nodes. Mutually exclusive with NodeIDs.
Query string
KegTargetOptions
// Edit opens the node in the editor instead of printing output.
Edit bool
// ContentOnly displays content only.
ContentOnly bool
// StatsOnly displays stats only.
StatsOnly bool
// MetaOnly displays metadata only.
MetaOnly bool
// Stream carries stdin piping information when editing.
Stream *toolkit.Stream
// LockToken is an optional cross-process lock token for edit operations.
LockToken string
}
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config represents the user's tapper configuration.
Config keeps a typed model alongside its parsed YAML document. Tapper-owned rewrites overlay known values so extension fields and comments survive.
func DefaultProjectConfig ¶
DefaultProjectConfig returns a project-scoped config with sensible defaults.
Project config selects a Hub and qualified KEG, overriding user defaults.
func DefaultUserConfig ¶
DefaultUserConfig selects the default remote Hub without namespace defaults.
func MergeConfig ¶
MergeConfig merges multiple Config values into a single configuration.
Merge semantics:
- Later configs override earlier values for scalar keys.
- Hubs are merged by name; later entries override earlier ones.
- KegMap entries are appended in configuration order.
func ParseConfig ¶
ParseConfig parses raw YAML into a Config data model. Unknown keys are ignored by the decoder.
func ReadConfig ¶
ReadConfig reads the YAML file at path and returns a parsed Config.
When the file does not exist the function returns a Config value and an error that wraps keg.ErrNotExist so callers can detect no-config cases.
func (*Config) AddKegMap ¶
func (cfg *Config) AddKegMap(entry KegMapEntry) error
AddKegMap adds or updates a keg map entry in the Config. Entries are matched by KEG, Hub, flight, and both path selectors. Different defaults or path patterns remain separate mappings.
func (*Config) DeleteHub ¶ added in v0.23.0
DeleteHub removes a hub entry by name, reporting whether it was present.
func (*Config) DisableAtlasHub ¶ added in v0.23.0
DisableAtlasHub returns true when the synthesized built-in atlas hub is suppressed.
func (*Config) DisableTelemetry ¶ added in v0.34.0
DisableTelemetry returns true when remote invocation reporting is disabled.
func (*Config) Flight ¶ added in v0.23.0
Flight returns the persisted flight reference applied when no --flight flag is given.
func (*Config) Hub ¶ added in v0.23.0
Hub returns the named hub entry. The built-in atlas remote hub is synthesized when it is not explicitly configured unless disableAtlasHub is set.
func (*Config) HubName ¶ added in v0.41.0
HubName returns the default hub name (high-precedence slot).
func (*Config) Keg ¶ added in v0.41.0
Keg returns the alias to use when no explicit keg is provided.
func (*Config) KegMap ¶
func (cfg *Config) KegMap() []KegMapEntry
KegMap returns the directory default mappings.
func (*Config) LaunchHarness ¶ added in v0.44.0
LaunchHarness returns the harness `tap launch` started this process under, or "" when it was not launched.
func (*Config) LaunchModel ¶ added in v0.44.0
LaunchModel returns the Hub catalog model `tap launch` started this process on, or "" when it was not launched.
func (*Config) LookupAlias ¶
LookupAlias returns the KEG default from the rule matching the project root. It first checks regex patterns in KegMap entries, then prefix matches. For multiple prefix matches, the longest matching prefix wins. Returns empty string if no match is found or config data is nil.
func (*Config) LookupAliasForTarget ¶ added in v0.6.0
LookupAliasForTarget previously reverse-mapped a resolved target back to its configured keg alias. The selected-Hub model has no alias table, so a target no longer carries a short alias; callers fall back to the canonical @namespace/name label. Retained as a no-op so those callers need no change.
func (*Config) LookupMapping ¶ added in v0.41.0
LookupMapping chooses one rule for KEG, Hub, and flight. Regexes precede directory prefixes; equal-length prefixes retain configuration order.
func (*Config) Relay ¶ added in v0.44.0
func (cfg *Config) Relay() *RelayConfig
Relay returns the `tap relay` configuration, or nil when none is set.
func (*Config) ResolveAlias ¶
ResolveAlias resolves a keg selector string to a concrete Target. The selector is parsed as a keg reference (see parseKegRef) and resolved through the selected-Hub ResolveRef chain — there is no kegs alias table.
Returns (nil, error) when the selector is empty or resolution fails.
func (*Config) ResolveDefault ¶
ResolveDefault resolves the current Keg reference to a target.
func (*Config) ResolveKegMap ¶
ResolveKegMap resolves the matching rule's KEG default based on path.
Precedence rules:
- Regex entries in KegMap have the highest precedence.
- PathPrefix entries are considered next; when multiple prefixes match the longest prefix wins.
- If no entry matches or the selected rule has no KEG default, resolution returns a missing-KEG error.
The function expands env vars and tildes prior to comparisons, so stored prefixes and patterns may contain ~ or $VAR values.
func (*Config) ResolveRef ¶ added in v0.23.0
ResolveRef resolves a KEG name and namespace within the selected Hub.
func (*Config) SetDisableAtlasHub ¶ added in v0.23.0
SetDisableAtlasHub toggles the synthesized built-in atlas hub.
func (*Config) SetDisableTelemetry ¶ added in v0.34.0
SetDisableTelemetry toggles privacy-minimized invocation reporting.
func (*Config) SetFlight ¶ added in v0.23.0
SetFlight sets the persisted flight reference (or clears it when empty).
func (*Config) SetHubName ¶ added in v0.41.0
SetHubName sets the selected saved Hub name.
func (*Config) SetKeg ¶ added in v0.41.0
SetKeg sets the alias used when no explicit keg is provided.
func (*Config) SetLogFile ¶
SetLogFile sets the log file path.
func (*Config) SetLogLevel ¶
SetLogLevel sets the log level.
type ConfigEditOptions ¶
type ConfigEditOptions struct {
// Project indicates whether to edit local config instead of user config
Project bool
User bool
ConfigPath string
Stream *toolkit.Stream
}
ConfigEditOptions configures behavior for Tap.ConfigEdit.
type ConfigExplainOptions ¶ added in v0.17.0
type ConfigExplainOptions struct {
// Field limits the result to a single field. Empty means all fields.
Field string
}
ConfigExplainOptions configures behavior for Tap.ConfigExplain.
type ConfigExplainResult ¶ added in v0.17.0
type ConfigExplainResult struct {
Field string // field name (e.g. "keg")
Value string // resolved value in the merged config
Source string // which provider set this value ("user config", "project config", "env vars", "default")
}
ConfigExplainResult describes the provenance of a single config field.
type ConfigLoadWarning ¶ added in v0.17.0
type ConfigLoadWarning struct {
Source string // "user config" or "project config"
Path string // file path that caused the issue
Message string // human-readable description
Err error // underlying error
}
ConfigLoadWarning represents a non-fatal issue encountered while loading config.
type ConfigOptions ¶
type ConfigService ¶
type ConfigService struct {
Runtime *toolkit.Runtime
PathService *PathService
// ConfigPath is the path to the config file.
ConfigPath string
KegOverride string
HubOverride string
FlightOverride string
// contains filtered or unexported fields
}
ConfigService loads, merges, and resolves tapper configuration state.
Configuration is read once and then fixed for the life of the process. A `tap` command therefore runs against one consistent snapshot, and a long-lived `tap mcp` session reloads transport configuration while resolving every authority-bearing call. Nothing inside a session can write configuration — the `config` tool is read-only — so "edit the file, then reorient" is the whole update story.
The snapshot is immutable once published, so concurrent readers need no coordination beyond the mutex guarding the pointer itself. The pinned flight root remains immutable even though credentials and live authority reload. That matters because the MCP SDK dispatches every call except initialize asynchronously.
Flight authority is not affected by a reload: the MCP session gate snapshots its resolved flight separately, so it stays stable across a reload either way.
func NewConfigService ¶
func NewConfigService(root string, rt *toolkit.Runtime) (*ConfigService, error)
NewConfigService builds a ConfigService rooted at root.
func (*ConfigService) Config ¶
func (s *ConfigService) Config() (*Config, error)
Config returns the merged user, project, and environment configuration from the process snapshot.
func (*ConfigService) Load ¶ added in v0.37.0
func (s *ConfigService) Load() (*Config, []ConfigLoadWarning, error)
Load returns the merged configuration together with the non-fatal issues found while reading it. Missing files are not warnings (graceful degradation); corrupt YAML and permission errors are.
func (*ConfigService) PinHub ¶ added in v0.41.0
func (s *ConfigService) PinHub() error
PinHub fixes the canonical Hub URL for a connection. Reloads may refresh its credentials and live Flight authority, but can never change its destination.
func (*ConfigService) ProjectConfig ¶
func (s *ConfigService) ProjectConfig() (*Config, error)
ProjectConfig returns the merged project-level configuration with optional caching. It walks from the workspace root up to the filesystem root, collecting every .tapper/config.yaml, and merges them so a deeper directory overrides a shallower one. Hub definitions and credentials are stripped from project layers — only the user config may define them — and each strip is recorded as a load warning surfaced by Config(). Returns keg.ErrNotExist when no project config exists.
func (*ConfigService) ReadProjectConfigFile ¶ added in v0.37.0
func (s *ConfigService) ReadProjectConfigFile() (*Config, error)
ReadProjectConfigFile walks and merges the project configs straight from disk, bypassing the snapshot. Same purpose as ReadUserConfigFile.
func (*ConfigService) ReadUserConfigFile ¶ added in v0.37.0
func (s *ConfigService) ReadUserConfigFile() (*Config, error)
ReadUserConfigFile reads the user configuration straight from disk, bypassing the snapshot. Use it when about to modify and rewrite that file, so the read-modify-write cycle starts from what is actually on disk.
func (*ConfigService) Reload ¶ added in v0.37.0
func (s *ConfigService) Reload()
Reload discards the snapshot so the next read re-reads from disk. Orientation is its only caller: it is the point at which a session re-establishes the context it is operating under.
func (*ConfigService) ResolveTarget ¶
func (s *ConfigService) ResolveTarget(alias, nsOverride, hubOverride string) (*keg.Target, error)
ResolveTarget resolves an explicit or configured KEG within the selected Hub.
func (*ConfigService) SelectedHub ¶ added in v0.41.0
func (s *ConfigService) SelectedHub(explicit string) (string, HubEntry, error)
SelectedHub returns the single selected connection. Explicit requests on a pinned connection must identify the same canonical URL.
func (*ConfigService) UserConfig ¶
func (s *ConfigService) UserConfig() (*Config, error)
UserConfig returns the global user configuration from the process snapshot.
func (*ConfigService) UserConfigExists ¶ added in v0.23.0
func (s *ConfigService) UserConfigExists() bool
UserConfigExists reports whether a user config file is present — the signal that `tap bootstrap` has been run. When an explicit config path is set (--config) it checks that file; otherwise the standard user config path. It inspects the filesystem only; it never parses, so a corrupt-but-present config still counts as bootstrapped.
type ConfigSlot ¶ added in v0.46.0
type ConfigSlot struct {
Value string `yaml:"value,omitempty" json:"value,omitempty"`
Scope string `yaml:"scope,omitempty" json:"scope,omitempty"`
}
ConfigSlot is one configured default and the config tier that set it (flag, env, project, kegMap, or user).
type ConfigTemplateOptions ¶ added in v0.4.0
type ConfigTemplateOptions struct {
Project bool
}
type ConfigWarning ¶ added in v0.17.0
type ConfigWarning struct {
Field string // config field name (e.g., "kegMap[0]", "logLevel")
Message string // human-readable description
}
ConfigWarning represents a semantic issue found during config validation.
func RetiredConfigFields ¶ added in v0.44.0
func RetiredConfigFields(cfg *Config) []ConfigWarning
RetiredConfigFields reports keys a config file still carries that Tapper no longer reads. They survive rewrites as unknown data, so nothing is lost, but they do nothing. It needs a config read from one file: a merged config keeps no document to inspect.
func ValidateConfig ¶ added in v0.17.0
func ValidateConfig(cfg *Config) []ConfigWarning
ValidateConfig checks a Config for semantic issues that are valid YAML but likely mistakes. It returns warnings, not errors — the config is still usable.
type ContextInfoFlight ¶ added in v0.46.0
type ContextInfoFlight struct {
Ref string `yaml:"ref,omitempty" json:"ref,omitempty"`
Title string `yaml:"title,omitempty" json:"title,omitempty"`
Scope string `yaml:"scope,omitempty" json:"scope,omitempty"`
}
ContextInfoFlight is the active flight.
type ContextInfoFlightKeg ¶ added in v0.46.0
type ContextInfoFlightKeg struct {
Ref string `yaml:"ref" json:"ref"`
Role string `yaml:"role,omitempty" json:"role,omitempty"`
Title string `yaml:"title,omitempty" json:"title,omitempty"`
Source string `yaml:"source,omitempty" json:"source,omitempty"`
Distance int `yaml:"distance,omitempty" json:"distance,omitempty"`
Path []string `yaml:"path,omitempty" json:"path,omitempty"`
}
ContextInfoFlightKeg is one KEG the active flight covers, at the role the caller holds through it. Source is the KEG the flight lists whose role it took, Distance the links between them, and Path, for a KEG reached through links, the KEGs along that shortest path from Source to Ref.
type ContextInfoHub ¶ added in v0.46.0
type ContextInfoHub struct {
Name string `yaml:"name,omitempty" json:"name,omitempty"`
URL string `yaml:"url,omitempty" json:"url,omitempty"`
User string `yaml:"user,omitempty" json:"user,omitempty"`
Scope string `yaml:"scope,omitempty" json:"scope,omitempty"`
}
ContextInfoHub is the hub the CLI talks to and who it is signed in as.
type ContextInfoKeg ¶ added in v0.46.0
type ContextInfoKeg struct {
Ref string `yaml:"ref,omitempty" json:"ref,omitempty"`
Scope string `yaml:"scope,omitempty" json:"scope,omitempty"`
}
ContextInfoKeg is the CLI's default KEG.
type ContextInfoResult ¶ added in v0.46.0
type ContextInfoResult struct {
Hub ContextInfoHub `yaml:"hub" json:"hub"`
Keg ContextInfoKeg `yaml:"keg" json:"keg"`
Flight ContextInfoFlight `yaml:"flight" json:"flight"`
Kegs []ContextInfoFlightKeg `yaml:"kegs" json:"kegs"`
Warnings []string `yaml:"warnings,omitempty" json:"warnings,omitempty"`
}
ContextInfoResult summarizes the CLI's context for `tap info`.
type CreateAgentOptions ¶ added in v0.44.0
type CreateAgentOptions struct {
Ref string
Hub string
Title string
Description string
Instructions string
Model string
Tools []string
Flight string
}
CreateAgentOptions creates an agent at Ref (@namespace/name). Tools holds tool group ids and single tool names; empty means every tool. Flight is the agent's memory flight (@ns/+slug); empty leaves it without KEG access.
type CreateFlightOptions ¶ added in v0.23.0
type CreateFlightOptions struct {
Ref string
Title string
Description string `json:"description,omitempty" jsonschema:"short description, separate from instructions"`
Visibility string
Instructions string
Cover []FlightCover
Subflights []string
// ManageKegs and ManageFlights are the flight's switches
// (FlightManifest.ManageKegs, FlightManifest.ManageFlights).
ManageKegs bool
ManageFlights bool
}
type CreateKegOptions ¶ added in v0.37.0
type CreateKegOptions struct {
Keg string
Title string
Visibility string
// KegVersion is validated with NormalizeKegVersion; empty lets the Hub
// choose.
KegVersion string
}
CreateKegOptions is the agent-facing KEG creation request.
type CreateOptions ¶
type CreateOptions struct {
KegTargetOptions
Schema string
Stream *toolkit.Stream
}
type DefaultOperations ¶ added in v0.44.0
type DefaultOperations struct{}
DefaultOperations forwards to the KEG's Hub when it is a Hub KEG and composes KEG operations otherwise.
func (DefaultOperations) Related ¶ added in v0.44.0
func (DefaultOperations) Related(ctx context.Context, k keg.Keg, direction keg.RelatedDirection, in tapapi.RelatedRequest) (*tapapi.RelatedResponse, error)
func (DefaultOperations) Tags ¶ added in v0.44.0
func (DefaultOperations) Tags(ctx context.Context, k keg.Keg, in tapapi.TagsRequest) (*tapapi.TagsResponse, error)
type DeleteAgentOptions ¶ added in v0.44.0
DeleteAgentOptions removes the agent at Ref.
type DeleteFileOptions ¶ added in v0.2.0
type DeleteFileOptions struct {
KegTargetOptions
NodeID string
Name string
}
DeleteFileOptions configures behavior for Tap.DeleteFile.
type DeleteFlightOptions ¶ added in v0.23.0
type DeleteImageOptions ¶ added in v0.2.0
type DeleteImageOptions struct {
KegTargetOptions
NodeID string
Name string
}
DeleteImageOptions configures behavior for Tap.DeleteImage.
type DeleteVideoOptions ¶ added in v0.48.0
type DeleteVideoOptions struct {
KegTargetOptions
NodeID string
Name string
}
DeleteVideoOptions configures behavior for Tap.DeleteVideo.
type DeviceUserPrompt ¶ added in v0.23.0
type DeviceUserPrompt struct {
UserCode string
VerificationURI string
VerificationURIComplete string
ExpiresIn int64
}
DeviceUserPrompt is the subset of the RFC 8628 device_authorization response an OnUserCode handler needs to drive the user-facing step. It is the exported projection of deviceAuthResponse so callers in other packages (the CLI) can present the code without seeing the wire type. VerificationURIComplete (a URL with the user_code embedded) is retained from the wire response but deliberately never displayed or opened — see VerificationURL.
func (DeviceUserPrompt) VerificationURL ¶ added in v0.23.0
func (p DeviceUserPrompt) VerificationURL() string
VerificationURL returns the URL the user should open: always the bare verification_uri, never a code-bearing variant. The user_code is shown separately and typed into the page (GitHub-style, RFC 8628 §3.3.1) — embedding it in the URL would leak it into browser history and any front proxy's access logs. The hub-provided verification_uri_complete is deliberately ignored for the same reason.
type DoctorOptions ¶ added in v0.5.0
type DoctorOptions struct {
KegTargetOptions
}
DoctorOptions configures behavior for Tap.Doctor.
type DownloadFileOptions ¶ added in v0.2.0
type DownloadFileOptions struct {
KegTargetOptions
NodeID string
Name string
Dest string
// NoOverwrite creates a private new file and refuses existing destinations.
NoOverwrite bool
}
DownloadFileOptions configures behavior for Tap.DownloadFile.
type DownloadImageOptions ¶ added in v0.2.0
type DownloadImageOptions struct {
KegTargetOptions
NodeID string
Name string
Dest string
// NoOverwrite creates a private new file and refuses existing destinations.
NoOverwrite bool
}
DownloadImageOptions configures behavior for Tap.DownloadImage.
type DownloadVideoOptions ¶ added in v0.48.0
type DownloadVideoOptions struct {
KegTargetOptions
NodeID string
Name string
Dest string
// NoOverwrite creates a private new file and refuses existing destinations.
NoOverwrite bool
}
DownloadVideoOptions configures behavior for Tap.DownloadVideo.
type EditAgentOptions ¶ added in v0.44.0
type EditAgentOptions struct {
Ref string
Hub string
Title *string
Description *string
Instructions *string
Model *string
Tools *[]string
Flight *string
}
EditAgentOptions changes an agent. A nil field keeps its current value; Tools set to an empty slice clears the allowlist (every tool); Flight set to "" clears the agent's flight.
type EditFlightOptions ¶ added in v0.24.0
type EditFlightOptions struct {
Ref string
ExpectedHash string
// Stream, when piped with non-empty content, supplies the manifest YAML
// directly so scripts can apply a full manifest without an editor.
Stream *toolkit.Stream
}
EditFlightOptions configures behavior for Tap.EditFlight.
type EditOptions ¶
type EditOptions struct {
// NodeID is the node identifier to edit (e.g., "0", "42")
NodeID string
KegTargetOptions
// LockToken is an optional cross-process lock token. When provided, the
// command validates it against any held lock before proceeding.
LockToken string
Schema string
// Stream carries stdin piping information.
Stream *toolkit.Stream
}
type EditSchemaOptions ¶ added in v0.25.0
type EditSchemaOptions struct {
KegTargetOptions
Type string
Stream *toolkit.Stream
ExpectedHash string
}
type EmptyEditError ¶ added in v0.47.0
EmptyEditError reports an edit item that supplies none of content, patch, or meta, so it has nothing to change. It unwraps to keg.ErrInvalid; the typed form lets a surface say which field to add instead of a generic malformed-request hint.
func (*EmptyEditError) Error ¶ added in v0.47.0
func (e *EmptyEditError) Error() string
func (*EmptyEditError) Unwrap ¶ added in v0.47.0
func (e *EmptyEditError) Unwrap() error
type ExploreKind ¶ added in v0.46.0
type ExploreKind string
ExploreKind names one section of a hub's public directory.
const ( // ExploreKegs lists public KEGs. ExploreKegs ExploreKind = "kegs" // ExploreFlights lists public flights. ExploreFlights ExploreKind = "flights" // ExplorePeople lists the people and org namespaces on the hub. ExplorePeople ExploreKind = "people" )
type ExploreOptions ¶ added in v0.46.0
ExploreOptions searches one section of the public directory. Query must not be empty: the directory is hub-wide, and the caller's own resources come from the list commands instead.
type ExploreRequest ¶ added in v0.46.0
type ExploreRequest struct {
Kind ExploreKind `json:"kind"`
Query string `json:"query"`
}
ExploreRequest is the body of POST /api/v1/explore.
type ExploreResult ¶ added in v0.46.0
type ExploreResult struct {
Kind ExploreKind `json:"kind"`
Results []ExploreRow `json:"results"`
Truncated bool `json:"truncated"`
}
ExploreResult is a bounded page of public directory matches.
func ExploreHub ¶ added in v0.46.0
func ExploreHub(ctx context.Context, hubURL, token string, kind ExploreKind, query string) (ExploreResult, error)
ExploreHub searches one section of a hub's public directory via POST /api/v1/explore.
type ExploreRow ¶ added in v0.46.0
type ExploreRow struct {
Ref string `json:"ref"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Role string `json:"role,omitempty"`
}
ExploreRow is one public directory entry. Role is the caller's role when they already belong to it, empty otherwise. A row grants nothing.
type ExportOptions ¶ added in v0.4.0
type ExportOptions struct {
KegTargetOptions
NodeIDs []string
WithHistory bool
OutputPath string
}
type Flight ¶ added in v0.23.0
type Flight struct {
// EffectiveCover is supplied by Hub and is never written into the manifest.
EffectiveCover []HubEffectiveKeg `json:"-" yaml:"-"`
Name string `yaml:"-" json:"name,omitempty"`
Namespace string `yaml:"-" json:"namespace,omitempty"`
Slug string `yaml:"-" json:"slug,omitempty"`
Source string `yaml:"-" json:"source,omitempty"` // configured hub name
ManifestHash string `yaml:"-" json:"-"`
FlightManifest
}
Flight is a discovered flight: its manifest plus provenance.
func ComposedFlight ¶ added in v0.41.0
ComposedFlight applies a Hub-composed cover to an operation-local copy. The original declaration remains available for manifest editing and hashing.
func ImmediateFlightChildren ¶ added in v0.41.0
ImmediateFlightChildren filters existing readable graph/catalog projections without fetching manifests.
func (*Flight) RoleFor ¶ added in v0.23.0
func (f *Flight) RoleFor(alias, namespace, kegName string) (FlightRole, bool)
RoleFor reports the flight-scoped role for a keg. An empty cover denies all KEG access. Manifests normally arrive through normalizeFlightManifest, which folds legacy AllowedKegs into Cover; the fallback here only covers Flight values constructed by hand.
type FlightCover ¶ added in v0.23.0
type FlightCover struct {
Depth int `yaml:"depth,omitempty" json:"depth,omitempty"`
Namespace string `yaml:"namespace,omitempty" json:"namespace,omitempty"`
Keg string `yaml:"keg" json:"keg"`
Role FlightRole `yaml:"role" json:"role"`
}
func ParseFlightCoverSpecs ¶ added in v0.23.0
func ParseFlightCoverSpecs(specs []string) ([]FlightCover, error)
ParseFlightCoverSpecs parses CLI/MCP cover specs of the form "keg", "@ns/keg", or "@ns/keg=role". Bare entries default to viewer, matching the manifest parser; editor must be requested explicitly.
type FlightGraph ¶ added in v0.39.0
type FlightGraph struct {
Root *Flight
Available []*Flight
Paths map[string][]string
// contains filtered or unexported fields
}
FlightGraph is a deterministic breadth-first projection rooted at Root. Available excludes the root and contains each accessible descendant once. Paths holds the first (therefore shortest and ordered) canonical path found.
func FlattenFlightGraph ¶ added in v0.39.0
func FlattenFlightGraph(ctx context.Context, root *Flight, fetch func(context.Context, string) (*Flight, error)) (*FlightGraph, error)
FlattenFlightGraph loads an ordered, bounded, single-source flight graph. A missing/forbidden descendant excludes that branch; all other load errors make the runtime graph unavailable. The root is supplied by the caller so root-loss classification remains transport-specific.
func (*FlightGraph) AvailableRefs ¶ added in v0.39.0
func (g *FlightGraph) AvailableRefs() []string
AvailableRefs returns the flattened canonical descendant list.
func (*FlightGraph) Select ¶ added in v0.39.0
func (g *FlightGraph) Select(raw string) (*Flight, []string, error)
Select resolves omitted input to the root and an explicit input to either the root or an accessible flattened descendant. Per-tool +slug references are relative to the pinned root namespace.
type FlightManifest ¶ added in v0.23.0
type FlightManifest struct {
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Title string `yaml:"title,omitempty" json:"title,omitempty"`
Visibility string `yaml:"visibility,omitempty" json:"visibility,omitempty"`
Cover []FlightCover `yaml:"cover,omitempty" json:"cover,omitempty"`
Subflights []string `yaml:"subflights,omitempty" json:"subflights,omitempty"`
AllowedKegs []string `yaml:"allowedKegs,omitempty" json:"allowedKegs,omitempty"`
Instructions string `yaml:"instructions,omitempty" json:"instructions,omitempty"`
// ManageKegs lets a request rooted on this flight administer every keg
// in the flight's own namespace: create and delete kegs, edit their
// settings, change their visibility, and manage their grants, even for
// kegs outside its cover. It never reaches node content outside the
// cover and never gives more than the user's own role. A subflight in
// another namespace that sets it adds that namespace for its roots.
ManageKegs bool `yaml:"manageKegs,omitempty" json:"manageKegs,omitempty"`
// ManageFlights lets a request rooted on this flight create, edit, and
// delete the flights of its own namespace, widening them up to the
// user's own role. A subflight in another namespace that sets it adds
// that namespace for its roots.
ManageFlights bool `yaml:"manageFlights,omitempty" json:"manageFlights,omitempty"`
}
FlightManifest is the Hub API shape of a flight: explicit covered kegs plus markdown instructions. AllowedKegs remains a legacy wire field and is normalized into editor-cap cover entries.
type FlightRef ¶ added in v0.23.0
func ParseFlightRef ¶ added in v0.23.0
type FlightRestrictionError ¶ added in v0.23.0
type FlightRestrictionError struct {
Flight string
Keg string
Want FlightRole
Got FlightRole
}
FlightRestrictionError is returned when a resolved keg falls outside the active flight's cover or role cap.
func (*FlightRestrictionError) Error ¶ added in v0.23.0
func (e *FlightRestrictionError) Error() string
type FlightRole ¶ added in v0.23.0
type FlightRole string
func (FlightRole) AtLeast ¶ added in v0.23.0
func (r FlightRole) AtLeast(want FlightRole) bool
AtLeast reports whether r grants at least want within a flight cover.
type FlightService ¶ added in v0.23.0
type FlightService struct {
Runtime *toolkit.Runtime
ConfigService *ConfigService
// KegService supplies the token resolver (and its cached auth store)
// for hub requests. Lazily constructed when not wired by NewTap.
KegService *KegService
// contains filtered or unexported fields
}
FlightService discovers and loads flights from configured remote hubs.
func (*FlightService) FlightCatalog ¶ added in v0.41.0
func (s *FlightService) FlightCatalog(ctx context.Context, hub string, warnings *[]string) ([]*Flight, error)
FlightCatalog returns readable flight metadata from the existing Hub catalog projection.
func (*FlightService) GetFlight ¶ added in v0.23.0
GetFlight loads a single Hub flight by ref. Returns keg.ErrNotExist when no manifest exists. Unqualified refs resolve through unique Hub slug matches. Results are memoized for the life of the process (see flightCache).
func (*FlightService) GetFlightFresh ¶ added in v0.30.0
GetFlightFresh bypasses the process cache. MCP sessions use this before gated calls so a manifest change invalidates the pinned session instead of silently changing its authority.
func (*FlightService) ListFlights ¶ added in v0.23.0
func (s *FlightService) ListFlights(ctx context.Context, hub string, warnings *[]string) ([]string, error)
ListFlights returns canonical @namespace/+slug refs for flights discovered across configured hubs, sorted. When hub is non-empty, discovery is limited to that configured hub. Remote/auth/network errors are best-effort so shell completion and discovery remain responsive; when warnings is non-nil each skipped hub appends one message so user-facing listings can say what was left out.
func (*FlightService) ResolveFlightGraph ¶ added in v0.39.0
func (s *FlightService) ResolveFlightGraph(ctx context.Context, root *Flight) (*FlightGraph, error)
ResolveFlightGraph reloads and flattens the identity-accessible transitive descendants of root. It intentionally bypasses the process cache so every MCP call observes live relations and manifests.
func (*FlightService) StoreSessionFlight ¶ added in v0.30.0
func (s *FlightService) StoreSessionFlight(name string, f *Flight)
StoreSessionFlight pins a validated flight in the process cache for Tap's per-operation cover enforcement. MCP session invalidation is handled by the server-owned gate before these cached values are used.
type ForceUnlockOptions ¶ added in v0.11.0
type ForceUnlockOptions struct {
NodeID string
KegTargetOptions
}
ForceUnlockOptions configures behavior for Tap.ForceUnlock.
type GetAgentOptions ¶ added in v0.44.0
GetAgentOptions names one agent (@namespace/name).
type GetFlightOptions ¶ added in v0.23.0
type GetFlightOptions struct {
Name string
}
GetFlightOptions selects a single flight by name.
type GrepOptions ¶
type GrepOptions struct {
KegTargetOptions
// Query is the regex pattern used to search nodes.
Query string
// Format is the output template. Legacy verbs %i (id), %t (title),
// %d (updated), %c (created), %a (accessed) remain supported, and %%
// renders a literal percent. Named selectors use %{...}: a bare word
// names a metadata key (%{type}), a leading dot names a statistics field
// (%{.accessCount}), and %{tags} is the tag list. Selectors other than
// id, title, and the three dates are resolved by the keg for the
// returned page in one batch.
Format string
Reverse bool
// IgnoreCase enables case-insensitive regex matching.
IgnoreCase bool
// MaxLines caps the number of matched lines returned per node.
// 0 means unlimited. When > 0, only the first MaxLines matching lines
// are included per node.
MaxLines int
// Limit caps the number of results returned. 0 means no limit.
Limit int
// Offset skips the first N results before applying limit. Must be >= 0.
Offset int
}
type HubAddOptions ¶ added in v0.23.0
HubAddOptions adds a remote hub connection to user config.
type HubAgent ¶ added in v0.44.0
type HubAgent struct {
Ref string `json:"ref"`
Namespace string `json:"namespace"`
Name string `json:"name"`
Title string `json:"title"`
Description string `json:"description"`
Instructions string `json:"instructions"`
// Model is a Hub catalog id; empty leaves the choice to the launcher.
Model string `json:"model"`
// Tools is the stored MCP tool allowlist: tool group ids (such as
// "keg:read") and single tool names. Empty means every tool.
Tools []string `json:"tools"`
// EffectiveTools is Tools with its groups expanded to tool names by the
// hub, for filtering a tool list by name. Empty means every tool.
EffectiveTools []string `json:"effective_tools,omitempty"`
// RuntimeTools is EffectiveTools narrowed by the agent's organization's
// tool policy: what a session running it may use. Empty means every
// tool; nil means the hub predates it.
RuntimeTools []string `json:"runtime_tools,omitempty"`
// RelayTools reports whether a session running the agent also gets the
// caller's relayed MCP tools.
RelayTools bool `json:"relay_tools,omitempty"`
// Subagents are the agents (@ns/name) this one may hand work to.
Subagents []string `json:"subagents,omitempty"`
// Flight is the agent's memory flight (@ns/+slug); empty means the agent
// has no KEG access.
Flight string `json:"flight"`
}
HubAgent is a Hub agent: a namespace-owned model, instructions, tool allowlist, and flight. The agent is the unit of authority: its tools say what it may do, and its flight is the memory it works in. A flight carries no tooling of its own.
func CreateHubAgent ¶ added in v0.44.0
func CreateHubAgent(ctx context.Context, hubURL, token, namespace string, in HubAgentWrite) (*HubAgent, error)
CreateHubAgent creates an agent. The caller must be a namespace owner or admin.
func GetHubAgent ¶ added in v0.44.0
GetHubAgent fetches one agent. The caller must belong to its namespace.
func ListHubAgents ¶ added in v0.44.0
ListHubAgents returns a namespace's agents, or with an empty namespace the agents of every namespace the caller belongs to.
func UpdateHubAgent ¶ added in v0.44.0
func UpdateHubAgent(ctx context.Context, hubURL, token, namespace, name string, in HubAgentWrite) (*HubAgent, error)
UpdateHubAgent replaces an agent's fields. The caller must be a namespace owner or admin.
type HubAgentWrite ¶ added in v0.44.0
type HubAgentWrite struct {
Name string `json:"name"`
Title string `json:"title"`
Description string `json:"description"`
Instructions string `json:"instructions"`
Model string `json:"model"`
Tools []string `json:"tools"`
// Flight is the agent's memory flight (@ns/+slug); empty clears it.
Flight string `json:"flight"`
}
HubAgentWrite is the body of an agent create or full replace. Tools holds tool group ids and single tool names; empty means every tool.
type HubEffectiveKeg ¶ added in v0.41.0
type HubEffectiveKeg struct {
Ref string `json:"ref"`
Role FlightRole `json:"role"`
Source string `json:"source"`
Distance int `json:"distance"`
// Path is the shortest link path that decided Role, from Source to Ref
// (Distance+1 KEGs). A Hub that predates it leaves it empty.
Path []string `json:"path,omitempty"`
}
HubEffectiveKeg is the Hub-composed identity-capped cover and its provenance.
type HubEntry ¶ added in v0.23.0
type HubEntry struct {
// Deprecated: Kind has no effect.
Kind string `yaml:"-"`
URL string `yaml:"url,omitempty"`
Token string `yaml:"token,omitempty"`
TokenEnv string `yaml:"tokenEnv,omitempty"`
// contains filtered or unexported fields
}
HubEntry describes a single configured hub, keyed by name in the hubs map.
Connections use HTTP. The retired YAML kind field is ignored.
func (HubEntry) MarshalYAML ¶ added in v0.41.0
type HubFlight ¶ added in v0.23.0
type HubFlight struct {
EffectiveCover []HubEffectiveKeg `json:"effective_cover,omitempty"`
Namespace string `json:"namespace"`
Slug string `json:"slug"`
Title string `json:"title"`
Description string `json:"description,omitempty" jsonschema:"short description, separate from instructions"`
Instructions string `json:"instructions"`
Visibility string `json:"visibility"`
Cover []HubFlightCover `json:"cover"`
Subflights []string `json:"subflights"`
// ManageKegs and ManageFlights are the manifest's switches. A write
// that leaves one nil keeps the flight's current value.
ManageKegs *bool `json:"manage_kegs,omitempty"`
ManageFlights *bool `json:"manage_flights,omitempty"`
// Manage is the single flag an older Hub answers with in place of the
// two switches; it is read, never sent.
Manage *bool `json:"manage,omitempty"`
Hash string `json:"hash,omitempty"`
}
func CreateHubFlight ¶ added in v0.23.0
func GetHubFlight ¶ added in v0.23.0
func ListUserFlights ¶ added in v0.23.0
type HubFlightCover ¶ added in v0.23.0
type HubGrant ¶ added in v0.23.0
type HubGrant struct {
Username string `json:"username"`
Role string `json:"role"` // viewer|editor|admin
}
HubGrant is one per-(user, role) grant on a keg. Mirrors the hub's handler.ListGrants JSON body — keep the two in sync. (granted_at is sent by the hub but unused here.)
type HubInvitation ¶ added in v0.44.0
type HubInvitation struct {
ID int64 `json:"id"`
Kind string `json:"kind"` // membership|grant
Target string `json:"target"` // @ns or @ns/keg
Namespace string `json:"namespace"`
Keg string `json:"keg,omitempty"`
Username string `json:"username"`
Role string `json:"role"`
InvitedBy string `json:"invited_by,omitempty"`
CreatedAt time.Time `json:"created_at"`
ExpiresAt time.Time `json:"expires_at"`
// Hub names the configured hub this row came from. Filled in locally.
Hub string `json:"hub,omitempty"`
}
HubInvitation is one pending invitation. Mirrors the hub's handler.invitationWire JSON body — keep the two in sync.
func AcceptInvitation ¶ added in v0.44.0
AcceptInvitation accepts an invitation addressed to the caller.
func DeclineInvitation ¶ added in v0.44.0
DeclineInvitation discards an invitation addressed to the caller.
func ListInvitations ¶ added in v0.44.0
func ListInvitations(ctx context.Context, hubURL, token string) ([]HubInvitation, error)
ListInvitations returns the caller's pending invitations via GET /api/v1/invitations.
type HubKeg ¶ added in v0.23.0
type HubKeg struct {
Namespace string `json:"namespace"`
Alias string `json:"alias"`
Title string `json:"title"`
Description string `json:"description"`
Visibility string `json:"visibility"`
Role string `json:"role"`
// KegVersion is the KEG's immutable storage version (keg.KegVersionV1 or
// keg.KegVersionV2). Hubs that predate versioned KEGs omit it; an empty
// value reads as KEGv1.
KegVersion string `json:"kegv,omitempty"`
}
HubKeg is one keg the hub reports the authenticated user can reach. It mirrors the hub's handler.UserKegItem JSON body — keep the two in sync.
func ListUserKegs ¶ added in v0.23.0
ListUserKegs returns every keg the hub reports the bearer token can reach (namespace membership + grants) via GET /api/v1/kegs.
func (*HubKeg) UnmarshalJSON ¶ added in v0.41.0
UnmarshalJSON accepts summary from older Hubs without overriding an explicit description.
type HubKegCreate ¶ added in v0.46.0
type HubKegCreate struct {
Alias string `json:"alias"`
Title string `json:"title"`
Visibility string `json:"visibility"`
KegVersion string `json:"kegv,omitempty"`
}
HubKegCreate is the body of the Hub's keg-create request. An empty KegVersion is omitted so the Hub applies its default (KEGv1), which keeps the request acceptable to Hubs that predate versioned KEGs.
type HubListOptions ¶ added in v0.23.0
type HubListOptions struct {
Hub string
}
HubListOptions selects a saved Hub; omission uses the active Hub.
type HubMember ¶ added in v0.23.0
type HubMember struct {
Username string `json:"username"`
Role string `json:"role"` // owner|admin|member
}
HubMember is one namespace membership row. Mirrors the hub's handler.memberWire JSON body — keep the two in sync.
type HubModel ¶ added in v0.44.0
type HubModel struct {
ID string `json:"id"`
OwnedBy string `json:"owned_by"`
// ContextWindow is the model's token limit, or 0 when its relay did not
// advertise one.
ContextWindow int `json:"context_window,omitempty"`
// Capabilities is set only for models that are not for chat, such as
// speech to text.
Capabilities []string `json:"capabilities,omitempty"`
}
HubModel is one entry of the caller's Hub inference catalog.
type HubNamespace ¶ added in v0.23.0
type HubNamespace struct {
Name string `json:"name"`
Kind string `json:"kind,omitempty"` // user|org
Role string `json:"role,omitempty"` // caller's role
// Hub names the configured hub this row came from. It is filled in
// locally by NamespaceList, not by the hub, so identical namespace names
// on different hubs stay distinguishable. Not part of namespaceWire.
Hub string `json:"hub,omitempty"`
}
HubNamespace is one namespace the caller belongs to (or just created). Mirrors the hub's handler.namespaceWire JSON body — keep the two in sync.
func CreateNamespace
deprecated
added in
v0.23.0
func CreateNamespace(ctx context.Context, hubURL, token, name string) (*HubNamespace, error)
CreateNamespace is disabled for remote clients. Namespace creation is a paid hub UI flow; use Tap.NamespaceCreate to get the browser handoff URL.
Deprecated: remote namespace creation is not supported.
func ListNamespaces ¶ added in v0.23.0
func ListNamespaces(ctx context.Context, hubURL, token string) ([]HubNamespace, error)
ListNamespaces returns the namespaces the caller belongs to via GET /api/v1/namespaces.
type HubRemoveOptions ¶ added in v0.23.0
type HubRemoveOptions struct {
Name string
}
HubRemoveOptions removes a hub connection from user config.
type HubSetDefaultOptions ¶ added in v0.23.0
HubSetDefaultOptions sets the default hub. It writes project config by default and user config with User=true (mirroring `tap config edit`).
type HubToolCatalog ¶ added in v0.45.0
type HubToolCatalog struct {
Tools []string `json:"tools"`
AlwaysAvailable []string `json:"always_available"`
}
HubToolCatalog is Hub's hosted MCP tool list: every tool an agent may be granted, and the ones every agent always has.
func GetHubTools ¶ added in v0.45.0
func GetHubTools(ctx context.Context, hubURL, token string) (*HubToolCatalog, error)
GetHubTools lists Hub's hosted MCP tools.
type IndexCatOptions ¶ added in v0.2.0
type IndexCatOptions struct {
KegTargetOptions
// Name is the index file name to dump, e.g. "changes.md" or "nodes.tsv".
// A leading "dex/" prefix is stripped automatically.
Name string
}
type IndexOptions ¶
type IndexOptions struct {
KegTargetOptions
// NoUpdate skips updating node meta information
NoUpdate bool
}
type InfoOptions ¶
type InfoOptions struct {
KegTargetOptions
// JSON renders the diagnostics as JSON instead of YAML.
JSON bool
// Debug includes working-directory and backend resolution diagnostics.
Debug bool
}
InfoOptions configures behavior for Tap.Info.
type InitOptions ¶
type InitOptions struct {
Hub string
Title string
Keg string
Visibility string
// KegVersion selects the new KEG's immutable storage version
// (keg.KegVersionV1 or keg.KegVersionV2). Empty lets the Hub choose its
// default, KEGv1.
KegVersion string
// RequireBootstrap rejects config-driven creation until user setup exists.
RequireBootstrap bool
}
InitOptions configures creation of a KEG on a configured remote hub.
type InstalledRunner ¶ added in v0.45.0
type InstalledRunner struct {
RunnerSpec
// Path is the resolved executable.
Path string
}
InstalledRunner is a runner found on PATH.
func DetectRunners ¶ added in v0.45.0
func DetectRunners(pathEnv string) []InstalledRunner
DetectRunners returns the runners installed on pathEnv (a PATH value), in Runners order.
type IntegrateOptions ¶ added in v0.19.0
type IntegrateOptions struct {
KegTargetOptions
Host string
DryRun bool
// Plugins are additional embedded plugins to install, such as
// tapper-dev. Request order is preserved and duplicates are ignored.
Plugins []string
// NoSafety skips the tapper-guard plugin for hosts that ship it. It does
// not uninstall a guard the host already has; removing or disabling that
// one is a host-side action.
NoSafety bool
Scope string
}
IntegrateOptions selects the host, native install scope, dry-run behavior, and optional plugins for native plugin installation. The baseline tapper plugin is always installed, and so is the tapper-guard safety plugin unless NoSafety is set.
type IntegrateResult ¶ added in v0.30.0
IntegrateResult describes the extracted marketplace and what the install does with it.
Commands and Steps are the two shapes an install takes and a host uses one or the other: Commands for a host driven through its own CLI, Steps for a host installed by writing its configuration. A dry run reports whichever is set.
type InvitationOptions ¶ added in v0.44.0
InvitationOptions selects a hub (empty: the selected hub) and, for decisions, one invitation.
type InvocationEvent ¶ added in v0.34.0
type InvocationEvent struct {
Surface string `json:"surface"`
Command string `json:"command,omitempty"`
Tool string `json:"tool,omitempty"`
DurationMS int64 `json:"duration_ms"`
Success bool `json:"success"`
Interactive *bool `json:"interactive,omitempty"`
ClientVersion string `json:"client_version"`
Agent string `json:"agent,omitempty"`
}
InvocationEvent is the privacy-minimized shape accepted by the Tapper Hub invocation telemetry endpoint. Callers must set exactly one of Command or Tool according to Surface. ClientVersion and Agent are injected by the reporter.
Agent is the harness `tap launch` started the process under (TAP_HARNESS), empty when a human is. It separates agent-driven usage from human usage in aggregate.
type InvocationReporter ¶ added in v0.34.0
type InvocationReporter interface {
// Report queues an event without blocking and may drop it under pressure.
Report(InvocationEvent)
// Close waits for a send already in flight, bounded by ctx and
// InvocationTelemetryInFlightWait, then spools what is left unsent.
Close(context.Context)
}
InvocationReporter accepts best-effort telemetry without blocking the caller. Events still unsent at Close are spooled for the next process.
func NewInvocationReporter ¶ added in v0.34.0
func NewInvocationReporter(rt *toolkit.Runtime, configService *ConfigService, version string, sessions ...*apicontract.Session) InvocationReporter
NewInvocationReporter resolves the user-scope reporting destination and existing AuthStore token. It returns nil when telemetry is disabled or the client is not bootstrapped, authenticated, or configured with a remote hub.
type Issue ¶ added in v0.5.0
type Issue = keg.DoctorIssue
Issue represents a single problem found during a doctor check.
type KegDeleteOptions ¶ added in v0.41.0
type KegDeleteOptions struct{ Keg, Namespace, Hub string }
KegDeleteOptions identifies the explicit KEG to permanently delete.
type KegGrantOptions ¶ added in v0.23.0
type KegGrantOptions struct {
Keg string
Namespace string
Hub string
User string
Role string // viewer|editor|admin
}
KegGrantOptions upserts a grant on a keg.
type KegGrantsOptions ¶ added in v0.23.0
KegGrantsOptions selects the keg whose grants to list. Keg is the selector (a bare name or @namespace/keg); empty resolves the default keg. Namespace and Hub override the resolved reference's components.
type KegMapEntry ¶
type KegMapEntry struct {
Keg string `yaml:"keg,omitempty"`
Hub string `yaml:"hub,omitempty"`
Flight string `yaml:"flight,omitempty"`
PathPrefix string `yaml:"pathPrefix,omitempty"`
PathRegex string `yaml:"pathRegex,omitempty"`
// contains filtered or unexported fields
}
KegMapEntry maps a path prefix or regex to KEG, Hub, and flight defaults.
func (KegMapEntry) MarshalYAML ¶ added in v0.41.0
func (m KegMapEntry) MarshalYAML() (any, error)
func (*KegMapEntry) UnmarshalYAML ¶ added in v0.41.0
func (m *KegMapEntry) UnmarshalYAML(n *yaml.Node) error
type KegRef ¶ added in v0.23.0
type KegRef struct {
Hub string `yaml:"hub,omitempty"`
Namespace string `yaml:"namespace,omitempty"`
Name string `yaml:"name,omitempty"`
}
KegRef is the (hub, namespace, name) triple a keg alias resolves to. An empty Hub falls back to the selected Hub; Namespace must be explicit.
func (*KegRef) UnmarshalYAML ¶ added in v0.23.0
UnmarshalYAML accepts the canonical mapping form ({hub, namespace, name}) and remote scalar shorthand. The canonical shorthand "keg:@ns/name" sets {namespace, name}; the hub is resolved from the namespace and is never encoded. To pin a hub, use the mapping form's "hub" field. Writes always serialize the canonical mapping form.
type KegRenameOptions ¶ added in v0.25.0
KegRenameOptions renames a hub-backed keg alias within one namespace.
type KegRevokeOptions ¶ added in v0.23.0
KegRevokeOptions revokes a user's grant on a keg.
type KegService ¶
type KegService struct {
Runtime *toolkit.Runtime
ConfigService *ConfigService
// contains filtered or unexported fields
}
KegService resolves configured remote KEGs.
func (*KegService) ReloadAuthStore ¶ added in v0.40.0
func (s *KegService) ReloadAuthStore()
ReloadAuthStore drops the cached credential store so the next resolution reads it back from disk.
The store is otherwise loaded once per process. A `tap auth login` run in a separate shell writes a new token to disk that a long-lived MCP server would never see, so telling an agent to log in and reorient was advice that could not work (tapper#87). Orientation is already the reload boundary for configuration; this puts credentials on the same boundary.
func (*KegService) Resolve ¶
func (s *KegService) Resolve(ctx context.Context, options ResolveKegOptions) (keg.Keg, error)
Resolve returns a RemoteKeg selected by an explicit reference or config.
type KegSettingsEditOptions ¶ added in v0.39.0
type KegSettingsEditOptions struct {
KegTargetOptions
Stream *toolkit.Stream
ExpectedHash string
}
KegSettingsEditOptions configures behavior for Tap.KegSettingsEdit.
type KegSettingsOptions ¶ added in v0.33.0
type KegSettingsOptions struct {
KegTargetOptions
// Kegs requests one or more canonical @namespace/keg references. It is
// mutually exclusive with Keg and is available only in minimal mode.
Kegs []string
// Minimal strips large sections (tags, entities, indexes) from the output,
// returning only core config fields. Useful for MCP tools where response
// size must stay small.
Minimal bool
}
KegSettingsOptions configures behavior for Tap.KegSettings.
type KegTargetOptions ¶
type KegTargetOptions struct {
// Keg is the keg selector: a bare name or an @namespace/keg reference.
Keg string
// Namespace overrides the namespace the keg resolves in when Keg is a bare
// name. A conflicting namespace on a qualified reference is rejected.
Namespace string
// Hub pins the hub the keg resolves on, overriding namespace→hub resolution.
// Empty means resolve the hub from the namespace as usual.
Hub string
// Flight is optional task context that can restrict which kegs are available
// and injects agent instructions. It composes with the single-keg selectors
// (Keg/Namespace/Hub): the selector picks a keg and the flight gates it unless
// BypassFlightRestrictions is true.
Flight string
// FlightContext is the immutable, already-resolved flight snapshot used by
// an MCP session. When set it is authoritative over Flight and avoids
// consulting the process-wide flight cache while a tool call is running.
// Direct CLI callers leave this nil.
FlightContext *Flight
// BypassFlightRestrictions skips flight cover and role-cap checks while
// preserving Flight for callers that still need the flight context, such as
// orient. Leave false for MCP and other agent-facing surfaces.
BypassFlightRestrictions bool
// KegAdministration marks a call that administers the KEG itself (its
// settings) rather than its notes. A Hub resolver (KegResolver) decides
// it with the session flight's full authority, which may reach past the
// flight's cover when the flight manages the namespace's KEGs, so the
// client-side cover check below defers to it there. Without a resolver
// the check applies as for any call.
KegAdministration bool
// RequireBootstrap makes config-driven resolution fail with
// ErrNotBootstrapped when no user config exists. Set by the full `tap`
// surface and the MCP server; direct Tap API callers may leave it false.
RequireBootstrap bool
}
KegTargetOptions describes how a command should resolve a keg target.
type KegVersionNotAppliedError ¶ added in v0.46.0
type KegVersionNotAppliedError struct {
Namespace string
Alias string
Requested string
Created string
}
KegVersionNotAppliedError reports a KEG the Hub created at a version other than the one requested. A Hub that predates versioned KEGs ignores the requested version and creates a KEGv1 KEG. The KEG exists: the error reports the outcome and never deletes it. It unwraps to keg.ErrKegVersionUnsupported.
func (*KegVersionNotAppliedError) Error ¶ added in v0.46.0
func (e *KegVersionNotAppliedError) Error() string
func (*KegVersionNotAppliedError) Unwrap ¶ added in v0.46.0
func (e *KegVersionNotAppliedError) Unwrap() error
type KegVisibilityOptions ¶ added in v0.23.0
type KegVisibilityOptions struct {
Keg string
Namespace string
Hub string
Visibility string // public|private
}
KegVisibilityOptions sets a keg's visibility.
type LaunchOptions ¶ added in v0.37.0
type LaunchOptions struct {
// Harness names the agent CLI to start: claude, codex, opencode, or pi.
Harness string
// Agent is an explicit Hub agent reference (@namespace/name).
Agent string
// Model is a Hub catalog id. Empty starts on the first model in the
// catalog, which Hub orders by the best priority any contributing relay
// owner gave each pooled model.
Model string
// Flight is the explicit launch root. Empty falls back through TAP_FLIGHT,
// project configuration, and user configuration.
Flight string
// Inference is where a Claude Code launch sends model requests:
// LaunchInferenceSplit (the default for claude), LaunchInferenceHub, or
// LaunchInferenceSubscription. Other harnesses use Hub only.
Inference string
// Subagents picks the Hub agents a Claude Code launch offers as
// subagents: "" the agent's own subagents, "all" every agent the caller
// can see, "none" none.
Subagents string
// SubagentBuiltins are the Claude Code built-in tools each subagent gets
// beside its Hub tools. Nil means DefaultSubagentBuiltins.
SubagentBuiltins []string
// DryRun resolves and reports the invocation without executing it.
DryRun bool
// Args are extra arguments appended to the harness invocation.
Args []string
}
LaunchOptions configures behavior for Tap.Launch.
type LaunchResult ¶ added in v0.37.0
type LaunchResult struct {
// Inference is a Claude Code launch's mode; empty for other harnesses.
Inference string
// Hub names the hub serving the models.
HubAgent string
Hub string
Harness string
Model string
Flight string
Argv []string
Env map[string]string
StripEnv []string
Files map[string]string
Warnings []string
// contains filtered or unexported fields
}
LaunchResult reports the resolved invocation. Env holds only the overlay applied on top of the inherited environment; StripEnv names variables removed from it. Files are written to a per-launch directory for the harness to read. None of them carries a secret: the forwarder's address, its per-launch key, and that directory show as placeholders until Launch fills them in.
Flight is the canonical connection-pinned Hub-backed root exported to the child as TAP_FLIGHT. It is empty when no flight is configured; the harness then runs under no-flight identity authority and Warnings says so.
Warnings are returned rather than printed so a dry run and a real run report the same thing — see ResolveLaunch.
type LinksOptions ¶ added in v0.5.0
type LinksOptions struct {
KegTargetOptions
// NodeIDs are the source nodes to inspect outgoing links for.
// Results from all node IDs are merged and deduplicated.
NodeIDs []string
// Format is the output template. Legacy verbs %i (id), %t (title),
// %d (updated), %c (created), %a (accessed) remain supported, and %%
// renders a literal percent. Named selectors use %{...}: a bare word
// names a metadata key (%{type}), a leading dot names a statistics field
// (%{.accessCount}), and %{tags} is the tag list. Selectors other than
// id, title, and the three dates are resolved by the keg for the
// returned page in one batch.
Format string
Reverse bool
// Limit caps the number of results returned. 0 means no limit.
Limit int
// Offset skips the first N results before applying limit. Must be >= 0.
Offset int
}
type ListAgentsOptions ¶ added in v0.44.0
ListAgentsOptions selects whose agents to list. An empty Namespace lists the agents of every namespace the caller belongs to. Hub pins the hub.
type ListFilesOptions ¶ added in v0.2.0
type ListFilesOptions struct {
KegTargetOptions
NodeID string
}
type ListFlightsOptions ¶ added in v0.23.0
type ListFlightsOptions struct {
// Hub limits discovery to one configured hub. Empty discovers flights across
// every configured hub.
Hub string
// Warnings, when non-nil, collects one message per hub that was skipped
// (missing token, network failure) instead of failing the whole listing.
// Completion paths leave it nil so discovery stays silent and best-effort.
Warnings *[]string
}
ListFlightsOptions controls Tap.ListFlights. Flights are hub-scoped, so there is no keg target.
type ListImagesOptions ¶ added in v0.2.0
type ListImagesOptions struct {
KegTargetOptions
NodeID string
}
ListImagesOptions configures behavior for Tap.ListImages.
type ListOptions ¶
type ListOptions struct {
KegTargetOptions
// Query is an optional boolean expression that filters nodes. Supports both
// plain tag names ("golang") and key=value attribute predicates
// ("entity=plan"). When empty, all nodes are listed.
Query string
// Format is the output template. Legacy verbs %i (id), %t (title),
// %d (updated), %c (created), %a (accessed) remain supported, and %%
// renders a literal percent. Named selectors use %{...}: a bare word
// names a metadata key (%{type}), a leading dot names a statistics field
// (%{.accessCount}), and %{tags} is the tag list. Selectors other than
// id, title, and the three dates are resolved by the keg for the
// returned page in one batch.
Format string
Reverse bool
// Sort selects the sort order. Empty string means sort by node ID (default).
Sort ListSortType
// Limit caps the number of results returned. 0 means no limit.
Limit int
// Offset skips the first N results before applying limit. Must be >= 0.
Offset int
}
type ListSortType ¶ added in v0.5.0
type ListSortType string
ListSortType controls the ordering of listed nodes.
const ( SortByDefault ListSortType = "" // default: same as SortByID SortByID ListSortType = "id" // ascending node ID SortByUpdated ListSortType = "updated" // ascending by last-updated timestamp SortByCreated ListSortType = "created" // ascending by creation timestamp SortByAccessed ListSortType = "accessed" // ascending by last-accessed timestamp )
type ListVideosOptions ¶ added in v0.48.0
type ListVideosOptions struct {
KegTargetOptions
NodeID string
}
ListVideosOptions configures behavior for Tap.ListVideos.
type LocalOperations ¶ added in v0.44.0
type LocalOperations struct{}
LocalOperations composes TAP operations from KEG operations. Field values for a page are resolved with one ListView call, never per node.
func (LocalOperations) Related ¶ added in v0.44.0
func (LocalOperations) Related(ctx context.Context, k keg.Keg, direction keg.RelatedDirection, in tapapi.RelatedRequest) (*tapapi.RelatedResponse, error)
func (LocalOperations) Tags ¶ added in v0.44.0
func (LocalOperations) Tags(ctx context.Context, k keg.Keg, in tapapi.TagsRequest) (*tapapi.TagsResponse, error)
type LockOptions ¶ added in v0.11.0
type LockOptions struct {
NodeID string
// Wait bounds how long to wait for a lock another holder has, clamped by
// keg.ClampNodeLockWait: zero means the 10s default, and anything above 60s
// waits 60s. See keg.WithNodeLockWait.
Wait time.Duration
KegTargetOptions
}
LockOptions configures behavior for Tap.Lock.
type LockStatusOptions ¶ added in v0.11.0
type LockStatusOptions struct {
NodeID string
KegTargetOptions
}
LockStatusOptions configures behavior for Tap.LockStatus.
type MergeOptions ¶ added in v0.46.0
type MergeOptions struct {
KegTargetOptions
SourceID string
ExpectedSourceHash string
// Target is the surviving node's rewrite, as for one EditBatch item.
Target BatchEditItem
}
type MetaOptions ¶
type MetaOptions struct {
// NodeID is the node identifier to inspect (e.g., "0", "42")
NodeID string
KegTargetOptions
// LockToken is an optional cross-process lock token. When provided, the
// command validates it against any held lock before proceeding.
LockToken string
Schema string
// Edit opens metadata in the editor.
Edit bool
// Stream carries stdin piping information.
Stream *toolkit.Stream
}
MetaOptions configures behavior for Tap.Meta.
type MoveOptions ¶
type MoveOptions struct {
KegTargetOptions
SourceID string
DestID string
ExpectedHash string
}
type NamespaceAddMemberOptions ¶ added in v0.23.0
type NamespaceAddMemberOptions struct {
Namespace string
Hub string
User string
Role string // owner|admin|member
}
NamespaceAddMemberOptions upserts a member into a namespace.
type NamespaceCreateOptions ¶ added in v0.23.0
NamespaceCreateOptions creates an org namespace.
type NamespaceCreateResult ¶ added in v0.23.0
NamespaceCreateResult tells the caller where to create the namespace in the hub UI. Namespace creation is a paid hub feature, so the CLI/MCP surface hands the user to the browser instead of calling the API.
type NamespaceListOptions ¶ added in v0.23.0
type NamespaceListOptions struct {
Hub string
}
NamespaceListOptions selects which hub to query for namespaces. An empty Hub uses the active Hub.
type NamespaceListResult ¶ added in v0.40.0
type NamespaceListResult struct {
Namespaces []HubNamespace
Warnings []string
}
NamespaceListResult carries the aggregated rows plus a note for each hub that could not be reached. Warnings are non-fatal by design: one unreachable hub must not blank out the namespaces the others returned.
type NamespaceMembersOptions ¶ added in v0.23.0
NamespaceMembersOptions selects the namespace whose members to list. Namespace is the selector; empty resolves the default namespace. Hub pins the hub.
type NamespaceRemoveMemberOptions ¶ added in v0.23.0
NamespaceRemoveMemberOptions removes a member from a namespace.
type NamespaceSetRoleOptions ¶ added in v0.23.0
type NamespaceSetRoleOptions struct {
Namespace string
Hub string
User string
Role string // owner|admin|member
}
NamespaceSetRoleOptions changes an existing member's role.
type NodeHistoryOptions ¶ added in v0.4.0
type NodeHistoryOptions struct {
KegTargetOptions
NodeID string
}
type NodeRestoreOptions ¶ added in v0.4.0
type NodeRestoreOptions struct {
KegTargetOptions
NodeID string
Rev string
}
type NodeSnapshotOptions ¶ added in v0.4.0
type NodeSnapshotOptions struct {
KegTargetOptions
NodeID string
Message string
}
type NodeSnapshotViewOptions ¶ added in v0.23.0
type NodeSnapshotViewOptions struct {
KegTargetOptions
NodeID string
Rev string
}
type Operations ¶ added in v0.44.0
type Operations interface {
// Related returns one page of a node set's links or backlinks in k.
Related(ctx context.Context, k keg.Keg, direction keg.RelatedDirection, in tapapi.RelatedRequest) (*tapapi.RelatedResponse, error)
// Tags lists k's tags, or with a query, one page of the nodes it selects.
Tags(ctx context.Context, k keg.Keg, in tapapi.TagsRequest) (*tapapi.TagsResponse, error)
}
Operations executes complete TAP operations against a resolved KEG: the relationship lookup plus the fields its listing renders, or a tag listing, as one unit. It is the seam that lets a Hub-backed KEG answer the whole operation next to the data instead of the client composing KEG calls.
The default forwards to the KEG's Hub over /api/v1/tap/* when the KEG is a Hub KEG and composes KEG operations locally otherwise. A Hub serving its own MCP endpoint injects an implementation backed by its TAP service.
type OrientOptions ¶ added in v0.19.0
type OrientOptions struct {
KegTargetOptions
}
OrientOptions is the input to Tap.Orient. Flight is the only selector used by orientation; the embedded target options remain for CLI profile compatibility and are intentionally absent from the MCP input.
type OrientationAuthority ¶ added in v0.39.0
type OrientationAuthority struct {
Children []*Flight
Root *Flight
Active *Flight
Path []string
AvailableFlights []string
Revision string
FullAccess bool
// Agent names the Hub agent a `tap mcp` session runs as (TAP_AGENT), or
// "" when a person is. An agent session never claims identity authority:
// the agent's tool allowlist and the flight govern what it may do.
Agent string
}
OrientationAuthority describes the connection-pinned launch root and the flight selected from its live transitive graph for this call.
type OrientationKeg ¶ added in v0.35.0
type OrientationKeg struct {
CoverSource string
Distance int
Ref string
Namespace string
Alias string
Title string
Description string
Role string
Source string
Visibility string
// KegVersion is the KEG's immutable storage version; empty means the Hub
// predates versioned KEGs and the KEG is KEGv1.
KegVersion string
FlightCap string
Flights []string
}
OrientationKeg is one effective KEG exposed by an orientation context.
func ProjectOrientationKegs ¶ added in v0.39.0
func ProjectOrientationKegs(flight *Flight, rows []OrientationKeg) []OrientationKeg
ProjectOrientationKegs applies one flight's cover to a previously loaded identity projection. The returned rows retain the identity role and record the independent flight cap so callers can compute the lesser effective role.
type PathService ¶
func NewPathService ¶
func NewPathService(rt *toolkit.Runtime, root string) (*PathService, error)
func (*PathService) AuthStorePath ¶ added in v0.20.0
func (s *PathService) AuthStorePath() string
AuthStorePath returns the on-disk location of the hub-auth credentials store. The file is stored under StateRoot (not ConfigRoot) because it holds mutable per-host tokens rather than user-edited configuration.
func (*PathService) Project ¶
func (s *PathService) Project() string
func (*PathService) ProjectConfig ¶
func (s *PathService) ProjectConfig() string
func (*PathService) UserConfig ¶
func (s *PathService) UserConfig() string
type ReadAttachmentOptions ¶ added in v0.43.0
type ReadAttachmentOptions struct {
KegTargetOptions
NodeID string
Kind keg.AttachmentKind
Name string
}
ReadAttachmentOptions configures behavior for Tap.ReadAttachment.
type ReadImageOptions ¶ added in v0.24.0
type ReadImageOptions struct {
KegTargetOptions
NodeID string
Name string
}
ReadImageOptions configures behavior for Tap.ReadImage.
type ReadVideoOptions ¶ added in v0.48.0
type ReadVideoOptions struct {
KegTargetOptions
NodeID string
Name string
}
ReadVideoOptions configures behavior for Tap.ReadVideo.
type RefContext ¶ added in v0.23.0
RefContext carries the "current keg" so a node reference can resolve a keg-local alias against that keg's aliases and imply the hub for a qualified reference from the current keg's hub.
type Relationship ¶ added in v0.41.0
Relationship identifies an actual resolved, directed link in a result page.
type RelationshipResultObserver ¶ added in v0.41.0
type RelationshipResultObserver func(context.Context, keg.Keg, []Relationship)
RelationshipResultObserver receives structured relationships after pagination and before formatting. Consumers must buffer until the enclosing operation succeeds; formatting can still fail. The owning Keg carries resolved identity.
type RelayClaudeRunner ¶ added in v0.45.0
type RelayClaudeRunner struct {
// Run offers the "claude" server, which hands tasks to Claude Code.
Run bool `yaml:"run,omitempty"`
// Tools offers the "claude-tools" server, Claude Code's own tools.
Tools bool `yaml:"tools,omitempty"`
}
RelayClaudeRunner holds Claude Code's options, the only harness with an MCP serve mode.
type RelayConfig ¶ added in v0.44.0
type RelayConfig struct {
// Enabled turns the relay off without removing its configuration when
// false. Omitted means enabled.
Enabled *bool `yaml:"enabled,omitempty"`
// Name identifies the relay to Hub. It defaults to the hostname.
Name string `yaml:"name,omitempty"`
// Hubs names the configured hubs to serve at once. Empty means the one
// hub `tap relay` resolves like login does; --hub narrows to one.
Hubs []string `yaml:"hubs,omitempty"`
// Providers are keyed by the name advertised to Hub.
Providers map[string]RelayProvider `yaml:"providers,omitempty"`
// MCP are local MCP servers whose tools the relay forwards to Hub,
// keyed by the server name advertised to Hub.
MCP map[string]RelayMCPServer `yaml:"mcp,omitempty"`
// Runners configures the relay's built-in servers, one per coding agent
// CLI ("claude", "codex", "opencode", "pi") plus "claude-tools", Claude
// Code's own tools. Each is off unless turned on here. A server in MCP
// with the same name replaces (or, with enabled: false, removes) a
// built-in.
Runners *RelayRunners `yaml:"runners,omitempty"`
}
RelayConfig configures `tap relay`. It holds provider access and nothing else: model identity comes from the Hub catalog, never from local config.
func (*RelayConfig) IsEnabled ¶ added in v0.44.0
func (rc *RelayConfig) IsEnabled() bool
IsEnabled reports whether `tap relay` may run: true unless enabled is explicitly false.
type RelayMCPServer ¶ added in v0.45.0
type RelayMCPServer struct {
// Enabled leaves the server out when false. Omitted means enabled.
Enabled *bool `yaml:"enabled,omitempty"`
Title string `yaml:"title,omitempty"`
Command string `yaml:"command,omitempty"`
Args []string `yaml:"args,omitempty"`
Cwd string `yaml:"cwd,omitempty"`
// Env sets literal variables for the server. Keep secrets out of it;
// pass them with EnvFrom.
Env map[string]string `yaml:"env,omitempty"`
// EnvFrom names variables passed through from the relay's environment.
// Only a small base set (PATH, HOME, locale, ...) is passed otherwise.
EnvFrom []string `yaml:"envFrom,omitempty"`
// InheritEnv passes the relay's whole environment instead.
InheritEnv bool `yaml:"inheritEnv,omitempty"`
URL string `yaml:"url,omitempty"`
Headers map[string]string `yaml:"headers,omitempty"`
// HeadersFromEnv maps a header name to the variable holding its value.
HeadersFromEnv map[string]string `yaml:"headersFromEnv,omitempty"`
Tools RelayToolFilter `yaml:"tools,omitempty"`
// MaxConcurrent bounds this server's in-flight calls across every hub.
// Zero means the relay default (4).
MaxConcurrent int `yaml:"maxConcurrent,omitempty"`
// Timeout bounds one call, as a Go duration ("30s", "5m"). Empty means
// two minutes.
Timeout string `yaml:"timeout,omitempty"`
}
RelayMCPServer describes one MCP server the relay forwards tools from. Exactly one of Command (a stdio server the relay starts) or URL (a running streamable HTTP server) is set. Like provider keys, secrets are named, not written: EnvFrom and HeadersFromEnv name environment variables.
func (RelayMCPServer) IsEnabled ¶ added in v0.45.0
func (s RelayMCPServer) IsEnabled() bool
IsEnabled reports whether the server is forwarded: true unless enabled is explicitly false.
type RelayModelFilter ¶ added in v0.44.0
type RelayModelFilter struct {
Allow []string `yaml:"allow,omitempty"`
Deny []string `yaml:"deny,omitempty"`
Transcription []string `yaml:"transcription,omitempty"`
Embeddings []string `yaml:"embeddings,omitempty"`
Metadata map[string]RelayModelMeta `yaml:"metadata,omitempty"`
Variants map[string]RelayVariant `yaml:"variants,omitempty"`
}
RelayModelFilter selects which of a provider's models are offered. An empty Allow offers everything not denied. Transcription names the models (ids or globs) that turn speech into text through /audio/transcriptions instead of chatting; exact ids are offered even when the provider's /models omits them. Embeddings names the models (ids or globs) that turn text into vectors through /embeddings; Ollama reports its own, so it is for other providers.
Metadata fills in what the provider does not report about a model's context and reasoning, keyed by id or glob; it also overrides what it does report. Variants offer a model under its own id with fixed settings: on Ollama a variant with a contextWindow is created as a real model with that num_ctx, elsewhere it is an alias of `from`.
type RelayModelMeta ¶ added in v0.44.0
type RelayModelMeta struct {
ContextWindow int `yaml:"contextWindow,omitempty"`
MaxContextWindow int `yaml:"maxContextWindow,omitempty"`
Reasoning string `yaml:"reasoning,omitempty"`
Tools *bool `yaml:"tools,omitempty"`
Vision *bool `yaml:"vision,omitempty"`
Video *bool `yaml:"video,omitempty"`
Canonical string `yaml:"canonical,omitempty"`
}
RelayModelMeta is configured model metadata. ContextWindow is the window the provider serves; MaxContextWindow the most the model supports. Reasoning is none, toggle (on or off), or effort (low, medium, high). Tools, Vision, and Video say whether the model calls tools, accepts images, and accepts video, when the provider does not report it or reports it wrong. Canonical is the provider-neutral name Hub pools the model under, when the derived one (lowercase, no source prefix, no quantization suffix) is not the right match.
type RelayOptions ¶ added in v0.44.0
type RelayOptions struct {
// Hub is an explicit hub URL or configured hub name. It narrows the
// relay to that one hub, overriding relay.hubs.
Hub string
// Name overrides relay.name from configuration.
Name string
// Version is the tap version reported at registration.
Version string
// OnRegistered observes each successful registration.
OnRegistered func(hubURL string, reg relaycontract.Registered)
}
RelayOptions configures `tap relay`.
type RelayProvider ¶ added in v0.44.0
type RelayProvider struct {
Kind string `yaml:"kind,omitempty"`
BaseURL string `yaml:"baseUrl,omitempty"`
Auth string `yaml:"auth,omitempty"`
APIKeyEnv string `yaml:"apiKeyEnv,omitempty"`
Models RelayModelFilter `yaml:"models,omitempty"`
// MaxConcurrent bounds this provider's in-flight requests across every
// hub the relay serves. Zero means the relay default (4).
MaxConcurrent int `yaml:"maxConcurrent,omitempty"`
// Priority ranks this provider's models on Hub, 1 to 99: lower is
// preferred, both in the model list and when a pool picks a source.
// Omitted means unranked, after every ranked provider.
Priority int `yaml:"priority,omitempty"`
}
RelayProvider describes how the relay reaches one model provider.
Auth is none (a local provider such as Ollama) or apiKey, in which case APIKeyEnv names the environment variable holding the key. The name is configured, never the secret, mirroring HubEntry.TokenEnv.
type RelayRunner ¶ added in v0.45.0
type RelayRunner struct {
// Run offers the harness's server, which hands tasks to it.
Run bool `yaml:"run,omitempty"`
// contains filtered or unexported fields
}
RelayRunner holds the options of a harness that can only run tasks. It has no tools option: only Claude Code serves its own tools over MCP.
func (*RelayRunner) UnmarshalYAML ¶ added in v0.45.0
func (r *RelayRunner) UnmarshalYAML(n *yaml.Node) error
UnmarshalYAML decodes run and remembers any tools key, which only Claude Code supports, so the relay can refuse it rather than silently ignore it.
type RelayRunners ¶ added in v0.45.0
type RelayRunners struct {
// Claude offers Claude Code: run as the "claude" server (claude_code_run)
// and tools as the "claude-tools" server (`claude mcp serve`).
Claude *RelayClaudeRunner `yaml:"claude,omitempty"`
// Codex offers Codex as the "codex" server (codex_run).
Codex *RelayRunner `yaml:"codex,omitempty"`
// Opencode offers opencode as the "opencode" server (opencode_run).
Opencode *RelayRunner `yaml:"opencode,omitempty"`
// Pi offers pi as the "pi" server (pi_run).
Pi *RelayRunner `yaml:"pi,omitempty"`
// Roots are the directories a delegated task may work in. Empty means
// the home directory. The first is also claude-tools' working directory.
Roots []string `yaml:"roots,omitempty"`
// Timeout bounds one delegated task, as a Go duration. Empty means 30m.
Timeout string `yaml:"timeout,omitempty"`
// MaxConcurrent bounds the tasks running at once on each runner server.
// Zero means 2.
MaxConcurrent int `yaml:"maxConcurrent,omitempty"`
}
RelayRunners configures the relay's built-in coding-runner servers. Every harness is off unless its options turn it on, and each is offered only when its CLI is on PATH.
func (*RelayRunners) ClaudeRun ¶ added in v0.45.0
func (r *RelayRunners) ClaudeRun() bool
ClaudeRun reports whether the "claude" runner server is turned on.
func (*RelayRunners) ClaudeTools ¶ added in v0.45.0
func (r *RelayRunners) ClaudeTools() bool
ClaudeTools reports whether the "claude-tools" server is turned on.
func (*RelayRunners) Runs ¶ added in v0.45.0
func (r *RelayRunners) Runs(name string) bool
Runs reports whether the named harness's runner server is turned on.
func (*RelayRunners) Validate ¶ added in v0.45.0
func (r *RelayRunners) Validate() error
Validate refuses options a harness does not support, such as tools on codex, opencode, or pi.
type RelayToolFilter ¶ added in v0.45.0
type RelayToolFilter struct {
Allow []string `yaml:"allow,omitempty"`
Deny []string `yaml:"deny,omitempty"`
}
RelayToolFilter selects which of a server's tools are offered, by name or glob. An empty Allow offers everything not denied.
type RelayVariant ¶ added in v0.44.0
type RelayVariant struct {
From string `yaml:"from"`
RelayModelMeta `yaml:",inline"`
}
RelayVariant is a model offered under its own id that runs From.
type RemoveOptions ¶
type RemoveOptions struct {
KegTargetOptions
// NodeIDs lists explicit node IDs to remove.
NodeIDs []string
// Query is an optional boolean expression (tags and/or key=value attr
// predicates) that selects additional nodes to remove.
Query string
ExpectedHash string
ExpectedHashes map[string]string
}
type ReplaceOptions ¶ added in v0.46.0
type ReplaceOptions struct {
KegTargetOptions
keg.ReplaceTextOptions
}
type ResolveKegOptions ¶
type ResolveKegOptions struct {
// Root is used only for workspace kegMap matching.
Root string
Keg string
Namespace string
Hub string
RequireBootstrap bool
NoCache bool
}
ResolveKegOptions controls remote KEG resolution.
type RunnerInput ¶ added in v0.45.0
type RunnerInput struct {
Task string `json:"task" jsonschema:"the instruction for the coding agent, as you would type it"`
Cwd string `json:"cwd" jsonschema:"absolute path of the directory to work in; must be under one of the relay's allowed roots"`
Session string `json:"session,omitempty" jsonschema:"session id from an earlier result, to continue that conversation"`
Model string `json:"model,omitempty" jsonschema:"model to use, in the runner's own naming; omit for its default"`
}
RunnerInput is one task for a runner.
type RunnerOutput ¶ added in v0.45.0
type RunnerOutput struct {
Runner string `json:"runner" jsonschema:"the runner that ran the task"`
Session string `json:"session,omitempty" jsonschema:"session id; pass it back as session to continue"`
Reply string `json:"reply" jsonschema:"the runner's final reply"`
IsError bool `json:"is_error" jsonschema:"whether the run failed"`
}
RunnerOutput is a runner's answer to one task.
type RunnerService ¶ added in v0.45.0
type RunnerService struct {
// Installed are the runners found on the runtime's PATH.
Installed []InstalledRunner
// Roots are the directories a task's cwd must resolve under.
Roots []string
// Timeout bounds one task.
Timeout time.Duration
// Depth is this process's delegation depth; at 1 or more every call is
// refused.
Depth int
// contains filtered or unexported fields
}
RunnerService runs tasks on the installed runners. Build it with NewRunnerService.
func NewRunnerService ¶ added in v0.45.0
func NewRunnerService(rt *toolkit.Runtime) (*RunnerService, error)
NewRunnerService reads the runner settings from rt's environment.
func (*RunnerService) Only ¶ added in v0.45.0
func (s *RunnerService) Only(name string) error
Only narrows the service to the named runner, so it serves that one tool and refuses the rest. It fails when the runner is unknown or not installed.
func (*RunnerService) Run ¶ added in v0.45.0
func (s *RunnerService) Run(ctx context.Context, name string, in RunnerInput) (RunnerOutput, error)
Run hands in.Task to the named runner and waits for its reply. Bad input or a refused call is an error; a runner that ran and failed is an output with IsError set.
type RunnerSpec ¶ added in v0.45.0
type RunnerSpec struct {
// Name is the runner's short name, reported in results.
Name string
// Binary is the executable looked up on PATH.
Binary string
// Tool is the MCP tool name that runs it.
Tool string
// Title is the human name used in tool descriptions.
Title string
// Permissions says, for the tool description, what the runner may do
// without asking in this non-interactive mode.
Permissions string
}
RunnerSpec describes one coding agent CLI `tap runner serve` can drive.
type SchemaOptions ¶ added in v0.25.0
type SchemaOptions struct {
KegTargetOptions
Type string
Data []byte
ExpectedHash string
}
type SearchOptions ¶ added in v0.46.0
type SearchOptions struct {
KegTargetOptions
// Kegs narrows a whole-Hub search to these "@namespace/alias" references,
// at most tapapi.SearchMaxKegs of them. It cannot be combined with Keg.
Kegs []string
// Query is plain terms, "quoted phrases", and -exclusions. The Hub parses
// it.
Query string
// Cursor continues the page a previous response's NextCursor named. It is
// opaque and sent unchanged.
Cursor string
// Limit caps the hits returned; 0 lets the Hub choose. The Hub owns the
// default and the maximum.
Limit int
}
SearchOptions configures ranked node search.
With Keg set, the search covers that one Hub KEG. Otherwise it covers every KEG the caller may read on the selected Hub, narrowed to Kegs when given and to the active flight's cover unless BypassFlightRestrictions is set. A governed call that carries the orientation proof leaves an unscoped search for the Hub to scope to the cover; otherwise the client names the cover, which must fit in tapapi.SearchMaxKegs.
func (SearchOptions) Validate ¶ added in v0.46.0
func (o SearchOptions) Validate() ([]string, error)
Validate checks the request shape every surface shares and returns the canonical, de-duplicated Kegs. A provider serving search in-process calls it before running the search so its surface refuses what Tap.Search refuses.
type StatsOptions ¶
type StatsOptions struct {
// NodeID is the node identifier to inspect (e.g., "0", "42")
NodeID string
KegTargetOptions
}
type TagsOptions ¶
type TagsOptions struct {
KegTargetOptions
// Query is an optional boolean expression that filters nodes. Supports both
// plain tag names ("golang") and key=value attribute predicates
// ("entity=plan"). When empty, all tags are listed.
Query string
// Format is the output template. Legacy verbs %i (id), %t (title),
// %d (updated), %c (created), %a (accessed) remain supported, and %%
// renders a literal percent. Named selectors use %{...}: a bare word
// names a metadata key (%{type}), a leading dot names a statistics field
// (%{.accessCount}), and %{tags} is the tag list. Selectors other than
// id, title, and the three dates are resolved by the keg for the
// returned page in one batch.
Format string
Reverse bool
// Limit caps the number of results returned. 0 means no limit.
Limit int
// Offset skips the first N results before applying limit. Must be >= 0.
Offset int
}
type Tap ¶
type Tap struct {
Root string
// Runtime carries process-level dependencies.
Runtime *toolkit.Runtime
PathService *PathService
ConfigService *ConfigService
KegService *KegService
FlightService *FlightService
// AuthValidateFn is the seam AuthStatus uses for its live whoami probe.
// Defaulted to ValidateToken in NewTap; tests override it (or point the
// hub at an httptest server) to avoid real network I/O. Both the CLI and
// MCP surfaces share the same *Tap, so overriding it covers both.
AuthValidateFn func(ctx context.Context, rt *toolkit.Runtime, hubURL, token string) (*WhoAmI, error)
// KegResolver, when non-nil, overrides config-driven keg resolution. It is
// the seam tapper-hub uses to serve a per-user MCP connector: the hub injects
// a resolver that opens kegs from its own Postgres catalog and enforces the
// caller's role, bypassing the on-disk config cascade and AuthStore entirely
// (which, in the hub server's process, hold no login). role is the access
// level the calling operation needs — FlightRoleViewer for reads and
// FlightRoleEditor for writes — so the resolver can map it to a catalog role
// check. Admin-class flight operations may use a different flight cap while
// retaining an editor identity requirement. Every node read/write op funnels
// through resolveKegForRole, so a
// single resolver covers the whole surface. Left nil for the CLI, which keeps
// the standard config-driven resolution.
KegResolver func(ctx context.Context, opts KegTargetOptions, role FlightRole) (keg.Keg, error)
// Operations, when non-nil, executes complete TAP operations (links,
// backlinks, tags) instead of DefaultOperations. A Hub serving its own MCP
// endpoint injects its in-process TAP service here.
Operations Operations
// WebBaseURL is the public web origin of the Hub serving this Tap. A Hub
// that injects KegResolver sets it so WebURL links point at the Hub
// itself; the CLI leaves it empty and links to the configured hub.
WebBaseURL string
// Version is the version of the binary running this Tap, already
// normalized by NewTap. `tap integrate` stamps it into every plugin
// manifest it extracts, so an installed plugin always reports the tap
// that installed it rather than whatever was committed in the repo.
Version string
// contains filtered or unexported fields
}
func NewTap ¶
func NewTap(opts TapOptions) (*Tap, error)
func (*Tap) ActiveAgent ¶ added in v0.47.0
ActiveAgent returns the Hub agent this process runs as (TAP_AGENT, set by `tap launch` for a `tap mcp` session), or "" when a person is driving it.
func (*Tap) ActiveFlightName ¶ added in v0.30.0
ActiveFlightName resolves an explicit flight, falling back to the flight in the process configuration snapshot. It is a pure read: it neither writes configuration nor reloads it, so callers that need a fresh cascade call ConfigService.Reload at their own boundary (see Orient and the MCP session gate).
func (*Tap) ActiveLaunch ¶ added in v0.44.0
ActiveLaunch describes the `tap launch` session driving this process, as "<harness> on <model>", or "" when it was not launched. Like ActiveFlightName it is a pure read of the current snapshot.
func (*Tap) AuthLogout ¶ added in v0.20.0
func (t *Tap) AuthLogout(ctx context.Context, opts AuthLogoutOptions) (*AuthLogoutResult, error)
AuthLogout removes the cached credential for a hub from the on-disk auth store. Unlike AuthStatus this method is intentionally NOT exposed over MCP — an agent should never be able to yank a user's hub token out from under them. The CLI surface is the only consumer.
Resolution precedence mirrors AuthStatus:
- Hub set → canonicalize and delete that hub.
- Hub empty AND single hub stored → auto-resolve to that hub.
- Hub empty AND zero hubs stored → soft-success, "No hub logins stored.".
- Hub empty AND multiple hubs stored → error (caller must pick).
Missing entries (hub was provided but not stored) are NOT errors — they return Result{Removed: false} with a clear Formatted line. The command is idempotent by design so cleanup scripts can re-run without special-casing the already-logged-out state.
func (*Tap) AuthRefreshAll ¶ added in v0.28.1
AuthRefreshAll renews every stored hub credential whose access token is expired or within refreshSkew of expiring, persisting the rotated pairs. Entries without a refresh token (pasted API tokens) or without a known expiry are skipped. Best-effort by design: failures are logged at debug and never returned — this runs on every CLI/MCP startup and a broken hub must not block unrelated commands. Cost when all tokens are fresh: one file read, zero network calls.
func (*Tap) AuthStatus ¶ added in v0.20.0
func (t *Tap) AuthStatus(ctx context.Context, opts AuthStatusOptions) (*AuthStatusResult, error)
AuthStatus reports the login status for a stored hub.
Resolution precedence:
- Empty store AND empty Hub → not-present, directed hint message.
- Hub set → canonicalize and look up exactly that hub.
- Hub empty AND one or more hubs stored → report every stored hub.
Missing entries (hub was provided but not stored) are NOT errors — they return a Result{Present: false} with a clear Formatted line. That keeps `tap auth status --hub X` usable from scripts without requiring caller-side error-matching.
func (*Tap) Bootstrap ¶ added in v0.23.0
func (t *Tap) Bootstrap(ctx context.Context, opts BootstrapOptions) (*BootstrapResult, error)
Bootstrap creates or refreshes the selected user Hub and its connection. Existing extension fields and directory mappings survive a re-run.
func (*Tap) CatViews ¶ added in v0.39.0
CatViews returns the node views Cat renders, in caller order. It exists so callers needing structured per-node state — an agent reading the content hash it must echo back on its next write — do not have to parse Cat's formatted output. The editor and TTY delegation in Cat is deliberately absent: those paths are interactive and produce no views.
func (*Tap) Config ¶
func (t *Tap) Config(opts ConfigOptions) (string, error)
Config displays the merged or project configuration.
func (*Tap) ConfigEdit ¶
func (t *Tap) ConfigEdit(ctx context.Context, opts ConfigEditOptions) error
ConfigEdit edits the selected tap config file.
If stdin is piped with non-empty content, the piped YAML is validated and written directly without opening an editor. Otherwise the file is opened in the configured editor.
func (*Tap) ConfigExplain ¶ added in v0.17.0
func (t *Tap) ConfigExplain(ctx context.Context, opts ConfigExplainOptions) ([]ConfigExplainResult, error)
ConfigExplain returns provenance for config fields, showing which source set each value. It loads each tier individually and walks from most-specific to least-specific to determine the effective source.
func (*Tap) ConfigTemplate ¶ added in v0.4.0
func (t *Tap) ConfigTemplate(opts ConfigTemplateOptions) (string, error)
ConfigTemplate returns starter YAML for either user or project config.
func (*Tap) ContextInfo ¶ added in v0.46.0
func (t *Tap) ContextInfo(ctx context.Context, opts KegTargetOptions) (ContextInfoResult, error)
ContextInfo reports the hub, the default KEG, the active flight, and the KEGs that flight covers. It is best-effort: a hub that cannot be reached or a flight that cannot be loaded becomes a warning, and the locally configured defaults are still reported. The hub's part comes from one GET /api/v1/info, or from concurrent requests on a hub without it.
func (*Tap) CreateAgent ¶ added in v0.44.0
CreateAgent creates an agent. The caller must be a namespace owner or admin.
func (*Tap) CreateBatch ¶ added in v0.38.0
func (t *Tap) CreateBatch(ctx context.Context, opts BatchCreateOptions) ([]keg.CreateNodeResult, error)
func (*Tap) CreateFlight ¶ added in v0.23.0
func (*Tap) CreateSchema ¶ added in v0.25.0
func (t *Tap) CreateSchema(ctx context.Context, opts SchemaOptions) error
func (*Tap) DeleteAgent ¶ added in v0.44.0
func (t *Tap) DeleteAgent(ctx context.Context, opts DeleteAgentOptions) error
DeleteAgent removes an agent. The caller must be a namespace owner or admin.
func (*Tap) DeleteFile ¶ added in v0.2.0
func (t *Tap) DeleteFile(ctx context.Context, opts DeleteFileOptions) error
DeleteFile removes a file attachment from a node.
func (*Tap) DeleteFlight ¶ added in v0.23.0
func (t *Tap) DeleteFlight(ctx context.Context, opts DeleteFlightOptions) error
func (*Tap) DeleteImage ¶ added in v0.2.0
func (t *Tap) DeleteImage(ctx context.Context, opts DeleteImageOptions) error
DeleteImage removes an image from a node.
func (*Tap) DeleteSchema ¶ added in v0.25.0
func (t *Tap) DeleteSchema(ctx context.Context, opts SchemaOptions) error
func (*Tap) DeleteVideo ¶ added in v0.48.0
func (t *Tap) DeleteVideo(ctx context.Context, opts DeleteVideoOptions) error
DeleteVideo removes a video from a node.
func (*Tap) DoctorConfig ¶ added in v0.17.0
DoctorConfig validates the tapper configuration (not keg-level) and returns issues. This does not require a keg to be resolved.
func (*Tap) DownloadFile ¶ added in v0.2.0
DownloadFile retrieves a node file attachment and writes it to a local path. Returns the destination path.
func (*Tap) DownloadImage ¶ added in v0.2.0
DownloadImage retrieves a node image and writes it to a local path. Returns the destination path.
func (*Tap) DownloadVideo ¶ added in v0.48.0
DownloadVideo writes a node video to a local path, or to stdout when Dest is "-", and returns the destination path.
func (*Tap) Edit ¶
func (t *Tap) Edit(ctx context.Context, opts EditOptions) error
Edit opens a node in an editor using a temporary file with frontmatter. Changes are sent back to the Hub as the editor saves.
The temp file format is:
--- <meta yaml> --- <markdown body>
If stdin is piped, it seeds the content directly without opening an editor.
func (*Tap) EditAgent ¶ added in v0.44.0
EditAgent reads the agent, applies the set fields, and writes it back. The caller must be a namespace owner or admin.
func (*Tap) EditBatch ¶ added in v0.38.0
func (t *Tap) EditBatch(ctx context.Context, opts BatchEditOptions) ([]keg.NodeUpdateResult, error)
func (*Tap) EditFlight ¶ added in v0.24.0
EditFlight edits a Hub-backed flight's manifest as YAML.
If stdin is piped with non-empty content, the piped manifest is validated and applied directly. Otherwise the manifest opens in the configured editor; every save is validated and PUT to the hub immediately, so the editor session behaves like the rest of tapper's live-save edit flows.
The manifest carries title, visibility, subflights, cover, and instructions. The slug and namespace are fixed by the ref: the YAML document cannot express them, and a stray "slug" key is rejected as an unknown field.
func (*Tap) EditSchema ¶ added in v0.25.0
func (t *Tap) EditSchema(ctx context.Context, opts EditSchemaOptions) error
EditSchema replaces a schema definition. Schemas decide which node types are valid and how every write is checked, so defining them is keg administration rather than content editing — admin here, matching CreateSchema and DeleteSchema. Reading schemas stays viewer.
func (*Tap) ExploreFlights ¶ added in v0.46.0
func (t *Tap) ExploreFlights(ctx context.Context, opts ExploreOptions) (ExploreResult, error)
ExploreFlights searches the hub's public flights.
func (*Tap) ExploreKegs ¶ added in v0.46.0
func (t *Tap) ExploreKegs(ctx context.Context, opts ExploreOptions) (ExploreResult, error)
ExploreKegs searches the hub's public KEGs.
func (*Tap) ExplorePeople ¶ added in v0.46.0
func (t *Tap) ExplorePeople(ctx context.Context, opts ExploreOptions) (ExploreResult, error)
ExplorePeople searches the people and org namespaces on the hub.
func (*Tap) Export ¶ added in v0.4.0
Export writes a keg-archive of the selected nodes (all nodes when none are named) to opts.OutputPath and returns the resolved output path.
func (*Tap) ForceUnlock ¶ added in v0.11.0
func (t *Tap) ForceUnlock(ctx context.Context, opts ForceUnlockOptions) error
ForceUnlock unconditionally removes a cross-process lock on a node.
func (*Tap) GetAgent ¶ added in v0.44.0
GetAgent returns one agent. The caller must belong to its namespace.
func (*Tap) GetFlight ¶ added in v0.23.0
GetFlight loads a single flight by name, as the Hub holds it now. It is the inspection read behind `tap flight show` and MCP flight_read, and its hash is the precondition for a guarded edit or delete, so it never serves the process cache that per-operation flight gating uses: a long-running `tap mcp` would otherwise show a flight as it was when first read.
func (*Tap) HubAdd ¶ added in v0.23.0
func (t *Tap) HubAdd(_ context.Context, opts HubAddOptions) error
HubAdd registers a remote hub connection. Hub entries may only live in USER config (the trust boundary strips hubs from project config), so this always writes the user config regardless of the working directory.
func (*Tap) HubAgent ¶ added in v0.44.0
HubAgent fetches a Hub agent (@namespace/name) from the selected hub.
func (*Tap) HubList ¶ added in v0.23.0
HubList returns the configured hubs (plus the synthesized built-ins when none are configured), marking the default and the config layer each came from. It inspects local config only — it does not contact any hub.
func (*Tap) HubListKegs ¶ added in v0.23.0
HubListKegs lists identity-accessible KEGs on the selected Hub.
func (*Tap) HubRelayTools ¶ added in v0.45.0
HubRelayTools returns the selected hub's /mcp/relay endpoint and a token source for it, for `tap mcp` to proxy the caller's relayed tools. agent, when set, asks as that agent so Hub applies its gate; empty asks as the caller. ok is false when no hub is selected or nobody is signed in to it.
func (*Tap) HubRemove ¶ added in v0.23.0
func (t *Tap) HubRemove(_ context.Context, opts HubRemoveOptions) error
HubRemove deletes a hub connection (user config only) and prunes any namespace pin that routed to it.
func (*Tap) HubSetDefault ¶ added in v0.23.0
func (t *Tap) HubSetDefault(ctx context.Context, opts HubSetDefaultOptions) error
HubSetDefault sets hub. Unlike the hubs map, hub is allowed in project config, so the default write target is the project config, with --user to write the user config instead.
func (*Tap) IdentityKegCatalog ¶ added in v0.39.0
IdentityKegCatalog discovers the identity-authorized KEGs from every configured hub without applying flight authority. Each hub is queried at most once. Callers must explicitly project these rows through a selected flight or use them only for identity search.
func (*Tap) Index ¶
Index rebuilds all indices for a keg (nodes.tsv, tags, links, backlinks) from scratch.
func (*Tap) IndexCat ¶ added in v0.2.0
IndexCat returns the raw contents of a named dex index file. opts.Name may include or omit a leading "dex/" prefix; both are accepted.
func (*Tap) Integrate ¶ added in v0.19.0
func (t *Tap) Integrate(ctx context.Context, opts IntegrateOptions) (*IntegrateResult, error)
Integrate atomically refreshes the embedded marketplace for one host and installs the requested plugins the way that host expects. Dry-run returns the complete plan without side effects.
func (*Tap) InvitationAccept ¶ added in v0.44.0
func (t *Tap) InvitationAccept(ctx context.Context, opts InvitationOptions) (*HubInvitation, error)
InvitationAccept accepts one of the caller's invitations.
func (*Tap) InvitationDecline ¶ added in v0.44.0
func (t *Tap) InvitationDecline(ctx context.Context, opts InvitationOptions) (*HubInvitation, error)
InvitationDecline declines one of the caller's invitations.
func (*Tap) InvitationList ¶ added in v0.44.0
func (t *Tap) InvitationList(ctx context.Context, opts InvitationOptions) ([]HubInvitation, error)
InvitationList returns the caller's pending invitations on a hub.
func (*Tap) InvitationRevoke ¶ added in v0.44.0
func (t *Tap) InvitationRevoke(ctx context.Context, opts InvitationOptions) error
InvitationRevoke withdraws a pending invitation the caller sent or could send (a namespace owner, or a keg admin).
func (*Tap) KegDelete ¶ added in v0.41.0
KegDelete deletes all KEG data, including snapshots, through the Hub catalog.
func (*Tap) KegGrant ¶ added in v0.23.0
func (t *Tap) KegGrant(ctx context.Context, opts KegGrantOptions) (AccessChange, error)
KegGrant grants a user a role on a keg. An existing grantee's role changes now; anyone else is invited and gains access when they accept.
func (*Tap) KegRename ¶ added in v0.25.0
func (t *Tap) KegRename(ctx context.Context, opts KegRenameOptions) error
KegRename renames a hub-backed keg alias within its namespace.
func (*Tap) KegRevoke ¶ added in v0.23.0
func (t *Tap) KegRevoke(ctx context.Context, opts KegRevokeOptions) error
KegRevoke removes a user's grant on a keg.
func (*Tap) KegSettings ¶ added in v0.33.0
KegSettings displays the keg metadata (keg file contents).
func (*Tap) KegSettingsEdit ¶ added in v0.39.0
func (t *Tap) KegSettingsEdit(ctx context.Context, opts KegSettingsEditOptions) error
KegSettingsEdit opens the keg settings file in the default editor.
Replacing the settings document is keg administration, so it requires admin on the keg itself and not merely admin on the flight. Asking for editor identity access here previously let a flightless session — which has no flight authority to check — perform the write with editor access alone.
func (*Tap) KegSettingsHash ¶ added in v0.39.0
KegSettingsHash performs the read half of an explicit CLI read-before-write flow. Mutation methods never call it implicitly.
func (*Tap) KegVisibility ¶ added in v0.23.0
func (t *Tap) KegVisibility(ctx context.Context, opts KegVisibilityOptions) error
KegVisibility sets a keg's visibility to public or private.
func (*Tap) Launch ¶ added in v0.37.0
func (t *Tap) Launch(ctx context.Context, opts LaunchOptions) (*LaunchResult, error)
Launch resolves the model and starts the harness, wiring it to the runtime's streams so it runs interactively. With DryRun set it resolves and returns without executing.
Warnings are written to stderr here, before the harness takes the terminal. Reporting them from the returned result would be too late: Launch does not return until the agent session has ended, so the reader would learn what authority the session had only after it was over. Stderr also keeps them clear of a piped dry-run report.
func (*Tap) ListAgents ¶ added in v0.44.0
ListAgents returns agents from the hub, sorted by ref.
func (*Tap) ListFlights ¶ added in v0.23.0
ListFlights returns canonical refs discovered across configured hubs, or only opts.Hub when a filter is supplied.
func (*Tap) ListImages ¶ added in v0.2.0
ListImages returns the names of images for a node.
func (*Tap) ListIndexes ¶ added in v0.2.0
ListIndexes returns the names of available index files for a keg (e.g. "changes.md", "nodes.tsv").
func (*Tap) ListSchemas ¶ added in v0.25.0
func (*Tap) ListVideos ¶ added in v0.48.0
ListVideos returns the names of a node's videos.
func (*Tap) Lock ¶ added in v0.11.0
Lock acquires a cross-process lock on a node and returns the token.
func (*Tap) LockStatus ¶ added in v0.11.0
LockStatus returns the lock state for a node.
func (*Tap) Merge ¶ added in v0.46.0
func (t *Tap) Merge(ctx context.Context, opts MergeOptions) (keg.MergeNodesResult, error)
Merge folds a source node into a target: the target takes the merged body, links to the source follow it, and the source goes to the trash.
func (*Tap) NamespaceAddMember ¶ added in v0.23.0
func (t *Tap) NamespaceAddMember(ctx context.Context, opts NamespaceAddMemberOptions) (AccessChange, error)
NamespaceAddMember invites a member (user → role) to a namespace, or changes an existing member's role. A new member joins when they accept.
func (*Tap) NamespaceCreate ¶ added in v0.23.0
func (t *Tap) NamespaceCreate(ctx context.Context, opts NamespaceCreateOptions) (*NamespaceCreateResult, error)
NamespaceCreate returns the hub UI URL for creating an org namespace. It does not call the namespace creation API.
func (*Tap) NamespaceList ¶ added in v0.23.0
func (t *Tap) NamespaceList(ctx context.Context, opts NamespaceListOptions) (NamespaceListResult, error)
NamespaceList returns memberships on the selected Hub.
func (*Tap) NamespaceMembers ¶ added in v0.23.0
func (t *Tap) NamespaceMembers(ctx context.Context, opts NamespaceMembersOptions) ([]HubMember, error)
NamespaceMembers returns the member roster of a namespace.
func (*Tap) NamespaceRemoveMember ¶ added in v0.23.0
func (t *Tap) NamespaceRemoveMember(ctx context.Context, opts NamespaceRemoveMemberOptions) error
NamespaceRemoveMember removes a member from a namespace.
func (*Tap) NamespaceSetRole ¶ added in v0.23.0
func (t *Tap) NamespaceSetRole(ctx context.Context, opts NamespaceSetRoleOptions) error
NamespaceSetRole changes an existing member's role.
func (*Tap) NodeHash ¶ added in v0.39.0
NodeHash performs the read half of an explicit CLI read-before-write flow. Mutation methods never call it implicitly.
func (*Tap) NodeHistory ¶ added in v0.4.0
func (*Tap) NodeRestore ¶ added in v0.4.0
func (t *Tap) NodeRestore(ctx context.Context, opts NodeRestoreOptions) error
func (*Tap) NodeSnapshot ¶ added in v0.4.0
func (*Tap) NodeSnapshotBatch ¶ added in v0.38.0
func (*Tap) NodeSnapshotView ¶ added in v0.23.0
func (*Tap) Orient ¶ added in v0.19.0
Orient returns one deterministic KEG system payload. It is best-effort: flight and hub-listing failures do not suppress the core orientation document.
func (*Tap) OrientationKegsForFlight ¶ added in v0.39.0
func (t *Tap) OrientationKegsForFlight(ctx context.Context, flight *Flight) ([]OrientationKeg, []string, error)
OrientationKegsForFlight returns the effective KEG authority projection without rendering a payload. Providers use it to compute the revision first and then render exactly once.
func (*Tap) ReadAttachment ¶ added in v0.43.0
func (t *Tap) ReadAttachment(ctx context.Context, opts ReadAttachmentOptions) ([]byte, string, error)
ReadAttachment retrieves the original bytes of a kind-qualified node attachment together with the MIME type its content identifies as.
func (*Tap) ReadImage ¶ added in v0.24.0
ReadImage retrieves a node image and validates that the stored bytes are still one of Tapper's supported image formats.
func (*Tap) ReadSchema ¶ added in v0.25.0
func (*Tap) ReadVideo ¶ added in v0.48.0
ReadVideo returns a node video's bytes and the MIME type its container identifies as.
func (*Tap) Relay ¶ added in v0.44.0
func (t *Tap) Relay(ctx context.Context, opts RelayOptions) error
Relay connects this machine's configured providers and MCP servers to Hub and serves inference and tool calls until ctx ends or Hub rejects the relay permanently.
func (*Tap) Replace ¶ added in v0.46.0
func (t *Tap) Replace(ctx context.Context, opts ReplaceOptions) (keg.ReplaceTextResult, error)
Replace finds and replaces text across a keg. A dry run only reads, so it needs a viewer; a real one needs an editor.
func (*Tap) ResolveLaunch ¶ added in v0.37.0
func (t *Tap) ResolveLaunch(opts LaunchOptions) (*LaunchResult, error)
ResolveLaunch resolves options into a complete invocation without running it. Launch is this plus execution, so a dry run and a real run cannot drift.
func (*Tap) ResolveLaunchContext ¶ added in v0.44.0
func (t *Tap) ResolveLaunchContext(ctx context.Context, opts LaunchOptions) (*LaunchResult, error)
ResolveLaunchContext is ResolveLaunch with a context for the one network call it makes: listing the Hub catalog.
func (*Tap) ResolveNodeRef ¶ added in v0.23.0
func (t *Tap) ResolveNodeRef(ctx context.Context, ref *keg.NodeRef, rc RefContext) (keg.Keg, keg.NodeId, error)
ResolveNodeRef resolves a parsed node reference into the keg that holds it and the numeric node id within that keg:
- RefLocal: the current keg, with the bare node id.
- RefAlias: the alias is resolved against the current keg's aliases first (so authored links travel with the keg), then the Tapper configuration.
- RefQualified: a (hub, namespace, keg) reference whose hub is implied from the current keg's hub.
func (*Tap) SchemaHash ¶ added in v0.39.0
SchemaHash performs the read half of an explicit CLI read-before-write flow. Mutation methods never call it implicitly.
func (*Tap) Search ¶ added in v0.46.0
func (t *Tap) Search(ctx context.Context, opts SearchOptions) (*tapapi.SearchResponse, error)
Search ranks nodes by relevance to opts.Query. The Hub scores, pages, and authorizes; the client only chooses the KEG scope.
func (*Tap) SelectedHubIdentity ¶ added in v0.41.0
SelectedHubIdentity probes only the selected Hub using its live credentials.
func (*Tap) SetBootstrapFlight ¶ added in v0.30.0
SetBootstrapFlight validates ref, canonicalizes it, and persists it as the user-level flight baseline. Project config, TAP_FLIGHT, and an explicit --flight flag remain higher-precedence overrides. A blank ref is a no-op.
func (*Tap) SetKeg ¶ added in v0.41.0
SetKeg sets the user config's keg to ref and persists it. It is the post-login step of `tap bootstrap`: once the user picks a keg (from the hub's list or by typing one), plain `tap` commands resolve it without per-invocation flags. It writes the FALLBACK slot (the global-user convention) rather than keg, so a project's keg or a kegMap path rule still overrides it. ref is a keg reference — a bare name, @namespace/name, keg:..., or a path — stored verbatim and resolved later by ResolveRef. A blank ref is a no-op.
func (*Tap) TrashList ¶ added in v0.46.0
func (t *Tap) TrashList(ctx context.Context, opts KegTargetOptions) ([]keg.TrashEntry, error)
TrashList returns the keg's removed nodes, newest first.
func (*Tap) TrashRestore ¶ added in v0.46.0
func (t *Tap) TrashRestore(ctx context.Context, opts TrashRestoreOptions) error
TrashRestore puts trashed nodes back at their ids, all or nothing.
func (*Tap) Unlock ¶ added in v0.11.0
func (t *Tap) Unlock(ctx context.Context, opts UnlockOptions) error
Unlock releases a cross-process lock on a node.
func (*Tap) UpdateFlight ¶ added in v0.23.0
func (*Tap) UploadFile ¶ added in v0.2.0
UploadFile reads a local file and stores it as a node file attachment. Returns the stored filename.
func (*Tap) UploadImage ¶ added in v0.2.0
UploadImage reads a local file and stores it as a node image. Returns the stored filename.
func (*Tap) UploadVideo ¶ added in v0.48.0
UploadVideo stores a video on a node and returns its stored name. Bytes that are not a supported video container (MP4, WebM, Ogg) are refused.
func (*Tap) Use ¶ added in v0.23.0
func (t *Tap) Use(ctx context.Context, opts UseOptions) error
Use records the project's keg + flight, or the user-wide user KEG, in the appropriate config file. It mirrors the resolution convention: project and user both write keg in their own scope, with flight project-scoped.
func (*Tap) UseStatus ¶ added in v0.23.0
UseStatus returns a YAML summary of the resolved KEG, Hub, and flight defaults and the source that set each, for `tap use` with no args.
func (*Tap) Validate ¶ added in v0.25.0
func (t *Tap) Validate(ctx context.Context, opts ValidateOptions) ([]keg.SchemaValidationResult, error)
func (*Tap) WatchNode ¶ added in v0.23.0
WatchNode subscribes to live change events for a single node. The watch is scoped to ctx: events are delivered on the returned channel until ctx is cancelled, at which point the channel is closed.
func (*Tap) WebURL ¶ added in v0.46.0
WebURL returns the Hub web page for a KEG, note, flight, or namespace. It builds the link from configuration alone where it can: only a keg-local ~alias reads the current KEG's settings. The page shapes are the Hub's browser routes (see "Hub Web Links" in docs/architecture/configuration-resolution.md):
/@ns namespace /@ns/keg KEG /@ns/keg/42 note /@ns/+slug flight
type TapOptions ¶
type TapOptions struct {
Root string
ConfigPath string
Runtime *toolkit.Runtime
// Version is the running binary's version, as pkg/cli.Version reports
// it. pkg/tapper cannot import pkg/cli, so the CLI passes it down the
// same way it hands the MCP server its version. Empty means an
// unreleased build.
Version string
}
type ToolCategory ¶ added in v0.46.0
type ToolCategory string
ToolCategory sorts every agent tool by the job it does in the KEG system, so an agent can tell everyday memory work from browsing the public directory and from administering the memory system itself. Each tool's description opens with its category label, orientation prints the intent of each category, and the Hub's tool groups use the same split.
const ( // ToolCategorySession tools report who the session is and what it may do. ToolCategorySession ToolCategory = "Session" // ToolCategoryMemory tools read and write notes in the covered KEGs. ToolCategoryMemory ToolCategory = "Memory" // ToolCategoryExplore tools search the hub's public directory. ToolCategoryExplore ToolCategory = "Explore" // ToolCategoryManage tools change the structure of the memory system. ToolCategoryManage ToolCategory = "Manage" )
func ToolCategoryOf ¶ added in v0.46.0
func ToolCategoryOf(tool string) (ToolCategory, bool)
ToolCategoryOf returns the category of an agent tool.
type ToolCategoryInfo ¶ added in v0.46.0
type ToolCategoryInfo struct {
Category ToolCategory
Intent string
}
ToolCategoryInfo is one category and the one-line intent an agent reads.
type TrashRestoreOptions ¶ added in v0.46.0
type TrashRestoreOptions struct {
KegTargetOptions
NodeIDs []string
}
type UnlockOptions ¶ added in v0.11.0
type UnlockOptions struct {
NodeID string
Token string
KegTargetOptions
}
UnlockOptions configures behavior for Tap.Unlock.
type UpdateFlightOptions ¶ added in v0.23.0
type UpdateFlightOptions struct {
Ref string
Title *string
Description *string `json:"description,omitempty" jsonschema:"short description, separate from instructions"`
Visibility *string
Instructions *string
Cover *[]FlightCover
Subflights *[]string
ManageKegs *bool
ManageFlights *bool
ExpectedHash string
}
UpdateFlightOptions is a partial update: nil fields keep the flight's current value. The merge against the existing flight happens inside Tap.UpdateFlight against the same resolved ref the PUT targets, so a slug that exists in several places cannot read one flight and overwrite another.
type UploadFileOptions ¶ added in v0.2.0
type UploadFileOptions struct {
KegTargetOptions
NodeID string
FilePath string
Data []byte
Name string
}
UploadFileOptions configures behavior for Tap.UploadFile.
type UploadImageOptions ¶ added in v0.2.0
type UploadImageOptions struct {
KegTargetOptions
NodeID string
FilePath string
Data []byte
Name string
}
UploadImageOptions configures behavior for Tap.UploadImage.
type UploadVideoOptions ¶ added in v0.48.0
type UploadVideoOptions struct {
KegTargetOptions
NodeID string
FilePath string
Data []byte
Name string
}
UploadVideoOptions configures behavior for Tap.UploadVideo. Data, when set, is uploaded in place of the file at FilePath.
type UseOptions ¶ added in v0.23.0
type UseOptions struct {
// Keg is the keg reference to record (a bare name or @namespace/keg). Empty
// leaves the keg slot untouched (unless Clear is set).
Keg string
// Flight is a flight reference to record for the project (@namespace/+slug,
// +slug, or a bare slug). Empty leaves the flight untouched.
Flight string
// User writes the user config's keg instead of the project config's
// keg.
User bool
// ConfigPath, when set, writes that explicit config file instead of the
// user/project file. The slot still follows User.
ConfigPath string
// Clear unsets the slot(s) for the chosen scope (keg + flight for the
// project scope; keg for the user scope).
Clear bool
}
UseOptions configures Tap.Use, the `tap use` setter that records which keg (and flight) a project resolves, or a user-wide user KEG.
Scope picks the keg slot: the default (project) scope writes keg; the user scope (User=true) writes keg. Flight is project-scoped only.
type ValidateOptions ¶ added in v0.25.0
type ValidateOptions struct {
KegTargetOptions
NodeIDs []string
}
type WatchNodeOptions ¶ added in v0.23.0
type WatchNodeOptions struct {
NodeID string
KegTargetOptions
}
type WebURL ¶ added in v0.46.0
type WebURL struct {
// URL is the absolute browser link.
URL string `json:"url"`
// Kind is namespace, keg, node, or flight.
Kind string `json:"kind"`
// Ref is the canonical reference the page shows: @ns, keg:@ns/keg,
// keg:@ns/keg/42, or @ns/+slug.
Ref string `json:"ref"`
}
WebURL is the Hub web page for a reference.
type WebURLOptions ¶ added in v0.46.0
type WebURLOptions struct {
KegTargetOptions
// Ref names the page: empty for the current KEG, a node id, a keg or node
// reference, a flight, a lone @namespace, or a Hub page URL.
Ref string
}
WebURLOptions configures Tap.WebURL.
type WhoAmI ¶ added in v0.23.0
type WhoAmI struct {
UserID int64 `json:"user_id"`
Username string `json:"username"`
DisplayName string `json:"display_name"`
Email string `json:"email"`
CreatedAt time.Time `json:"created_at"`
DefaultNamespace string `json:"default_namespace"`
Namespaces []string `json:"namespaces,omitempty"`
PersonalNamespace *string `json:"personal_namespace,omitempty"`
}
WhoAmI is the authenticated user the hub reports for a token. It mirrors the hub's GET /api/v1/whoami JSON body (handler.WhoamiResponse) — keep the two structs in sync. DisplayName is the human name and is empty when the hub omits it (older hub, or no display name set), in which case callers fall back to the username alone.
DefaultNamespace is the user's home namespace as the hub sees it (its name equals the username by construction). `tap bootstrap` adopts it as the fallback namespace so the hub, not the client, decides which namespace a fresh login lands in. Namespaces lists every namespace the user belongs to (personal + orgs) and is empty when the hub omits it (older hub).
PersonalNamespace is the namespace of kind user the hub found the account owning, read from its database rather than assumed from the username. Nil when the hub omits it (older hub) or could not tell; "" when it has none.
func ValidateToken ¶ added in v0.23.0
ValidateToken calls GET {hubURL}/api/v1/whoami with the bearer token and returns the resolved user. A 401 is reported as a rejected token; 403 preserves permission denial. Other non-200 responses surface the Hub status. The default HTTP client is used; callers that need to inject one for tests can hit an httptest.Server, whose URL works with http.DefaultClient.
Source Files
¶
- alias.go
- api_discovery_cache.go
- auth_device_flow.go
- auth_flow.go
- auth_refresh.go
- auth_resolver.go
- auth_store.go
- auth_store_lock.go
- auth_store_lock_unix.go
- auth_whoami.go
- config.go
- config_document.go
- config_env.go
- config_selection.go
- config_service.go
- config_validate.go
- constants.go
- editor_live.go
- flight.go
- hub_agents.go
- hub_context.go
- hub_flights.go
- hub_grants.go
- hub_invitations.go
- hub_kegs.go
- hub_namespaces.go
- integrate_host.go
- integrate_host_marketplace.go
- integrate_host_opencode.go
- invocation_telemetry.go
- keg_backend.go
- keg_service.go
- launch_forwarder.go
- node_exists.go
- node_ref_resolve.go
- operations.go
- path_service.go
- relationship_observer.go
- runner.go
- runner_mcp.go
- tap.go
- tap_agent.go
- tap_archive.go
- tap_auth.go
- tap_batch.go
- tap_bootstrap.go
- tap_cat.go
- tap_config.go
- tap_create.go
- tap_doctor.go
- tap_edit.go
- tap_explore.go
- tap_files.go
- tap_flight.go
- tap_flight_edit.go
- tap_hub.go
- tap_index.go
- tap_info.go
- tap_init.go
- tap_integrate.go
- tap_invitation.go
- tap_keg.go
- tap_launch.go
- tap_list.go
- tap_list_format.go
- tap_lock.go
- tap_move.go
- tap_namespace.go
- tap_orient.go
- tap_relay.go
- tap_remove.go
- tap_replace.go
- tap_schema.go
- tap_search.go
- tap_snapshots.go
- tap_stats.go
- tap_trash.go
- tap_url.go
- tap_use.go
- tap_videos.go
- tap_watch.go
- tool_categories.go