Skip to content

feat(stream): add streaming and session-based compact mode (#4) - #12

Open
Adityakk9031 wants to merge 1 commit into
codag-megalith:mainfrom
Adityakk9031:feat/streaming-session-compact-mode-issue-4
Open

feat(stream): add streaming and session-based compact mode (#4)#12
Adityakk9031 wants to merge 1 commit into
codag-megalith:mainfrom
Adityakk9031:feat/streaming-session-compact-mode-issue-4

Conversation

@Adityakk9031

Copy link
Copy Markdown

Summary

Fixes #4.

Introduces support for long-running streaming log ingestion (codag wrap --stream / --session <id>) and stateful session management. This enables live continuous log tailing (e.g., kubectl logs -f, docker logs -f, aws logs tail --follow) without killing the child process after the standard 90-second timeout, while exposing session snapshot capabilities over MCP for AI agents.

Key Changes

  1. API Layer (internal/api/client.go):
    • Added SessionIngestRequest & SessionSnapshotResponse data structures.
    • Added SessionIngest (POST /v1/sessions/ingest) and SessionSnapshot (GET /v1/sessions/{id}/snapshot) client methods.
  2. Session Manager (internal/session):
    • Added manager.go to store and manage active streaming sessions, buffered log lines, and latest compact snapshots.
  3. CLI Streaming Flags (cmd/wrap.go):
    • Added --stream flag to bypass the default 90s process timeout cap.
    • Added --session <id> flag to associate continuous log streams with a specific session ID.
  4. MCP Tools (internal/mcp/tools.go):
    • Registered snapshot_session tool to allow AI agents to fetch live compacted snapshots for active sessions.
    • Registered list_sessions tool to list active long-running streaming sessions.
  5. Tests: Added internal/session/manager_test.go verifying session lifecycle, line buffering, and snapshot retrieval.

Verification

  • Tested session creation, line appending, and snapshot generation via unit tests (internal/session/manager_test.go).

@Adityakk9031

Copy link
Copy Markdown
Author

@michaelzixizhou have a look

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.

Streaming + session-based compact mode

1 participant