MCPcopy Create free account
hub / github.com/Noumena-Network/code / isProgressReportingAvailable

Function isProgressReportingAvailable

src/ink/terminal.ts:27–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25 * Note: Windows Terminal interprets OSC 9;4 as notifications, not progress.
26 */
27export function isProgressReportingAvailable(): boolean {
28 // Only available if we have a TTY (not piped)
29 if (!process.stdout.isTTY) {
30 return false
31 }
32
33 // Explicitly exclude Windows Terminal, which interprets OSC 9;4 as
34 // notifications rather than progress indicators
35 if (process.env.WT_SESSION) {
36 return false
37 }
38
39 // ConEmu supports OSC 9;4 for progress (all versions)
40 if (
41 process.env.ConEmuANSI ||
42 process.env.ConEmuPID ||
43 process.env.ConEmuTask
44 ) {
45 return true
46 }
47
48 const version = coerce(process.env.TERM_PROGRAM_VERSION)
49 if (!version) {
50 return false
51 }
52
53 // Ghostty 1.2.0+ supports OSC 9;4 for progress
54 // https://ghostty.org/docs/install/release-notes/1-2-0
55 if (process.env.TERM_PROGRAM === 'ghostty') {
56 return gte(version.version, '1.2.0')
57 }
58
59 // iTerm2 3.6.6+ supports OSC 9;4 for progress
60 // https://iterm2.com/downloads.html
61 if (process.env.TERM_PROGRAM === 'iTerm.app') {
62 return gte(version.version, '3.6.6')
63 }
64
65 return false
66}
67
68/**
69 * Checks if the terminal supports DEC mode 2026 (synchronized output).

Callers 1

useTerminalNotificationFunction · 0.85

Calls 1

gteFunction · 0.85

Tested by

no test coverage detected