Initial import of NousResearch/hermes-agent
Deploy Site / deploy-vercel (push) Has been cancelled
Deploy Site / deploy-docs (push) Has been cancelled
Docker / shell lint / Lint Dockerfile (hadolint) (push) Has been cancelled
Docker / shell lint / Lint docker/ shell scripts (shellcheck) (push) Has been cancelled
Docker Build and Publish / build-amd64 (push) Has been cancelled
Docker Build and Publish / build-arm64 (push) Has been cancelled
Lint (ruff + ty) / ruff + ty diff (push) Has been cancelled
Lint (ruff + ty) / ruff enforcement (blocking) (push) Has been cancelled
Lint (ruff + ty) / Windows footguns (blocking) (push) Has been cancelled
Nix Lockfile Fix / auto-fix-main (push) Has been cancelled
Nix Lockfile Fix / fix (push) Has been cancelled
Nix / nix (macos-latest) (push) Has been cancelled
Nix / nix (ubuntu-latest) (push) Has been cancelled
OSV-Scanner / Scan lockfiles (push) Has been cancelled
Build Skills Index / build-index (push) Has been cancelled
Tests / test (1) (push) Has been cancelled
Tests / test (2) (push) Has been cancelled
Tests / test (3) (push) Has been cancelled
Tests / test (4) (push) Has been cancelled
Tests / test (5) (push) Has been cancelled
Tests / test (6) (push) Has been cancelled
Tests / e2e (push) Has been cancelled
uv.lock check / uv lock --check (push) Has been cancelled
Docker Build and Publish / merge (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
Tests / save-durations (push) Has been cancelled

This commit is contained in:
红尘
2026-05-31 09:36:58 +08:00
commit d73ff9b0fb
4188 changed files with 1614916 additions and 0 deletions
@@ -0,0 +1,35 @@
import { createContext } from 'react'
/**
* Notify Ink that the physical terminal cursor was advanced by an
* out-of-band stdout.write (e.g. the TextInput fast-echo path).
*
* This is a two-part notification — calling it updates both:
*
* 1. Ink's cached `displayCursor` (the basis log-update uses to
* compute relative cursor moves for the next frame's preamble).
* Without this, the next frame's preamble starts from a stale
* parked position and the diff is rendered N cells offset.
* This half is SKIPPED on alt-screen — every alt-screen frame
* begins with CSI H which absolutely repositions the cursor, so
* the relative-move basis is reset for free.
*
* 2. Ink's active `cursorDeclaration` (the target the cursor parks
* at after every frame, set by `useDeclaredCursor`). Without
* this, an unrelated component re-rendering before the deferred
* React state catches up would publish a stale declaration and
* visually undo the fast-echo's advance. This half applies to
* BOTH main-screen and alt-screen — on alt-screen the cursor-
* park branch in onRender emits an absolute CUP to
* `rect.x + decl.relativeX`, so a stale declaration there is
* still wrong even though displayCursor is skipped.
*
* `dx`/`dy` are deltas in terminal cells (positive = right/down,
* negative = left/up). The caller is responsible for ensuring the
* physical cursor really did move by that amount.
*/
export type CursorAdvanceNotifier = (dx: number, dy?: number) => void
const CursorAdvanceContext = createContext<CursorAdvanceNotifier>(() => {})
export default CursorAdvanceContext