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

Method AttachTaskSession

internal/daemon/task_runtime.go:252–286  ·  view source on GitHub ↗
(
	ctx context.Context,
	_ string,
	sessionID string,
)

Source from the content-addressed store, hash-verified

250}
251
252func (b *taskSessionBridge) AttachTaskSession(
253 ctx context.Context,
254 _ string,
255 sessionID string,
256) (*taskpkg.SessionRef, error) {
257 if ctx == nil {
258 return nil, errors.New("daemon: attach task session context is required")
259 }
260
261 info, err := b.sessions.Status(ctx, strings.TrimSpace(sessionID))
262 if err != nil {
263 return nil, err
264 }
265 if info == nil {
266 return nil, fmt.Errorf(
267 "%w: session %q is unavailable",
268 taskpkg.ErrSessionAttachNotAllowed,
269 strings.TrimSpace(sessionID),
270 )
271 }
272 if !isTaskSessionStateLive(info.State) {
273 return nil, fmt.Errorf(
274 "%w: session %q is %q",
275 taskpkg.ErrSessionAttachNotAllowed,
276 strings.TrimSpace(sessionID),
277 info.State,
278 )
279 }
280
281 return &taskpkg.SessionRef{
282 SessionID: strings.TrimSpace(info.ID),
283 WorkspaceID: strings.TrimSpace(info.WorkspaceID),
284 StartedAt: info.CreatedAt,
285 }, nil
286}
287
288func (b *taskSessionBridge) RequestTaskStop(ctx context.Context, sessionID string, reason taskpkg.StopReason) error {
289 if ctx == nil {

Callers

nothing calls this directly

Calls 2

isTaskSessionStateLiveFunction · 0.85
StatusMethod · 0.65

Tested by

no test coverage detected