rovecode 0.4.0-beta.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -69
- package/THIRD_PARTY_NOTICES.md +0 -44
- package/bin/rovecode.ts +21 -0
- package/package.json +16 -37
- package/src/account/keys.ts +97 -0
- package/src/account/login.ts +158 -0
- package/src/account/provision.ts +47 -0
- package/src/account/store.ts +63 -0
- package/src/acp/server.ts +373 -0
- package/src/cli/account-cmd.ts +116 -0
- package/src/cli/connect.ts +244 -0
- package/src/cli/context-cmd.ts +199 -0
- package/src/cli/dispatch.ts +109 -0
- package/src/cli/doctor.ts +324 -0
- package/src/cli/export.ts +278 -0
- package/src/cli/help.ts +240 -0
- package/src/cli/is-tui-invocation.ts +8 -0
- package/src/cli/main.ts +599 -0
- package/src/cli/market-cmd.ts +658 -0
- package/src/cli/mcp-market-cmd.ts +299 -0
- package/src/cli/output.ts +382 -0
- package/src/cli/repl.ts +172 -0
- package/src/cli/resume.ts +32 -0
- package/src/cli/run-limits.ts +78 -0
- package/src/cli/runtime.ts +792 -0
- package/src/cli/setup.ts +187 -0
- package/src/cli/update-cmd.ts +78 -0
- package/src/cli/workflow-cmd.ts +100 -0
- package/src/coding/checkpoints.ts +270 -0
- package/src/coding/diff.ts +136 -0
- package/src/coding/files.ts +339 -0
- package/src/coding/hashline.ts +319 -0
- package/src/coding/lsp.ts +406 -0
- package/src/coding/repomap-cache.ts +99 -0
- package/src/coding/repomap-files.ts +110 -0
- package/src/coding/repomap.ts +392 -0
- package/src/core/compaction.ts +399 -0
- package/src/core/config.ts +289 -0
- package/src/core/context-report.ts +228 -0
- package/src/core/context.ts +60 -0
- package/src/core/count-remote.ts +107 -0
- package/src/core/execpolicy-rules.ts +196 -0
- package/src/core/execpolicy.ts +385 -0
- package/src/core/executor.ts +397 -0
- package/src/core/guardrails.ts +400 -0
- package/src/core/hooks.ts +398 -0
- package/src/core/images.ts +230 -0
- package/src/core/intro.ts +236 -0
- package/src/core/loop.ts +621 -0
- package/src/core/modes.ts +372 -0
- package/src/core/orchestrator.ts +207 -0
- package/src/core/reflection.ts +165 -0
- package/src/core/sandbox-config.ts +167 -0
- package/src/core/session-images.ts +73 -0
- package/src/core/session.ts +398 -0
- package/src/core/settings.ts +98 -0
- package/src/core/stuck-detector.ts +273 -0
- package/src/core/tasks.ts +374 -0
- package/src/core/token-scale.ts +108 -0
- package/src/core/tool-output-budget.ts +166 -0
- package/src/core/tools.ts +288 -0
- package/src/core/types.ts +330 -0
- package/src/core/update-check.ts +171 -0
- package/src/core/update.ts +158 -0
- package/src/core/usage.ts +204 -0
- package/src/core/validate.ts +121 -0
- package/src/core/verify-gate.ts +159 -0
- package/src/core/verify.ts +237 -0
- package/src/core/voice.ts +158 -0
- package/src/core/win-job.ts +183 -0
- package/src/design/audit.ts +797 -0
- package/src/design/direction.ts +190 -0
- package/src/design/rules.ts +157 -0
- package/src/eval/bench.ts +150 -0
- package/src/eval/gauntlet-runner.ts +218 -0
- package/src/eval/gauntlet.ts +226 -0
- package/src/eval/grader.ts +186 -0
- package/src/eval/record.ts +202 -0
- package/src/eval/redact.ts +141 -0
- package/src/eval/replay.ts +147 -0
- package/src/eval/trajectory.ts +373 -0
- package/src/index.ts +17 -0
- package/src/market/catalogs/mcp-docs.json +111 -0
- package/src/market/catalogs/plugins.json +111 -0
- package/src/market/catalogs/skills.json +478 -0
- package/src/market/clone.ts +72 -0
- package/src/market/context-cost.ts +121 -0
- package/src/market/digest.ts +106 -0
- package/src/market/index.ts +22 -0
- package/src/market/install.ts +578 -0
- package/src/market/manifest.ts +187 -0
- package/src/market/prereq.ts +145 -0
- package/src/market/registry.ts +363 -0
- package/src/market/resolve.ts +111 -0
- package/src/market/types.ts +236 -0
- package/src/market/validate.ts +227 -0
- package/src/mcp/client.ts +431 -0
- package/src/mcp/config.ts +239 -0
- package/src/mcp/local-package.ts +211 -0
- package/src/mcp/market-catalog.ts +84 -0
- package/src/mcp/market-install.ts +289 -0
- package/src/mcp/market.ts +0 -0
- package/src/mcp/tools.ts +131 -0
- package/src/mcp/trust.ts +49 -0
- package/src/memory/blocks.ts +175 -0
- package/src/memory/recall.ts +355 -0
- package/src/memory/store.ts +105 -0
- package/src/memory/tools.ts +99 -0
- package/src/plugins/cli.ts +123 -0
- package/src/plugins/discover.ts +108 -0
- package/src/plugins/index.ts +50 -0
- package/src/plugins/init.ts +140 -0
- package/src/plugins/install.ts +184 -0
- package/src/plugins/load.ts +149 -0
- package/src/plugins/manifest.ts +106 -0
- package/src/plugins/state.ts +83 -0
- package/src/providers/auth.ts +293 -0
- package/src/providers/cache.ts +223 -0
- package/src/providers/catalog-local.ts +160 -0
- package/src/providers/catalog.ts +408 -0
- package/src/providers/middleware-context.ts +86 -0
- package/src/providers/middleware.ts +373 -0
- package/src/providers/profile-glm53.ts +111 -0
- package/src/providers/profile-sonnet5-persona.ts +65 -0
- package/src/providers/profile-sonnet5-voice.ts +23 -0
- package/src/providers/profiles.ts +156 -0
- package/src/providers/provider-config.ts +311 -0
- package/src/providers/registry.ts +302 -0
- package/src/providers/response-validation.ts +80 -0
- package/src/providers/retry.ts +234 -0
- package/src/providers/router.ts +294 -0
- package/src/providers/sse.ts +26 -0
- package/src/providers/stream-errors.ts +117 -0
- package/src/providers/stream.ts +569 -0
- package/src/providers/thinking.ts +189 -0
- package/src/providers/wire-messages.ts +129 -0
- package/src/sdk/client.ts +225 -0
- package/src/sdk/index.ts +3 -0
- package/src/server/dashboard.ts +144 -0
- package/src/server/http.ts +343 -0
- package/src/server/openapi.ts +246 -0
- package/src/sextant/card-hits.ts +102 -0
- package/src/sextant/card-keys.ts +55 -0
- package/src/sextant/context-source.ts +157 -0
- package/src/sextant/draw-agents.ts +273 -0
- package/src/sextant/draw-code.ts +388 -0
- package/src/sextant/draw-context.ts +222 -0
- package/src/sextant/draw-frame.ts +164 -0
- package/src/sextant/draw-market.ts +573 -0
- package/src/sextant/draw-messages.ts +386 -0
- package/src/sextant/draw-pet.ts +230 -0
- package/src/sextant/draw-plan.ts +159 -0
- package/src/sextant/draw-tabs.ts +85 -0
- package/src/sextant/draw-util.ts +65 -0
- package/src/sextant/engine.ts +230 -0
- package/src/sextant/frame-hits.ts +25 -0
- package/src/sextant/frame.ts +101 -0
- package/src/sextant/git-status.ts +197 -0
- package/src/sextant/grid.ts +59 -0
- package/src/sextant/input.ts +119 -0
- package/src/sextant/keys.ts +488 -0
- package/src/sextant/layout.ts +86 -0
- package/src/sextant/local-commands.ts +156 -0
- package/src/sextant/market-source.ts +287 -0
- package/src/sextant/mentions.ts +141 -0
- package/src/sextant/message-hits.ts +26 -0
- package/src/sextant/model.ts +387 -0
- package/src/sextant/overlays.ts +451 -0
- package/src/sextant/panel-hits.ts +38 -0
- package/src/sextant/pet.ts +399 -0
- package/src/sextant/screen.ts +324 -0
- package/src/sextant/scroll-hits.ts +66 -0
- package/src/sextant/scrollbar.ts +82 -0
- package/src/sextant/selection.ts +123 -0
- package/src/sextant/sextant-bridge.ts +174 -0
- package/src/sextant/sextant-cards.ts +142 -0
- package/src/sextant/sextant-diff-base.ts +63 -0
- package/src/sextant/sextant-files.ts +154 -0
- package/src/sextant/sextant-frame-loop.ts +314 -0
- package/src/sextant/sextant-renderer.ts +478 -0
- package/src/sextant/sextant-repo.ts +131 -0
- package/src/sextant/theme.ts +66 -0
- package/src/sextant/tool-rows.ts +189 -0
- package/src/sextant/types.ts +473 -0
- package/src/skills/index.ts +306 -0
- package/src/skills/tools.ts +69 -0
- package/src/skills/versioned.ts +227 -0
- package/src/telemetry/otel.ts +353 -0
- package/src/telemetry/otlp.ts +68 -0
- package/src/tools/ask-user.ts +156 -0
- package/src/tools/design.ts +151 -0
- package/src/tools/evalcell.ts +338 -0
- package/src/tools/html-text.ts +139 -0
- package/src/tools/provider.ts +149 -0
- package/src/tools/task.ts +216 -0
- package/src/tools/todo.ts +320 -0
- package/src/tools/webfetch.ts +331 -0
- package/src/tui/app.ts +608 -0
- package/src/tui/attach.ts +127 -0
- package/src/tui/checkpoints-cmd.ts +70 -0
- package/src/tui/clipboard-image.ts +81 -0
- package/src/tui/commands.ts +277 -0
- package/src/tui/cost.ts +108 -0
- package/src/tui/info-cmd.ts +144 -0
- package/src/tui/mcp-cmd.ts +128 -0
- package/src/tui/modes-cmd.ts +45 -0
- package/src/tui/overlays.ts +97 -0
- package/src/tui/pi-renderer.ts +424 -0
- package/src/tui/providers-cmd.ts +366 -0
- package/src/tui/renderer.ts +101 -0
- package/src/tui/replay-marker.ts +29 -0
- package/src/tui/session-cmd.ts +146 -0
- package/src/tui/sextant-attach.ts +68 -0
- package/src/tui/sextant-io.ts +184 -0
- package/src/tui/sextant-smoke.ts +110 -0
- package/src/tui/smoke.ts +72 -0
- package/src/tui/theme.ts +59 -0
- package/src/tui/todo-label.ts +7 -0
- package/src/workflow/engine.ts +266 -0
- package/tsconfig.json +30 -0
- package/vendor/pi-tui/LICENSE +21 -0
- package/vendor/pi-tui/PATCHES.md +12 -0
- package/vendor/pi-tui/PROVENANCE.md +12 -0
- package/vendor/pi-tui/README.upstream.md +854 -0
- package/vendor/pi-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
- package/vendor/pi-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
- package/vendor/pi-tui/src/alt-screen-search.ts +158 -0
- package/vendor/pi-tui/src/autocomplete.ts +827 -0
- package/vendor/pi-tui/src/components/alt-screen-flash.ts +52 -0
- package/vendor/pi-tui/src/components/box.ts +138 -0
- package/vendor/pi-tui/src/components/cancellable-loader.ts +41 -0
- package/vendor/pi-tui/src/components/editor.ts +2364 -0
- package/vendor/pi-tui/src/components/h-stack.ts +45 -0
- package/vendor/pi-tui/src/components/image.ts +128 -0
- package/vendor/pi-tui/src/components/input.ts +448 -0
- package/vendor/pi-tui/src/components/loader.ts +93 -0
- package/vendor/pi-tui/src/components/markdown.ts +1016 -0
- package/vendor/pi-tui/src/components/scroll-view.ts +217 -0
- package/vendor/pi-tui/src/components/select-list.ts +230 -0
- package/vendor/pi-tui/src/components/settings-list.ts +277 -0
- package/vendor/pi-tui/src/components/spacer.ts +29 -0
- package/vendor/pi-tui/src/components/stack.ts +155 -0
- package/vendor/pi-tui/src/components/text.ts +108 -0
- package/vendor/pi-tui/src/components/truncated-text.ts +66 -0
- package/vendor/pi-tui/src/components/v-stack.ts +34 -0
- package/vendor/pi-tui/src/editor-component.ts +75 -0
- package/vendor/pi-tui/src/fuzzy.ts +138 -0
- package/vendor/pi-tui/src/index.ts +149 -0
- package/vendor/pi-tui/src/keybindings.ts +321 -0
- package/vendor/pi-tui/src/keys.ts +1402 -0
- package/vendor/pi-tui/src/kill-ring.ts +47 -0
- package/vendor/pi-tui/src/latex.ts +1381 -0
- package/vendor/pi-tui/src/layout-node.ts +52 -0
- package/vendor/pi-tui/src/layout.ts +411 -0
- package/vendor/pi-tui/src/native-modifiers.ts +60 -0
- package/vendor/pi-tui/src/native-module-path.ts +32 -0
- package/vendor/pi-tui/src/stdin-buffer.ts +445 -0
- package/vendor/pi-tui/src/terminal-colors.ts +74 -0
- package/vendor/pi-tui/src/terminal-image.ts +701 -0
- package/vendor/pi-tui/src/terminal.ts +554 -0
- package/vendor/pi-tui/src/tui-alt-screen.ts +1379 -0
- package/vendor/pi-tui/src/tui-main-screen.ts +655 -0
- package/vendor/pi-tui/src/tui.ts +1264 -0
- package/vendor/pi-tui/src/undo-stack.ts +29 -0
- package/vendor/pi-tui/src/utils.ts +1327 -0
- package/vendor/pi-tui/src/word-navigation.ts +118 -0
- package/vendor/pi-tui/test/test-themes.ts +39 -0
- package/vendor/pi-tui/test/virtual-terminal.ts +219 -0
- package/CHANGELOG.md +0 -512
- package/bin/rovecode.js +0 -24
- package/dist/cli/app-dybnr56b.js +0 -2
- package/dist/cli/ask-user-p8hq4xgj.js +0 -2
- package/dist/cli/auth-login-ewpgw5sm.js +0 -2
- package/dist/cli/auth-m8p9grty.js +0 -2
- package/dist/cli/bench-xv3ypwev.js +0 -9
- package/dist/cli/catalog-737wb2s0.js +0 -2
- package/dist/cli/cli-arhg40m0.js +0 -2
- package/dist/cli/client-cf2pxx8q.js +0 -2
- package/dist/cli/commands-3p7e4xxs.js +0 -2
- package/dist/cli/connect-3q93d7cb.js +0 -2
- package/dist/cli/context-cmd-eqxmxhzq.js +0 -2
- package/dist/cli/context-report-hbw9zfes.js +0 -2
- package/dist/cli/count-remote-mby98cd0.js +0 -2
- package/dist/cli/design-122y0axd.js +0 -2
- package/dist/cli/dispatch-b4egzvvh.js +0 -2
- package/dist/cli/doctor-x4jkv72e.js +0 -3
- package/dist/cli/executor-ftvg6tsy.js +0 -2
- package/dist/cli/export-pdgdhkch.js +0 -2
- package/dist/cli/files-cez9a96p.js +0 -2
- package/dist/cli/gauntlet-r3xxaszc.js +0 -2
- package/dist/cli/gauntlet-runner-r515m7kk.js +0 -10
- package/dist/cli/gauntlet-wave3-bnkjk2v2.js +0 -5
- package/dist/cli/gauntlet-wave4-acs9s60q.js +0 -14
- package/dist/cli/hashline-ewg5hbe3.js +0 -2
- package/dist/cli/http-n0kehsk8.js +0 -5
- package/dist/cli/index-z5qt1s76.js +0 -2
- package/dist/cli/install-80mp63kx.js +0 -2
- package/dist/cli/loop-12twjcat.js +0 -2
- package/dist/cli/main-01pv9206.js +0 -4
- package/dist/cli/main-0jys2ccn.js +0 -3
- package/dist/cli/main-1ztz6fkj.js +0 -10
- package/dist/cli/main-23q7cmww.js +0 -9
- package/dist/cli/main-2rzbexn2.js +0 -3
- package/dist/cli/main-2wyax8k9.js +0 -9
- package/dist/cli/main-2yeveeve.js +0 -6
- package/dist/cli/main-2z3dek0b.js +0 -3
- package/dist/cli/main-2zgsknth.js +0 -3
- package/dist/cli/main-45ejth3a.js +0 -4
- package/dist/cli/main-45rn3trk.js +0 -22
- package/dist/cli/main-4p4e2w7x.js +0 -4
- package/dist/cli/main-4y0tnfpa.js +0 -16
- package/dist/cli/main-5py0rkmc.js +0 -4
- package/dist/cli/main-6dtqmbt6.js +0 -7
- package/dist/cli/main-6h9x282m.js +0 -4
- package/dist/cli/main-6vjeds42.js +0 -3
- package/dist/cli/main-78gq4bt9.js +0 -6
- package/dist/cli/main-7jd5vh3x.js +0 -4
- package/dist/cli/main-7kt6r53y.js +0 -4
- package/dist/cli/main-8c1tbazx.js +0 -58
- package/dist/cli/main-9a9rnh47.js +0 -19
- package/dist/cli/main-9ht36z12.js +0 -3
- package/dist/cli/main-a2yfvcy9.js +0 -7
- package/dist/cli/main-a3f51n0x.js +0 -5
- package/dist/cli/main-b8zq261k.js +0 -3
- package/dist/cli/main-bxtvnf6d.js +0 -13
- package/dist/cli/main-edxc3yzt.js +0 -4
- package/dist/cli/main-evgz4mp5.js +0 -21
- package/dist/cli/main-f33fc5je.js +0 -9
- package/dist/cli/main-fvnpq46y.js +0 -12
- package/dist/cli/main-gbbty4d4.js +0 -3
- package/dist/cli/main-gth53dnt.js +0 -25
- package/dist/cli/main-hqbz10aw.js +0 -9
- package/dist/cli/main-hrrvcfan.js +0 -38
- package/dist/cli/main-hzwtsb2m.js +0 -5
- package/dist/cli/main-j7ttv0sd.js +0 -34
- package/dist/cli/main-jak598k9.js +0 -5
- package/dist/cli/main-kba6zeyd.js +0 -6
- package/dist/cli/main-kwwsz6rq.js +0 -3
- package/dist/cli/main-m8vm17zq.js +0 -3
- package/dist/cli/main-mg4f96e1.js +0 -3
- package/dist/cli/main-mg9b20ac.js +0 -18
- package/dist/cli/main-mgb9ccnx.js +0 -3
- package/dist/cli/main-mjt2p7aj.js +0 -3
- package/dist/cli/main-n6qrdbmy.js +0 -3
- package/dist/cli/main-na7wse0x.js +0 -5
- package/dist/cli/main-nqveez48.js +0 -4
- package/dist/cli/main-ntqef02r.js +0 -10
- package/dist/cli/main-nvc3yjay.js +0 -136
- package/dist/cli/main-p0cfn6nr.js +0 -16
- package/dist/cli/main-qj2djy17.js +0 -19
- package/dist/cli/main-qsevpgsv.js +0 -3
- package/dist/cli/main-qvarybsp.js +0 -3
- package/dist/cli/main-rebtt91r.js +0 -5
- package/dist/cli/main-rpg7h8mb.js +0 -3
- package/dist/cli/main-rsy72qmw.js +0 -15
- package/dist/cli/main-rvetps99.js +0 -18
- package/dist/cli/main-s4bb0jav.js +0 -3
- package/dist/cli/main-s9v8k74e.js +0 -3
- package/dist/cli/main-tjvwmscs.js +0 -3
- package/dist/cli/main-tkgarpjj.js +0 -4
- package/dist/cli/main-v8y60bb2.js +0 -3
- package/dist/cli/main-vhrrq337.js +0 -3
- package/dist/cli/main-vp2dfb7s.js +0 -4
- package/dist/cli/main-vqbr22sz.js +0 -8
- package/dist/cli/main-vxnwe5xx.js +0 -18
- package/dist/cli/main-wgph00xf.js +0 -5
- package/dist/cli/main-wk2csfnj.js +0 -5
- package/dist/cli/main-wm997zjx.js +0 -3
- package/dist/cli/main-wpkyraxh.js +0 -3
- package/dist/cli/main-wqt32p5x.js +0 -4
- package/dist/cli/main-x9ct6y1a.js +0 -3
- package/dist/cli/main-xfekqh9m.js +0 -7
- package/dist/cli/main-xt9zc3n6.js +0 -7
- package/dist/cli/main-xx2z3zh5.js +0 -4
- package/dist/cli/main-y5c82rxr.js +0 -3
- package/dist/cli/main-yrjt2sqt.js +0 -14
- package/dist/cli/main-ys6zj3yr.js +0 -3
- package/dist/cli/main-ywbxshqc.js +0 -8
- package/dist/cli/main-z13755t8.js +0 -25
- package/dist/cli/main-zc7pyrbj.js +0 -4
- package/dist/cli/main.js +0 -279
- package/dist/cli/market-cmd-bm5xvn9f.js +0 -5
- package/dist/cli/mcp-login-bthtfpt7.js +0 -2
- package/dist/cli/mcp-market-cmd-mbeshfyd.js +0 -2
- package/dist/cli/notify-54v5z9dz.js +0 -2
- package/dist/cli/oauth-g5gme95c.js +0 -2
- package/dist/cli/output-satndjap.js +0 -16
- package/dist/cli/profiles-sfhpbq3m.js +0 -2
- package/dist/cli/provider-config-hv3xtdt4.js +0 -2
- package/dist/cli/provider-kwzq6g84.js +0 -2
- package/dist/cli/registry-fh0hdnyn.js +0 -2
- package/dist/cli/registry-y1y8e94r.js +0 -2
- package/dist/cli/repl-t4z03mqq.js +0 -11
- package/dist/cli/resume-fqt4chg8.js +0 -2
- package/dist/cli/run-flags-rysbag9t.js +0 -2
- package/dist/cli/runtime-j19fjbsa.js +0 -2
- package/dist/cli/sandbox-config-g4qxd7y5.js +0 -2
- package/dist/cli/server-r0b6bksk.js +0 -5
- package/dist/cli/session-arg-txmn5g4x.js +0 -2
- package/dist/cli/session-ed250d9j.js +0 -2
- package/dist/cli/sessions-cmd-adw7svfn.js +0 -7
- package/dist/cli/settings-y9rzcqx8.js +0 -2
- package/dist/cli/setup-jmbr11j0.js +0 -2
- package/dist/cli/sextant-smoke-tcth0vea.js +0 -5
- package/dist/cli/skills-cmd-zbdy99v6.js +0 -2
- package/dist/cli/smoke-1bg937kx.js +0 -8
- package/dist/cli/start-chat-p01cdks3.js +0 -12
- package/dist/cli/stream-4wmyaypz.js +0 -2
- package/dist/cli/task-eg4s093s.js +0 -2
- package/dist/cli/tasks-12v9rr9k.js +0 -2
- package/dist/cli/thinking-a5ngvqyh.js +0 -2
- package/dist/cli/todo-1wxpcecx.js +0 -2
- package/dist/cli/tools-2ftsya7w.js +0 -2
- package/dist/cli/tools-x1tj4fxm.js +0 -2
- package/dist/cli/trust-cmd-hccxehzb.js +0 -2
- package/dist/cli/update-check-ygt3vd7m.js +0 -2
- package/dist/cli/update-cmd-v23qhr8c.js +0 -2
- package/dist/cli/voice-g1gtck92.js +0 -2
- package/dist/cli/webfetch-0nnrjgb5.js +0 -2
- package/dist/cli/websearch-f0vr2p7d.js +0 -2
- package/dist/cli/workspace-9rq1w4ta.js +0 -2
- package/dist/lib/index.js +0 -62
- package/dist/lib/models-index.json +0 -1
- package/dist/lib/plugins.js +0 -6
- package/dist/lib/providers.js +0 -17
- package/dist/lib/public-api.js +0 -20
- package/dist/rovecode.exe +0 -4
- /package/{dist/cli → src/providers}/models-index.json +0 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// @ts-nocheck -- vendored by rovecode: upstream-checked at pinned SHA 853a80d2; see ../PATCHES.md
|
|
2
|
+
import { getWordSegmenter, isWhitespaceChar, PUNCTUATION_REGEX } from "./utils.ts";
|
|
3
|
+
|
|
4
|
+
const wordSegmenter = getWordSegmenter();
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Options for word navigation functions.
|
|
8
|
+
* When omitted, uses the default Intl.Segmenter word segmentation.
|
|
9
|
+
*/
|
|
10
|
+
export interface WordNavigationOptions {
|
|
11
|
+
/** Custom segmenter returning word segments for the given text. */
|
|
12
|
+
segment?: (text: string) => Iterable<Intl.SegmentData>;
|
|
13
|
+
/** Predicate identifying atomic segments that should be treated as single units (e.g. paste markers). */
|
|
14
|
+
isAtomicSegment?: (segment: string) => boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Find the cursor position after moving one word backward from `cursor` in `text`.
|
|
19
|
+
* Skips trailing whitespace, then stops at the next word/punctuation boundary.
|
|
20
|
+
*
|
|
21
|
+
* Pure function - does not mutate any state.
|
|
22
|
+
*/
|
|
23
|
+
export function findWordBackward(text: string, cursor: number, options?: WordNavigationOptions): number {
|
|
24
|
+
if (cursor <= 0) return 0;
|
|
25
|
+
|
|
26
|
+
const textBeforeCursor = text.slice(0, cursor);
|
|
27
|
+
const segmentFn = options?.segment;
|
|
28
|
+
const isAtomic = options?.isAtomicSegment;
|
|
29
|
+
const segments = segmentFn ? [...segmentFn(textBeforeCursor)] : [...wordSegmenter.segment(textBeforeCursor)];
|
|
30
|
+
let newCursor = cursor;
|
|
31
|
+
|
|
32
|
+
// Skip trailing whitespace
|
|
33
|
+
while (
|
|
34
|
+
segments.length > 0 &&
|
|
35
|
+
!isAtomic?.(segments[segments.length - 1]?.segment || "") &&
|
|
36
|
+
isWhitespaceChar(segments[segments.length - 1]?.segment || "")
|
|
37
|
+
) {
|
|
38
|
+
newCursor -= segments.pop()?.segment.length || 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (segments.length === 0) return newCursor;
|
|
42
|
+
|
|
43
|
+
const last = segments[segments.length - 1]!;
|
|
44
|
+
|
|
45
|
+
if (isAtomic?.(last.segment)) {
|
|
46
|
+
// Skip one atomic segment.
|
|
47
|
+
newCursor -= last.segment.length;
|
|
48
|
+
} else if (last.isWordLike) {
|
|
49
|
+
// Skip inside one word-like segment, preserving ASCII punctuation boundaries.
|
|
50
|
+
const segment = last.segment;
|
|
51
|
+
const matches = [...segment.matchAll(new RegExp(PUNCTUATION_REGEX, "g"))];
|
|
52
|
+
if (matches.length <= 0) {
|
|
53
|
+
newCursor -= segment.length;
|
|
54
|
+
} else {
|
|
55
|
+
const lastMatch = matches[matches.length - 1]!;
|
|
56
|
+
newCursor -= segment.length - (lastMatch.index + lastMatch[0].length);
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
// Skip non-word non-whitespace run (punctuation)
|
|
60
|
+
while (
|
|
61
|
+
segments.length > 0 &&
|
|
62
|
+
!isAtomic?.(segments[segments.length - 1]?.segment || "") &&
|
|
63
|
+
!segments[segments.length - 1]?.isWordLike &&
|
|
64
|
+
!isWhitespaceChar(segments[segments.length - 1]?.segment || "")
|
|
65
|
+
) {
|
|
66
|
+
newCursor -= segments.pop()?.segment.length || 0;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return newCursor;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Find the cursor position after moving one word forward from `cursor` in `text`.
|
|
75
|
+
* Skips leading whitespace, then stops at the next word/punctuation boundary.
|
|
76
|
+
*
|
|
77
|
+
* Pure function - does not mutate any state.
|
|
78
|
+
*/
|
|
79
|
+
export function findWordForward(text: string, cursor: number, options?: WordNavigationOptions): number {
|
|
80
|
+
if (cursor >= text.length) return text.length;
|
|
81
|
+
|
|
82
|
+
const textAfterCursor = text.slice(cursor);
|
|
83
|
+
const segmentFn = options?.segment;
|
|
84
|
+
const isAtomic = options?.isAtomicSegment;
|
|
85
|
+
const segments = segmentFn ? segmentFn(textAfterCursor) : wordSegmenter.segment(textAfterCursor);
|
|
86
|
+
const iterator = segments[Symbol.iterator]();
|
|
87
|
+
let next = iterator.next();
|
|
88
|
+
let newCursor = cursor;
|
|
89
|
+
|
|
90
|
+
// Skip leading whitespace
|
|
91
|
+
while (!next.done && !isAtomic?.(next.value.segment) && isWhitespaceChar(next.value.segment)) {
|
|
92
|
+
newCursor += next.value.segment.length;
|
|
93
|
+
next = iterator.next();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (next.done) return newCursor;
|
|
97
|
+
|
|
98
|
+
if (isAtomic?.(next.value.segment)) {
|
|
99
|
+
// Skip one atomic segment.
|
|
100
|
+
newCursor += next.value.segment.length;
|
|
101
|
+
} else if (next.value.isWordLike) {
|
|
102
|
+
// Skip inside one word-like segment, preserving ASCII punctuation boundaries.
|
|
103
|
+
newCursor += PUNCTUATION_REGEX.exec(next.value.segment)?.index ?? next.value.segment.length;
|
|
104
|
+
} else {
|
|
105
|
+
// Skip non-word non-whitespace run (punctuation)
|
|
106
|
+
while (
|
|
107
|
+
!next.done &&
|
|
108
|
+
!isAtomic?.(next.value.segment) &&
|
|
109
|
+
!next.value.isWordLike &&
|
|
110
|
+
!isWhitespaceChar(next.value.segment)
|
|
111
|
+
) {
|
|
112
|
+
newCursor += next.value.segment.length;
|
|
113
|
+
next = iterator.next();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return newCursor;
|
|
118
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// @ts-nocheck -- vendored by rovecode: upstream-checked at pinned SHA 853a80d2; see ../PATCHES.md
|
|
2
|
+
/**
|
|
3
|
+
* Default themes for TUI tests using chalk
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { Chalk } from "chalk";
|
|
7
|
+
import type { EditorTheme, MarkdownTheme, SelectListTheme } from "../src/index.ts";
|
|
8
|
+
|
|
9
|
+
const chalk = new Chalk({ level: 3 });
|
|
10
|
+
|
|
11
|
+
export const defaultSelectListTheme: SelectListTheme = {
|
|
12
|
+
selectedPrefix: (text: string) => chalk.blue(text),
|
|
13
|
+
selectedText: (text: string) => chalk.bold(text),
|
|
14
|
+
description: (text: string) => chalk.dim(text),
|
|
15
|
+
scrollInfo: (text: string) => chalk.dim(text),
|
|
16
|
+
noMatch: (text: string) => chalk.dim(text),
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const defaultMarkdownTheme: MarkdownTheme = {
|
|
20
|
+
heading: (text: string) => chalk.bold.cyan(text),
|
|
21
|
+
link: (text: string) => chalk.blue(text),
|
|
22
|
+
linkUrl: (text: string) => chalk.dim(text),
|
|
23
|
+
code: (text: string) => chalk.yellow(text),
|
|
24
|
+
codeBlock: (text: string) => chalk.green(text),
|
|
25
|
+
codeBlockBorder: (text: string) => chalk.dim(text),
|
|
26
|
+
quote: (text: string) => chalk.italic(text),
|
|
27
|
+
quoteBorder: (text: string) => chalk.dim(text),
|
|
28
|
+
hr: (text: string) => chalk.dim(text),
|
|
29
|
+
listBullet: (text: string) => chalk.cyan(text),
|
|
30
|
+
bold: (text: string) => chalk.bold(text),
|
|
31
|
+
italic: (text: string) => chalk.italic(text),
|
|
32
|
+
strikethrough: (text: string) => chalk.strikethrough(text),
|
|
33
|
+
underline: (text: string) => chalk.underline(text),
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const defaultEditorTheme: EditorTheme = {
|
|
37
|
+
borderColor: (text: string) => chalk.dim(text),
|
|
38
|
+
selectList: defaultSelectListTheme,
|
|
39
|
+
};
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
// @ts-nocheck -- vendored by rovecode: upstream-checked at pinned SHA 853a80d2; see ../PATCHES.md
|
|
2
|
+
import type { Terminal as XtermTerminalType } from "@xterm/headless";
|
|
3
|
+
import xterm from "@xterm/headless";
|
|
4
|
+
import type { Terminal } from "../src/terminal.ts";
|
|
5
|
+
|
|
6
|
+
// Extract Terminal class from the module
|
|
7
|
+
const XtermTerminal = xterm.Terminal;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Virtual terminal for testing using xterm.js for accurate terminal emulation
|
|
11
|
+
*/
|
|
12
|
+
export class VirtualTerminal implements Terminal {
|
|
13
|
+
private xterm: XtermTerminalType;
|
|
14
|
+
private inputHandler?: (data: string) => void;
|
|
15
|
+
private resizeHandler?: () => void;
|
|
16
|
+
private _columns: number;
|
|
17
|
+
private _rows: number;
|
|
18
|
+
|
|
19
|
+
constructor(columns = 80, rows = 24) {
|
|
20
|
+
this._columns = columns;
|
|
21
|
+
this._rows = rows;
|
|
22
|
+
|
|
23
|
+
// Create xterm instance with specified dimensions
|
|
24
|
+
this.xterm = new XtermTerminal({
|
|
25
|
+
cols: columns,
|
|
26
|
+
rows: rows,
|
|
27
|
+
// Disable all interactive features for testing
|
|
28
|
+
disableStdin: true,
|
|
29
|
+
allowProposedApi: true,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
start(onInput: (data: string) => void, onResize: () => void): void {
|
|
34
|
+
this.inputHandler = onInput;
|
|
35
|
+
this.resizeHandler = onResize;
|
|
36
|
+
// Enable bracketed paste mode for consistency with ProcessTerminal
|
|
37
|
+
this.xterm.write("\x1b[?2004h");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async drainInput(_maxMs?: number, _idleMs?: number): Promise<void> {
|
|
41
|
+
// No-op for virtual terminal - no stdin to drain
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
stop(): void {
|
|
45
|
+
// Disable bracketed paste mode
|
|
46
|
+
this.xterm.write("\x1b[?2004l");
|
|
47
|
+
this.inputHandler = undefined;
|
|
48
|
+
this.resizeHandler = undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
write(data: string): void {
|
|
52
|
+
this.xterm.write(data);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
get columns(): number {
|
|
56
|
+
return this._columns;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get rows(): number {
|
|
60
|
+
return this._rows;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
get kittyProtocolActive(): boolean {
|
|
64
|
+
// Virtual terminal always reports Kitty protocol as active for testing
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
moveBy(lines: number): void {
|
|
69
|
+
if (lines > 0) {
|
|
70
|
+
// Move down
|
|
71
|
+
this.xterm.write(`\x1b[${lines}B`);
|
|
72
|
+
} else if (lines < 0) {
|
|
73
|
+
// Move up
|
|
74
|
+
this.xterm.write(`\x1b[${-lines}A`);
|
|
75
|
+
}
|
|
76
|
+
// lines === 0: no movement
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
hideCursor(): void {
|
|
80
|
+
this.xterm.write("\x1b[?25l");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
showCursor(): void {
|
|
84
|
+
this.xterm.write("\x1b[?25h");
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
clearLine(): void {
|
|
88
|
+
this.xterm.write("\x1b[K");
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
clearFromCursor(): void {
|
|
92
|
+
this.xterm.write("\x1b[J");
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
clearScreen(): void {
|
|
96
|
+
this.xterm.write("\x1b[2J\x1b[H"); // Clear screen and move to home (1,1)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
setTitle(title: string): void {
|
|
100
|
+
// OSC 0;title BEL - set terminal window title
|
|
101
|
+
this.xterm.write(`\x1b]0;${title}\x07`);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
setProgress(_active: boolean): void {}
|
|
105
|
+
|
|
106
|
+
// Test-specific methods not in Terminal interface
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Simulate keyboard input
|
|
110
|
+
*/
|
|
111
|
+
sendInput(data: string): void {
|
|
112
|
+
if (this.inputHandler) {
|
|
113
|
+
this.inputHandler(data);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Resize the terminal
|
|
119
|
+
*/
|
|
120
|
+
resize(columns: number, rows: number): void {
|
|
121
|
+
this._columns = columns;
|
|
122
|
+
this._rows = rows;
|
|
123
|
+
this.xterm.resize(columns, rows);
|
|
124
|
+
if (this.resizeHandler) {
|
|
125
|
+
this.resizeHandler();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Wait for all pending writes to complete. Viewport and scroll buffer will be updated.
|
|
131
|
+
*/
|
|
132
|
+
async flush(): Promise<void> {
|
|
133
|
+
// Write an empty string to ensure all previous writes are flushed
|
|
134
|
+
return new Promise<void>((resolve) => {
|
|
135
|
+
this.xterm.write("", () => resolve());
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Flush and get viewport - convenience method for tests
|
|
141
|
+
*/
|
|
142
|
+
async flushAndGetViewport(): Promise<string[]> {
|
|
143
|
+
await this.flush();
|
|
144
|
+
return this.getViewport();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Get the visible viewport (what's currently on screen)
|
|
149
|
+
* Note: You should use getViewportAfterWrite() for testing after writing data
|
|
150
|
+
*/
|
|
151
|
+
getViewport(): string[] {
|
|
152
|
+
const lines: string[] = [];
|
|
153
|
+
const buffer = this.xterm.buffer.active;
|
|
154
|
+
|
|
155
|
+
// Get only the visible lines (viewport)
|
|
156
|
+
for (let i = 0; i < this.xterm.rows; i++) {
|
|
157
|
+
const line = buffer.getLine(buffer.viewportY + i);
|
|
158
|
+
if (line) {
|
|
159
|
+
lines.push(line.translateToString(true));
|
|
160
|
+
} else {
|
|
161
|
+
lines.push("");
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return lines;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Get the entire scroll buffer
|
|
170
|
+
*/
|
|
171
|
+
getScrollBuffer(): string[] {
|
|
172
|
+
const lines: string[] = [];
|
|
173
|
+
const buffer = this.xterm.buffer.active;
|
|
174
|
+
|
|
175
|
+
// Get all lines in the buffer (including scrollback)
|
|
176
|
+
for (let i = 0; i < buffer.length; i++) {
|
|
177
|
+
const line = buffer.getLine(i);
|
|
178
|
+
if (line) {
|
|
179
|
+
lines.push(line.translateToString(true));
|
|
180
|
+
} else {
|
|
181
|
+
lines.push("");
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return lines;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Clear the terminal viewport
|
|
190
|
+
*/
|
|
191
|
+
clear(): void {
|
|
192
|
+
this.xterm.clear();
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Reset the terminal completely
|
|
197
|
+
*/
|
|
198
|
+
reset(): void {
|
|
199
|
+
this.xterm.reset();
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Get cursor position
|
|
204
|
+
*/
|
|
205
|
+
getCursorPosition(): { x: number; y: number } {
|
|
206
|
+
const buffer = this.xterm.buffer.active;
|
|
207
|
+
return {
|
|
208
|
+
x: buffer.cursorX,
|
|
209
|
+
y: buffer.cursorY,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** Wait for TUI's throttled render pipeline to settle. */
|
|
214
|
+
async waitForRender(): Promise<void> {
|
|
215
|
+
await new Promise<void>((resolve) => process.nextTick(resolve));
|
|
216
|
+
await new Promise<void>((resolve) => setTimeout(resolve, 20));
|
|
217
|
+
await this.flush();
|
|
218
|
+
}
|
|
219
|
+
}
|