Skip to content

CLI command to send messages to inactive sessions (pending queue) #134

@lucharo

Description

@lucharo

Summary

The phone app can send messages to inactive sessions — they get queued server-side and delivered when the session reconnects (pendingCount increments). The CLI has no equivalent. happier session run stream-start only works for active sessions (connected via socket.io) and fails with "RPC method not available" for inactive ones.

Use Case

Building a TUI session manager that lists all relay sessions and lets you message any of them. Currently:

  • Active sessionstream-start/stream-read works
  • Inactive session → no way to send a message from the CLI

The phone app handles this seamlessly — you can type a message to any session regardless of whether it's active. The message sits in the relay's pending queue until the session reconnects.

Proposed Solution

happier session send <session-id> <message> [--json]

This would use the same relay server-side pending queue mechanism that the phone app uses. The message gets delivered when the session reconnects, or immediately if the session is active.

Response:

{
  "ok": true,
  "kind": "session_send",
  "data": {
    "sessionId": "cmm...",
    "delivered": false,
    "pendingCount": 3
  }
}

Where delivered: true means the session was active and received it immediately, delivered: false means it's queued.

Context

Related: #133 (expose continueWithReplay on HTTP API)

The relay already has the pending message infrastructure — the phone app uses it. This just needs a CLI surface.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions