mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 19:04:37 +00:00
mom: refactor to use AgentSession for context management
- Export AgentSession, SessionManager, SettingsManager, compaction from coding-agent - Create MomSessionManager for channel-based context.jsonl storage - Create MomSettingsManager for mom-specific settings - Refactor agent.ts to use AgentSession instead of ephemeral Agent - Split logging: tool results go to context.jsonl, human messages to log.jsonl - Enable auto-compaction and overflow detection from coding-agent Part of #115
This commit is contained in:
parent
de7f71838c
commit
3f6db8e99c
3 changed files with 685 additions and 324 deletions
|
|
@ -1,3 +1,27 @@
|
|||
// Core session management
|
||||
export {
|
||||
AgentSession,
|
||||
type AgentSessionConfig,
|
||||
type AgentSessionEvent,
|
||||
type AgentSessionEventListener,
|
||||
type CompactionResult,
|
||||
type ModelCycleResult,
|
||||
type PromptOptions,
|
||||
type SessionStats,
|
||||
} from "./core/agent-session.js";
|
||||
// Compaction
|
||||
export {
|
||||
type CutPointResult,
|
||||
calculateContextTokens,
|
||||
compact,
|
||||
DEFAULT_COMPACTION_SETTINGS,
|
||||
estimateTokens,
|
||||
findCutPoint,
|
||||
findTurnStartIndex,
|
||||
generateSummary,
|
||||
getLastAssistantUsage,
|
||||
shouldCompact,
|
||||
} from "./core/compaction.js";
|
||||
// Hook system types
|
||||
export type {
|
||||
AgentEndEvent,
|
||||
|
|
@ -18,6 +42,32 @@ export type {
|
|||
TurnEndEvent,
|
||||
TurnStartEvent,
|
||||
} from "./core/hooks/index.js";
|
||||
export { SessionManager } from "./core/session-manager.js";
|
||||
export { messageTransformer } from "./core/messages.js";
|
||||
export {
|
||||
type CompactionEntry,
|
||||
createSummaryMessage,
|
||||
getLatestCompactionEntry,
|
||||
type LoadedSession,
|
||||
loadSessionFromEntries,
|
||||
type ModelChangeEntry,
|
||||
parseSessionEntries,
|
||||
type SessionEntry,
|
||||
type SessionHeader,
|
||||
SessionManager,
|
||||
type SessionMessageEntry,
|
||||
SUMMARY_PREFIX,
|
||||
SUMMARY_SUFFIX,
|
||||
type ThinkingLevelChangeEntry,
|
||||
} from "./core/session-manager.js";
|
||||
export {
|
||||
type CompactionSettings,
|
||||
type RetrySettings,
|
||||
type Settings,
|
||||
SettingsManager,
|
||||
} from "./core/settings-manager.js";
|
||||
|
||||
// Tools
|
||||
export { bashTool, codingTools, editTool, readTool, writeTool } from "./core/tools/index.js";
|
||||
|
||||
// Main entry point
|
||||
export { main } from "./main.js";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue