Files
orca/src/main/powershell-osc133-bootstrap.test.ts
T
Neil ab80339158 Fix shell-launched OMP status hooks (#2821)
* Fix shell-launched OMP status hooks

* Update oh-my-pi branding

* Add OMP to mobile agent metadata
2026-05-25 22:20:15 -07:00

39 lines
1.6 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import {
encodePowerShellCommand,
getPowerShellOsc133Bootstrap
} from './powershell-osc133-bootstrap'
describe('PowerShell OSC 133 bootstrap', () => {
it('wraps prompt/readline without bypassing profiles or execution policy', () => {
const script = getPowerShellOsc133Bootstrap()
expect(script).toContain('[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new()')
expect(script).toContain('ORCA_OPENCODE_CONFIG_DIR')
expect(script).toContain('ORCA_PI_CODING_AGENT_DIR')
expect(script).toContain('ORCA_OMP_CODING_AGENT_DIR')
expect(script).toContain('ORCA_OMP_STATUS_EXTENSION')
expect(script).toContain('function Global:omp')
expect(script).toContain('--extension $env:ORCA_OMP_STATUS_EXTENSION')
expect(script).toContain('ORCA_CODEX_HOME')
expect(script).toContain('function Global:prompt')
expect(script).toContain('function Global:PSConsoleHostReadLine')
expect(script).toContain('Esc = [char]27')
expect(script).toContain('Bel = [char]7')
expect(script).toContain(')]133;D;$fakeExitCode$(')
expect(script).toContain(')]133;A$(')
expect(script).toContain(')]133;B$(')
expect(script).toContain(')]133;C$(')
expect(script).not.toContain('`e]133')
expect(script).not.toContain('$PROFILE')
expect(script).not.toContain('ExecutionPolicy')
expect(script).not.toContain('NoProfile')
})
it('encodes commands as UTF-16LE base64 for PowerShell -EncodedCommand', () => {
expect(encodePowerShellCommand('Write-Output ok')).toBe(
Buffer.from('Write-Output ok', 'utf16le').toString('base64')
)
})
})