Skip to content

Stream Session Adapter Utilities

Shared infrastructure for stream-based AI adapter implementations. Provides pure utility functions and types extracted from stream-driven adapters (Anthropic SDK, OpenAI) to eliminate duplication across connector implementations.

Within the framework source workspace, adapter packages import this private workspace package as @makaio/ai-adapters-stream-session. In the assembled framework distribution, public imports should use @makaio/framework/adapters/stream-session.

Stream-based connectors share patterns for session management, connector lifecycle, tool handling, and agent structure. This package extracts those cross-cutting concerns into one place with no adapter-specific dependencies.

import { BaseStreamSession } from '@makaio/framework/adapters/stream-session';
// Abstract base session class for managing the state of a single streaming agent run.
import { BaseStreamConnector } from '@makaio/framework/adapters/stream-session';
// Abstract base connector class providing streaming lifecycle management.
import { BaseStreamAgent } from '@makaio/framework/adapters/stream-session';
// Abstract base agent class wiring connector events to framework bus subjects.
import {
extractToolCallPayload,
toGlobalToolApproval,
loadToolsFromRegistry,
executeTool,
} from '@makaio/framework/adapters/stream-session';
// Utilities for routing tool calls through the bus approval flow and execution.
import { /* schema exports */ } from '@makaio/framework/adapters/stream-session';
// Shared Zod schemas for turn state, reasoning, tool calls, and lifecycle events.
DirectoryPurpose
src/session/BaseStreamSession abstract class and session types
src/connector/BaseStreamConnector abstract class
src/agent/BaseStreamAgent abstract class
src/tool-handling/Tool approval, execution, and registry utilities
src/namespaces/Shared Zod schemas for stream-session bus events