Documentation
¶
Overview ¶
Package workspace defines workspace roots, kinds, and storage abstractions.
It provides root/runtime/state path resolution and common interfaces used by loaders, repositories, and runtime composition.
Index ¶
- Constants
- func AllKinds() []string
- func EnsureDefault(fs afs.Service)
- func EnsureDefaultAt(ctx context.Context, fs afs.Service, root string)
- func IsEmptyWorkspace(fs afs.Service) (bool, error)
- func IsEmptyWorkspaceAt(ctx context.Context, fs afs.Service, root string) (bool, error)
- func Path(kind string) string
- func ResolvePathTemplate(value string) string
- func Root() string
- func RuntimeRoot() string
- func SeedFromFS(ctx context.Context, afsSvc afs.Service, root string, srcFS iofs.FS, ...) error
- func SetBootstrapHook(hook BootstrapHook)
- func SetRoot(path string)
- func SetRuntimeRoot(path string)
- func SetStateRoot(path string)
- func StateRoot() string
- type BootstrapHook
- type BootstrapStore
- type Entry
- type KnowledgeStore
- type StateStore
- type Store
Constants ¶
const ( KindAgent = "agents" KindModel = "models" KindEmbedder = "embedders" KindMCP = "mcp" KindWorkflow = "workflows" KindTool = "tools" KindToolBundle = "tools/bundles" KindToolHints = "tools/hints" KindOAuth = "oauth" KindFeeds = "feeds" KindA2A = "a2a" )
Predefined kinds. Callers may still supply arbitrary sub-folder names when they need custom separation.
Variables ¶
This section is empty.
Functions ¶
func EnsureDefault ¶
EnsureDefault bootstraps minimal workspace defaults.
func EnsureDefaultAt ¶
EnsureDefaultAt ensures workspace root exists with a baseline config file. It intentionally does not seed agent/model catalogs yet.
func IsEmptyWorkspace ¶
IsEmptyWorkspace reports whether the active workspace contains no meaningful files. It ignores placeholder .keep files and empty directories.
func IsEmptyWorkspaceAt ¶
IsEmptyWorkspaceAt reports whether the supplied workspace root contains no meaningful files. It ignores placeholder .keep files and empty directories.
func ResolvePathTemplate ¶
ResolvePathTemplate expands supported macros in a path template. Supported macros: ${workspaceRoot}, ${runtimeRoot}.
func Root ¶
func Root() string
Root returns the absolute path to the Agently workspace directory. The lookup order is:
- Explicit path set via SetRoot (e.g. CLI --workspace flag)
- $AGENTLY_WORKSPACE environment variable, if set and non-empty
- ./.agently under the current working directory
The result is cached for the lifetime of the process.
func RuntimeRoot ¶
func RuntimeRoot() string
RuntimeRoot returns the runtime root path. It defaults to the workspace root unless overridden via AGENTLY_RUNTIME_ROOT or SetRuntimeRoot.
func SeedFromFS ¶
func SeedFromFS(ctx context.Context, afsSvc afs.Service, root string, srcFS iofs.FS, prefix string) error
SeedFromFS copies files from srcFS/prefix into workspace root when the target file does not already exist. Existing files are never overwritten.
func SetBootstrapHook ¶
func SetBootstrapHook(hook BootstrapHook)
SetBootstrapHook sets a process-wide workspace bootstrap hook. When set, default bootstrapping is skipped and the hook is responsible for creating any required workspace files/directories.
func SetRoot ¶
func SetRoot(path string)
SetRoot overrides the workspace root for this process. Call this before any other workspace function (e.g. from CLI --workspace flag parsing). When set it takes precedence over $AGENTLY_WORKSPACE.
func SetRuntimeRoot ¶
func SetRuntimeRoot(path string)
SetRuntimeRoot overrides the runtime root path for this process.
func SetStateRoot ¶
func SetStateRoot(path string)
SetStateRoot overrides the state root path for this process.
Types ¶
type BootstrapHook ¶
type BootstrapHook func(store *BootstrapStore) error
BootstrapHook customizes workspace bootstrap behavior. It receives a store helper bound to the resolved workspace root.
type BootstrapStore ¶
type BootstrapStore struct {
// contains filtered or unexported fields
}
BootstrapStore provides hook helpers expected by bootstrap callers. It intentionally exposes only operations needed during bootstrap.
func (*BootstrapStore) Root ¶
func (s *BootstrapStore) Root() string
Root returns the workspace root path used by this bootstrap store.
func (*BootstrapStore) SeedFromFS ¶
SeedFromFS copies files from srcFS/prefix into workspace root when missing.
type KnowledgeStore ¶
type KnowledgeStore interface {
// IndexBasePath returns the base path/URI for a user's embedding index.
IndexBasePath(ctx context.Context, user string) (string, error)
// SnapshotBasePath returns the base path/URI for MCP snapshot caches.
SnapshotBasePath(ctx context.Context) (string, error)
// DBPath returns the application database path.
DBPath(ctx context.Context) (string, error)
}
KnowledgeStore abstracts paths/URIs for embedding indexes, vector storage, and snapshot caches. FS implementations return local paths; a DB implementation could return dsn:// URIs.
type StateStore ¶
type StateStore interface {
// StatePath returns the resolved state directory for a scope
// (e.g. "mcp/<server>/<user>").
StatePath(ctx context.Context, scope string) (string, error)
// StateRoot returns the root state directory.
StateRoot(ctx context.Context) (string, error)
}
StateStore abstracts per-machine state (auth tokens, cookies, etc.). State is always local and is not shared across machines.
type Store ¶
type Store interface {
// Root returns a canonical workspace identifier (FS path, DB URI, etc.).
Root() string
// List returns the names of all resources of the given kind.
List(ctx context.Context, kind string) ([]string, error)
// Load returns the raw bytes for a single resource.
Load(ctx context.Context, kind, name string) ([]byte, error)
// Save creates or overwrites a resource.
Save(ctx context.Context, kind, name string, data []byte) error
// Delete removes a resource. It is not an error if the resource does not exist.
Delete(ctx context.Context, kind, name string) error
// Exists reports whether a resource exists.
Exists(ctx context.Context, kind, name string) (bool, error)
// Entries returns metadata-enriched listings (for polling watchers).
Entries(ctx context.Context, kind string) ([]Entry, error)
}
Store is the workspace resource persistence abstraction. Implementations may store data on the local filesystem, in a database, or any other backend. Callers handle marshal/unmarshal — the Store works with raw []byte payloads.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package hotswap provides workspace change detection and live reload hooks.
|
Package hotswap provides workspace change detection and live reload hooks. |
|
Package loader contains workspace resource loading subpackages.
|
Package loader contains workspace resource loading subpackages. |
|
embedder
Package embedder loads embedder provider configurations from workspace resources.
|
Package embedder loads embedder provider configurations from workspace resources. |
|
fs
Package fs provides generic filesystem-backed decoding/loading helpers.
|
Package fs provides generic filesystem-backed decoding/loading helpers. |
|
model
Package model loads model provider configurations from workspace resources.
|
Package model loads model provider configurations from workspace resources. |
|
Package overlay provides in-memory overlay loading on top of workspace files.
|
Package overlay provides in-memory overlay loading on top of workspace files. |
|
Package repository contains typed workspace persistence adapters.
|
Package repository contains typed workspace persistence adapters. |
|
base
Package base provides common repository helpers over workspace stores.
|
Package base provides common repository helpers over workspace stores. |
|
embedder
Package embedder provides workspace repository access for embedder configs.
|
Package embedder provides workspace repository access for embedder configs. |
|
mcp
Package mcp provides workspace repository access for MCP client definitions.
|
Package mcp provides workspace repository access for MCP client definitions. |
|
model
Package model provides workspace repository access for model configs.
|
Package model provides workspace repository access for model configs. |
|
toolbundle
Package toolbundle provides workspace repository access for tool bundle specs.
|
Package toolbundle provides workspace repository access for tool bundle specs. |
|
toolplaybook
Package toolplaybook provides workspace repository access for tool hints/playbooks.
|
Package toolplaybook provides workspace repository access for tool hints/playbooks. |
|
Package service contains workspace-facing service adapters.
|
Package service contains workspace-facing service adapters. |
|
meta
Package meta provides workspace metadata discovery for loaders and handlers.
|
Package meta provides workspace metadata discovery for loaders and handlers. |
|
meta/yml
Package yml provides YAML node helpers used by workspace metadata services.
|
Package yml provides YAML node helpers used by workspace metadata services. |
|
Package store contains workspace storage backend implementations.
|
Package store contains workspace storage backend implementations. |
|
fs
Package fs provides filesystem-backed workspace stores.
|
Package fs provides filesystem-backed workspace stores. |
|
Package transfer provides import/export helpers for workspace resources.
|
Package transfer provides import/export helpers for workspace resources. |