Skip to content

feat(serve): rename a session and request a compaction before the next prompt #575

Closed

Description

@ajianaz

What problem does this solve?

Two session actions of the TUI have no route in tole serve, so a graphical client cannot offer them:

Found while writing the screen inventory for #561 (screen 9, gaps D and E). They are small and write registers that already exist, so they are one issue and one PR.

Proposed solution

Two routes, behind the existing bearer token, refused while a turn runs (the TUI refuses commands then, because they need the session lock):

  • POST /sessions/{id}/name {"name": "<text>"}: writes fact/session_name. Same rules as /name: trimmed, a length cap, control characters rejected (the name is shown in lists and terminals). 400 for a blank or invalid name.
  • POST /sessions/{id}/compact {}: sets the forced-compaction flag the TUI's /compact sets, so the next prompt compacts first. No body fields (instructions stay unsupported and are not accepted, so a client cannot believe they were applied).
  • Both: 404 for an unknown session, 409 while a turn is running, 401 without the token. Corrections are new register entries (the log stays append-only).

Alternatives considered

  • Let clients rewrite the register through some generic write route: a general write route is a much larger surface than two named actions.
  • Skip compact: the footer shows context use, so a user who sees the window filling needs a way to act on it.

Acceptance criteria

  • POST …/name sets the name; sessions --all and tole resume <name> see it; a blank name, an over-long name and a name with control characters are refused (tests).
  • POST …/compact makes the next prompt compact first, covered by a test on the provider requests (the compaction call precedes the prompt), and clears the flag afterwards.
  • 409 while a turn runs, 404 for an unknown session, 401 without the token; each has a test.
  • docs/mobile-control.md and the CHANGELOG are updated in the same PR.

Part of #523. Related: #524, #561, #573.

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

    enhancementpending

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions