Documentation
¶
Overview ¶
Package sessionworkspace stores a per-session "workspace": a set of ephemeral connector instances cloned from a base module (httprest, custom API defs, …). It backs the wick_session_workspace MCP tool and the session Config tab.
A session instance is a throwaway clone: it has its own id, a base module key, a label, and a config map — exactly the configurable fields of the base module, filled in for this session only. It shows up in wick_list / wick_get / wick_execute only when the caller passes the owning session_id, behaving like a brand-new connector that lives and dies with the session dir.
Secret config values are stored as wick_cenc_ MASTER tokens (system decryptable only) — callers encrypt BEFORE Set/Add; this package never sees or persists plaintext secrets. The whole file dies with the session, which is the intended instance lifetime.
Index ¶
- Constants
- func IsInstanceID(id string) bool
- func NewInstanceID() string
- func Remove(layout agentconfig.Layout, sessionID, instanceID string) (bool, error)
- func SetConfig(layout agentconfig.Layout, sessionID, instanceID string, ...) error
- func SetLabel(layout agentconfig.Layout, sessionID, instanceID, label string) error
- type Instance
- type Workspace
Constants ¶
const IDPrefix = "sw_"
IDPrefix marks a connector id as a session-workspace instance, so MCP handlers can route it to the workspace resolver instead of the DB.
Variables ¶
This section is empty.
Functions ¶
func IsInstanceID ¶
IsInstanceID reports whether an id refers to a session-workspace instance (vs a real DB connector row).
func Remove ¶
func Remove(layout agentconfig.Layout, sessionID, instanceID string) (bool, error)
Remove deletes an instance. ok=false when it wasn't there.
Types ¶
type Instance ¶
type Instance struct {
ID string `json:"id"` // "sw_<uuid>"
BaseKey string `json:"base_key"` // module key it clones (e.g. "httprest")
Label string `json:"label"`
// Config holds the instance's config field values. Secret fields are
// wick_cenc_ master tokens; non-secret fields are plaintext.
Config map[string]string `json:"config"`
// CreatedBy is "ai" (added via the MCP tool) or "user" (added in the
// Config tab) — drives the "agent added this, please fill it" notice.
CreatedBy string `json:"created_by,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
}
Instance is one ephemeral connector clone scoped to a session.
func Add ¶
Add appends a new instance and persists it. The id is minted here if empty. Returns the stored instance (with its final id).