Files
orca/config/scripts/summarize-terminal-perf-report.mjs
Jinwoo-HandOrca a5052c35f3 Merge nwparker/term-speed-2-architecture-docs into orca-performance base
Revives the terminal model/view architecture chain (hidden view parking,
hidden delivery gate, side-effect authority in main, model query authority
— all kill-switched, defaults on) on top of orca-performance's terminal
performance fixes. 34 conflicted files resolved with these decisions:

- Both sides' features kept and kill-switchable. orca-performance's fixes
  preserved exactly: parse-clocked scheduler drains (9e8bb2243), windowed
  retained-tail redraw (4e08a28cd), throttled wait-blocked check
  (66f20258e), #7139/#7150 cooperative drain, backlog caps, wedge guards,
  and probe-certified replay release.
- orca-runtime.ts onPtyData: chain's per-PTY title tracker + side-effect
  facts replace the inline OSC title blocks; our scheduleWaitBlockedCheck
  and redraw-cursor plumbing retained; refreshPtyForegroundAgent re-grafted
  into applyTrackedPtyTitle on status transitions.
- pty.ts: chain's hidden-gate drop sites, restore markers, initiallyHidden
  spawn marking, ConPTY DA1 record, and view-attribute/delivery-interest IPC
  wired through our newer spawn/delivery structure. The chain's flat 2 MB
  pending cap was NOT taken: our scrollback-scaled cap (#7150, empty-drop +
  droppedOutput sentinel) wins and now also emits the chain's one-per-episode
  pty:modelRestoreNeeded 'pending-cap' marker when the gate is enabled. Our
  8 MB renderer in-flight high water kept over the chain's 2 MB.
- pty-connection.ts: chain's gate sync, model-restore channel, side-effect
  fact consumer, and post-restore seq reconciliation composed with our
  hidden-startup query grammar, synchronized-frame latency machinery, and
  probe-certified restore. Phase 6 (skip-grammar deletion) intentionally NOT
  taken: our side evolved that grammar past the chain's base and #7150
  machinery builds on it; with the gate on it is dormant (main drops hidden
  bytes), with switches off it remains the byte-identical fallback.
- Shared module moves adopted (agent-title-*, github-links, bell detector,
  command-code, PR-link detector) with our newer bounded regex-free OSC
  parsers wired through the chain's scanner classes; our pi-synthetic/Devin/
  MiMo agent additions ported into the split modules.
- daemon-pty-adapter: chain's sleep-restore cache + our checkpoint cooldown,
  teardown flag, and oscLinks-carrying cold-restore payload combined.
- rpc/methods/terminal.ts: chain's ACK-gated multiplex output + recovery
  snapshots composed with our budgeted mobile snapshots and resize re-stream.
- Tests adapted only where they encoded superseded cadence: watermark counts
  (2 MB->8 MB), pending-cap trim -> empty-drop sentinel, initial snapshot
  frame seq (layout seq -> snapshot output seq), mock module paths.

Contract tests: 881 passed. Renderer terminal suites: 1895 passed.
Full main runtime+ipc: 2974 passed. Typecheck (3 configs) clean.
Pre-existing baseline failures (pty-subprocess WSL, PR sidebar, Linear
prompt, SidebarToolbar) are unrelated and fail identically on 7839fb9db.

Co-authored-by: Orca <help@stably.ai>
2026-07-03 01:44:20 -04:00

78 lines
2.6 KiB
JavaScript

import { basename } from 'node:path'
import { collectTerminalPerfRows, readJsonReport } from './terminal-perf-report-annotations.mjs'
const reportPaths = process.argv.slice(2)
if (reportPaths[0] === '--') {
reportPaths.shift()
}
if (reportPaths.length === 0) {
console.error(
'Usage: node config/scripts/summarize-terminal-perf-report.mjs <playwright-json>...'
)
process.exit(1)
}
function markdownCell(value) {
return String(value ?? '').replaceAll('|', '\\|')
}
function printMarkdownTable(rows) {
const columns = [
['Source', 'source'],
['Scenario', 'scenario'],
['Panes', 'panes'],
['Frames', 'frames'],
['Median', 'median'],
['Worst', 'worst'],
['Revisit', 'revisit'],
['Scroll', 'scroll'],
['Restore', 'restore'],
['Max Drift', 'maxTimerDrift'],
['Hidden Skips', 'hiddenSkips'],
['Hidden Chars', 'hiddenSkippedChars'],
['Foreground Enqueues', 'deferredForegroundEnqueue'],
['Foreground Writes', 'deferredForegroundWrite'],
['Drains', 'scheduledDrains'],
['Renderer Queued Terms', 'rendererQueuedTerminals'],
['Renderer Queued Chars', 'rendererQueuedChars'],
['Renderer Peak Terms', 'rendererPeakQueuedTerminals'],
['Renderer Peak Chars', 'rendererPeakQueuedChars'],
['Renderer Peak By Term', 'rendererPeakQueuedCharsByTerminal'],
['Renderer Drops', 'rendererDroppedBacklogs'],
['Main Pending PTYs', 'mainPendingPtys'],
['Main Pending Chars', 'mainPendingChars'],
['Main Max Pending', 'mainMaxPendingChars'],
['Main In-Flight PTYs', 'mainInFlightPtys'],
['Main In-Flight Chars', 'mainInFlightChars'],
['Main Max In-Flight', 'mainMaxInFlightChars'],
['Main Active PTYs', 'mainActivePtys'],
['Main Flush Scheduled', 'mainFlushScheduled'],
['Main Peak Pending', 'mainPeakPendingChars'],
['Main Peak Max Pending', 'mainPeakMaxPendingChars'],
['Main Peak In-Flight', 'mainPeakInFlightChars'],
['Main Peak Max In-Flight', 'mainPeakMaxInFlightChars'],
['Main ACK-Gated Skips', 'mainAckGatedFlushSkips'],
['Held ACK PTYs', 'heldAckPtys'],
['Held ACK Chars', 'heldAckChars'],
['Gated ACK PTYs', 'gatedAckPtys']
]
console.log(`| ${columns.map(([label]) => label).join(' | ')} |`)
console.log(`| ${columns.map(() => '---').join(' | ')} |`)
for (const row of rows) {
console.log(`| ${columns.map(([, key]) => markdownCell(row[key])).join(' | ')} |`)
}
}
const rows = reportPaths.flatMap((path) =>
collectTerminalPerfRows(readJsonReport(path), basename(path))
)
if (rows.length === 0) {
console.error('No OpenCode terminal perf annotations found.')
process.exit(1)
}
printMarkdownTable(rows)