Skip to content

feat: add /uptime slash command#24161

Open
mateuszkwiatkowski wants to merge 1 commit intoanomalyco:devfrom
mateuszkwiatkowski:feat/uptime-command
Open

feat: add /uptime slash command#24161
mateuszkwiatkowski wants to merge 1 commit intoanomalyco:devfrom
mateuszkwiatkowski:feat/uptime-command

Conversation

@mateuszkwiatkowski
Copy link
Copy Markdown

@mateuszkwiatkowski mateuszkwiatkowski commented Apr 24, 2026

Issue for this PR

Closes #24160

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds a /uptime slash command that shows how long the OpenCode process has been running, similar to the UNIX uptime command. It opens a centered dialog (same style as /status) displaying:

  • Current time and process uptime, e.g. 11:23 AM up 3h 1m 45s
  • Session idle time (duration since last completed assistant message), e.g. idle 5m 12s
  • If the session is actively streaming, shows working instead
  • If on the home screen (no active session), the idle line is omitted

Changes:

  • opencode-process.ts: records Date.now() at module load as the process start time
  • /global/health endpoint: now includes startTime in the response
  • dialog-uptime.tsx: new dialog component matching the /status dialog layout, with idle time tracking via route and sync context
  • app.tsx: registers the /uptime slash command under the System category
  • SDK types regenerated to include startTime field

How did you verify your code works?

  • Ran /uptime in the TUI from both session and home views
  • Confirmed idle duration updates based on last assistant message completion
  • Confirmed working state shown during active streaming
  • bun typecheck passes (all 13 packages via turbo pre-push hook)
  • SDK regenerated via ./packages/sdk/js/script/build.ts
  • Linter (oxlint) reports no new warnings

Screenshots / recordings

N/A -- no structural UI change beyond a new dialog following the existing /status pattern.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@mateuszkwiatkowski mateuszkwiatkowski force-pushed the feat/uptime-command branch 2 times, most recently from b58f687 to 9284b88 Compare April 24, 2026 13:44
@rektide
Copy link
Copy Markdown
Contributor

rektide commented Apr 27, 2026

I'd love to also show how long we are idle for, as well

@mateuszkwiatkowski
Copy link
Copy Markdown
Author

@rektide Opencode already has idle/working status concept in sync.session.status(). This PR is kind of related: #15738 but I don't think these two are in conflict so I'll add it for you.

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.

[FEATURE]: Add /uptime slash command

2 participants