Files
klinsmayaandClaude Fable 5.1 8e04e8ba25 feat(server): open-connector connection service and task token lifecycle
Add the open-connector business integration: user-owned OAuth and
API-key connections mirrored in user_connector_connection, a DB-backed
OAuth state table so callbacks survive restarts and replicas, and a
per-task runtime token minted at enqueue with allowedConnections pinned
to the agent owner's connections in the agent's service allowlist. The
token id is stored in agent_task_queue.runtime_connector_handles and
released when the task reaches a terminal state; a reaper entry point
releases stale handles and expired OAuth states.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XqqpKySn2iWtXriK3Gsgak
2026-10-20 17:32:05 +00:00

26 lines
1.1 KiB
Go

package runtimeapps
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
db "github.com/multica-ai/multica/server/pkg/db/generated"
)
// ConnectorProvider is one external app-connection backend (Composio,
// open-connector). TaskService asks every registered provider for a per-task
// MCP overlay at enqueue time and merges the results.
type ConnectorProvider interface {
// Name identifies the provider ("composio" | "open-connector").
Name() string
// BuildTaskOverlay returns the overlay for one task. A zero result means
// "no overlay for this run". Errors are best-effort: callers log and skip.
BuildTaskOverlay(ctx context.Context, taskID, originatorUserID pgtype.UUID, agent db.Agent) (MCPOverlayResult, error)
// ReleaseTaskResources frees anything BuildTaskOverlay provisioned for the
// task, identified by the MCPOverlayResult.ResourceHandle it returned. The
// task ID is not known when the overlay is built, so the handle is the
// only key. Must be idempotent.
ReleaseTaskResources(ctx context.Context, taskID pgtype.UUID, handle string) error
}