Skip to content

feat(soul): add OSC 9 terminal notifications for task completion#1345

Open
zgat wants to merge 4 commits intoMoonshotAI:mainfrom
zgat:main
Open

feat(soul): add OSC 9 terminal notifications for task completion#1345
zgat wants to merge 4 commits intoMoonshotAI:mainfrom
zgat:main

Conversation

@zgat
Copy link

@zgat zgat commented Mar 5, 2026

Summary

Closes #1342

Add OSC 9 terminal notification support to notify users when Kimi completes a task or requir
es approval. This enables terminal emulators and multiplexers (e.g., iTerm2, Windows Termina
l, WezTerm, cmux) to display native desktop notifications.

Changes

  • Added _notify_terminal() function that emits OSC 9 escape sequences
  • Notifications are triggered at:
    • End of each turn (TurnEnd)
    • When approval is required (with action details)
  • Cross-platform implementation:
    • Unix/Linux/macOS: writes to /dev/tty
    • Windows: writes to CONOUT$
    • Fallback to stderr if direct terminal access fails

Supported Terminals

  • iTerm2 (macOS)
  • Windows Terminal
  • WezTerm
  • ConEmu
  • mintty
  • VTE-based terminals
  • cmux and other terminal multiplexers

Example

When Kimi finishes a response, the terminal will show a desktop notification:

Kimi: task completed

When approval is needed:

Kimi: approval required -


Open with Devin

devin-ai-integration[bot]

This comment was marked as resolved.

@zgat
Copy link
Author

zgat commented Mar 5, 2026

I had to use git commit --no-verify because the pre-commit hooks are currently failing wit
h the following errors:

pyproject.toml syntax error:

error: Failed to parse: pyproject.toml Caused by: TOML parse error at line 57, column 15 | 5
7 | module-name = ["kimi_cli"] | ^^^^^^^^^^^^ invalid type: sequence, expected
a string

The current module-name = ["kimi_cli"] should be module-name = "kimi_cli" (string instea
d of array).

Could you help check what's going on with these configuration files? It seems like there mig
ht be some in-progress changes or version mismatches in the repository.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 12 additional findings in Devin Review.

Open in Devin Review

from __future__ import annotations

import asyncio
import sys
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Unused top-level import sys added alongside local re-import inside _notify_terminal

Line 4 adds import sys at module level, but sys is never referenced at module scope — it is only used inside _notify_terminal() which has its own local import sys on line 690. The top-level import is dead code. While not a runtime error, it violates the project's Ruff lint rules (specifically the F rules which include F401 unused imports) mentioned in AGENTS.md.

Suggested change
import sys
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

Add OSC 9/777 terminal notifications for task completion

1 participant