Skip to content

[codex] Refactor chat session boundaries#81

Merged
roackb2 merged 3 commits into
mainfrom
codex/session-service-structure
May 16, 2026
Merged

[codex] Refactor chat session boundaries#81
roackb2 merged 3 commits into
mainfrom
codex/session-service-structure

Conversation

@roackb2
Copy link
Copy Markdown
Owner

@roackb2 roackb2 commented May 16, 2026

Summary

Refactor the chat session engine folder around explicit class boundaries and lightweight types.ts contracts.

  • Split session record, conversation-line, lease, archive, and repository behavior into focused modules.
  • Moved file-backed archive persistence into FileChatArchiveRepository.
  • Converted session storage access to FileChatSessionRepository instances and removed loose exported helper functions from the repository implementation.
  • Moved thin session title generation into ChatSessionTitles under records as session metadata behavior.
  • Added a root @/* -> src/* alias and updated the session-service folder to use it for cross-module imports.
  • Added tsc-alias to the build so server/CLI output rewrites source aliases before publishing.
  • Updated callers and tests to use the new class-based boundaries.

Why

The previous session folder mixed domain helpers, storage helpers, and thin wrapper functions. That made it hard to tell where new behavior belonged and encouraged future agents to copy scattered function patterns. The new structure makes each boundary discoverable: scan types.ts for the contract, then read the owning class for implementation details.

The path alias keeps those boundaries readable without long ../../../.. imports, while tsc-alias preserves runtime safety for emitted Node files.

Validation

  • yarn lint
  • yarn typecheck
  • focused session / compaction / TUI tests
  • yarn build

roackb2 added 3 commits May 16, 2026 12:17
Restructure the chat session engine around explicit class boundaries and types contracts. Records, leases, archives, and repository behavior now live in focused modules with types.ts entry points, while old loose helper functions were removed or folded into class methods.

This makes session behavior easier to discover and extend: callers can scan each subfolder contract first, then follow the class implementation for the owning behavior instead of copying scattered helper patterns.
Configure @/* to resolve to src/* across TypeScript, Vite, Vitest, and shadcn component aliases, then update the session-service folder to use the alias for cross-module imports.

The build now runs tsc-alias after TypeScript emits server and CLI files, so source imports can stay readable without leaving unresolved alias paths in published Node output.
Move the root conversation session service config and contract types into sessions/types.ts so the main session boundary follows the same contract-first pattern as records, leases, archives, and repository modules.
@roackb2 roackb2 marked this pull request as ready for review May 16, 2026 04:30
@roackb2 roackb2 merged commit f814eeb into main May 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant