Skip to content

refactor(daemon): extract the session event journal into a workspace package #2341

Description

@thymikee

Part of #2335.

Purpose

src/daemon/session-event-*.ts (6 files, 1,867 lines; ADR 0018) has zero value dependencies on other daemon files. Its root dependencies are command-catalog.ts (4 files), core/command-descriptor/registry.ts (1) and core/keyboard-actions.ts (7 lines, no imports). Its type dependencies are DaemonRequest, DaemonResponse, DaemonResponseData from src/daemon/types.ts in session-event-request.ts, session-event-log.ts, session-event-action-presentation.ts; the fields read are req.command, req.flags, req.meta.requestId, req.meta.clientArtifactPaths.

Relocating the type declaration is not enough: today's DaemonRequest carries internal (callbacks taking SessionState, an admitted DeviceLease, lifecycle hooks) and daemon-only meta fields.

Required behavior

  • New workspace package (@agent-device/session-journal, name open) with one subpath per moved module; consumers request-generic-dispatch.ts, request-execution-scope.ts, session-store.ts, replay/internal/session-replay-action-runtime.ts, replay/internal/session-replay-runtime-failure-response.ts switch specifier.
  • Journal inputs are typed by shared request types only: the wire-only request shape C exports, or @agent-device/kernel/contracts public request/meta types. No reachability from any journal input type to SessionState or DeviceLease. Splitting files or lowering importer counts does not satisfy this.
  • keyboard-actions.ts folds into the package; catalog and registry come from A's package.

Completion conditions

  • The package imports nothing under src/ (R11) and compiles against A's and C's packages only.
  • A type-level test in the package asserts its input type has no internal key and no property path typed as SessionState or DeviceLease.
  • Event journal output byte-identical for the existing journal fixtures; ADR 0018 references updated.
  • check:layering, eager-closure (subpaths at renamed files), package-boundaries, fallow green.

Dependencies

Blocked by A (catalog, registry) and C (wire-only request shape).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions