Help us shape the future of Go! Take the 2026 Go Developer Survey

sessbind

package
v0.4.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const SubagentModelWildcardKey agentkit.AgentID = "sub:*"

SubagentModelWildcardKey is the global models key that applies to every in-process subagent without a more specific entry. Written by `/submodel * <model>`; it never affects the main agent.

Variables

This section is empty.

Functions

func AgentBind

AgentBind returns the per-session agent override, or "" when unset.

func ChannelAgentBind added in v0.4.18

func ChannelAgentBind(ctx context.Context, ws workspace.Service) (agentkit.AgentID, error)

ChannelAgentBind returns the current channel's default agent id, or "" when unset.

func GlobalAgentBind

func GlobalAgentBind(ctx context.Context, ws workspace.Service) (agentkit.AgentID, error)

GlobalAgentBind returns the workspace-wide default agent id, or "" when unset.

func GlobalModelBind

func GlobalModelBind(ctx context.Context, ws workspace.Service, agentID agentkit.AgentID) (string, error)

GlobalModelBind returns the global default model for agentID, or "" when unset.

func GlobalModelBinds added in v0.3.59

func GlobalModelBinds(ctx context.Context, ws workspace.Service) (map[string]string, error)

GlobalModelBinds returns every entry in global:runtime.json models, or nil when unset. Commands use it to list configured overrides.

func ModelBind

func ModelBind(ctx context.Context, store agentkit.SessionStore, id agentkit.SessionID) (string, error)

ModelBind returns the per-session model override, or "" when unset.

func ResolveAgentID

func ResolveAgentID(
	ctx context.Context,
	store agentkit.SessionStore,
	ws workspace.Service,
	sessionID agentkit.SessionID,
	eventAgent agentkit.AgentID,
) (effective, sessionBind, channelBind, globalBind agentkit.AgentID, err error)

ResolveAgentID applies session bind, channel bind, global default, then explicit event agent id. The bind results are the stored values at each layer, including layers that lost to a higher priority.

func ResolveEffectiveModel

func ResolveEffectiveModel(
	ctx context.Context,
	store agentkit.SessionStore,
	ws workspace.Service,
	sessionID agentkit.SessionID,
	agentID agentkit.AgentID,
	defaultModel string,
) (effective, sessionOverride, globalOverride string, err error)

ResolveEffectiveModel applies session override, then global (per agent), then defaultModel.

func ResolveSubagentModel added in v0.3.59

func ResolveSubagentModel(
	ctx context.Context,
	ws workspace.Service,
	parentAgentID agentkit.AgentID,
	childAgentID agentkit.AgentID,
	defModel string,
) string

ResolveSubagentModel resolves the model for an in-process subagent step.

Priority (definition author > explicit subagent config > general default > fallback):

  1. defModel — agents/<name>.md `model:` is a capability contract authored together with the prompt and modalities; runtime overrides never win.
  2. global models[<childAgentID>] — the explicit per-subagent config written by `/submodel <name> <model>`.
  3. global models[SubagentModelWildcardKey] — the all-subagents policy written by `/submodel * <model>`; main agent is unaffected.
  4. global models[<parentAgentID>] — the parent agent's `/model -g` choice, the general default specific keys refine.

defModel is also the final fallback when nothing else is set. Neither the child session's bind nor the parent conversation's session bind participate: per-delegation ids have no /model entry point, and the user's in-conversation /model targets the main agent only — subagent models are explicit config, not implicit inheritance.

func RuntimeStore

RuntimeStore returns the session runtime overlay capability when present.

func SetChannelAgentBind added in v0.4.18

func SetChannelAgentBind(ctx context.Context, ws workspace.Service, agent agentkit.AgentID) error

SetChannelAgentBind sets or clears the current channel's default agent id.

func SetGlobalAgentBind

func SetGlobalAgentBind(ctx context.Context, ws workspace.Service, agent agentkit.AgentID) error

SetGlobalAgentBind sets or clears the workspace-wide default agent id.

func SetGlobalModelBind

func SetGlobalModelBind(ctx context.Context, ws workspace.Service, agentID agentkit.AgentID, model string) error

SetGlobalModelBind sets or clears the global default model for agentID.

func SetSessionAgentBind

func SetSessionAgentBind(ctx context.Context, store agentkit.SessionStore, id agentkit.SessionID, agent agentkit.AgentID) error

SetSessionAgentBind sets or clears the per-session agent override.

func SetSessionModelBind

func SetSessionModelBind(ctx context.Context, store agentkit.SessionStore, id agentkit.SessionID, model string) error

SetSessionModelBind sets or clears the per-session model override.

Types

type ChannelRuntimeData added in v0.4.18

type ChannelRuntimeData struct {
	AgentID agentkit.AgentID `json:"agentId,omitempty"`
}

ChannelRuntimeData holds channel-scoped dynamic overrides.

type GlobalRuntimeData

type GlobalRuntimeData struct {
	AgentID agentkit.AgentID  `json:"agentId,omitempty"`
	Models  map[string]string `json:"models,omitempty"`
}

GlobalRuntimeData holds workspace-wide dynamic overrides.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL