MCPcopy Create free account
hub / github.com/compozy/agh / requireHostAPISessionWorkspace

Method requireHostAPISessionWorkspace

internal/extension/host_api.go:2101–2132  ·  view source on GitHub ↗
(
	ctx context.Context,
	workspaceRef string,
	sessionID string,
)

Source from the content-addressed store, hash-verified

2099}
2100
2101func (h *HostAPIHandler) requireHostAPISessionWorkspace(
2102 ctx context.Context,
2103 workspaceRef string,
2104 sessionID string,
2105) (*session.Info, error) {
2106 if h.sessions == nil {
2107 return nil, errors.New("extension: session manager is not configured")
2108 }
2109 id := strings.TrimSpace(sessionID)
2110 if id == "" {
2111 return nil, invalidParamsRPCError(errors.New("session_id is required"))
2112 }
2113 workspaceID, err := h.resolveRequiredWorkspaceID(ctx, workspaceRef)
2114 if err != nil {
2115 return nil, err
2116 }
2117 info, err := h.sessions.Status(ctx, id)
2118 if err != nil {
2119 if errors.Is(err, session.ErrSessionNotFound) {
2120 return nil, notFoundRPCError("session", id, err)
2121 }
2122 return nil, err
2123 }
2124 if info == nil || strings.TrimSpace(info.WorkspaceID) != workspaceID {
2125 return nil, notFoundRPCError(
2126 "session",
2127 id,
2128 fmt.Errorf("%w: session=%q workspace_id=%q", session.ErrSessionNotFound, id, workspaceID),
2129 )
2130 }
2131 return info, nil
2132}
2133
2134func (h *HostAPIHandler) automationManager() (HostAPIAutomationManager, error) {
2135 if h == nil {

Callers 10

handleSessionsPromptMethod · 0.95
handleSessionsStopMethod · 0.95
handleSessionsStatusMethod · 0.95
handleSessionsEventsMethod · 0.95
handleSandboxInfoMethod · 0.95
handleSandboxExecMethod · 0.95

Calls 5

invalidParamsRPCErrorFunction · 0.85
notFoundRPCErrorFunction · 0.85
StatusMethod · 0.65
IsMethod · 0.45

Tested by

no test coverage detected