14 Commits

Author SHA1 Message Date
Simon Klee 4954312d74 chore: packaging and test fixes (#1517)
pPacked parser asset paths, runtime-plugin string-literal rewrites, Node
snapshot parsing, Solid plugin file reads, SSH test retries, Node
example argv forwarding, etc. etc.
2026-09-18 11:09:57 +02:00
Simon Klee 0733b5382c runtime: support Bun 1.4 (#1400) 2026-09-04 21:09:49 +02:00
Simon Klee fa14b96ad4 node: support Node.js 26.4 and later (#1410)
Keep 26.4.0 as the minimum supported version while allowing later
releases.
2026-08-23 06:56:30 +02:00
Luke Parker 2e7f96f547 fix(core): pass transient FFI buffers directly (#1394)
## Summary

- use `buffer` ABI parameters and pass typed-array owners directly for
transient synchronous Bun FFI calls
- lower portable `buffer` parameters to Node's stable `pointer` path
while still passing owner objects directly
- keep `ptr` only for nullable, mixed native-pointer, raw `ArrayBuffer`,
callback, and retained-memory cases
- stabilize retained text-memory views through `.buffer` before
resolving their native address
- preserve raw-pointer compatibility while allowing direct buffers in
supersample, packed-buffer, matrix, and grayscale APIs
- document the Bun 1.3.14 and Bun 1.4+ ownership rules in `AGENTS.md`

## Why

A Bun `FastTypedArray` may store its data inline. Calling `ptr(view)`
captures that address, but a later first access to `view.buffer` can
move the data into separate `ArrayBuffer` storage and leave the native
address stale. Passing the owner directly lets the FFI backend borrow
the current storage for synchronous calls and allows Bun's `buffer` fast
path to keep the owner visible to the JIT.

This keeps nullable and true native-pointer parameters on `ptr`, where
`buffer` cannot represent the ABI, while avoiding pre-resolved addresses
for transient memory. Retained pointers explicitly materialize stable
backing storage before `ptr(view)` and keep the view alive for the
native lifetime.

Node 26.4's Linux optimized `buffer` trampoline delivered a null pointer
to a multi-argument audio call in CI. OpenTUI therefore maps its
portable `buffer` descriptor to Node `pointer`, whose documented
owner-borrowing path passes the same views correctly. Bun continues to
receive the `buffer` descriptor.

Related Bun investigation: oven-sh/bun#32054 and oven-sh/bun#32055.

## Testing

- `bunx bun@1.3.14 test
src/tests/ffi-borrowed-pointer-callsites.test.ts` (23 passed)
- `bun test src/tests/ffi-borrowed-pointer-callsites.test.ts` on Bun 1.4
canary (23 passed)
- `bun run test:js` (5,397 passed, 23 skipped)
- `bun run test:js:node` with Node 26.4.0 (4,665 passed, 6 skipped)
- `bun run test:dist`
- `bun run build:lib`
- `bun run fmt:check`
- `bun run lint`
2026-08-20 15:42:54 +02:00
Simon Klee cdd15e6c31 agents: align guidance with current workflows (#1266)
I tried rewriting the `AGENTS.md` around the workflows and failure modes
that recur in
current OpenTUI development.

I had opencode look at:

- The most recent 50 commits, especially runtime portability, native
lifecycle,
  renderer behavior, terminal width, and FFI changes.
- My OpenCode sessions to identify recurring agent mistakes and
unnecessary
  abstractions.
- Current package scripts, CI workflows, development documentation, and
runtime
  implementations.

The previous guide mixed project-specific constraints with generic
TypeScript advice. I think many of these were stale.

The replacement keeps the guide to that cannot be inferred from nearby
code: ownership across TypeScript and Zig, display-cell width semantics,
package-specific verification, Bun and Node portability, terminal-driven
debugging, and borrowed FFI pointer lifetimes.

If this turns out to not work lets revert to the previous one and
iterate in
smaller steps.
2026-07-14 10:25:16 +02:00
Simon Klee fb3b607d8c fix(ffi): preserve borrowed pointer owners (#1221)
Pass transient buffers to FFI calls as borrowed objects so Node keeps
the JavaScript owner alive for the synchronous
native read. Raw addresses can outlive the object that backs them, which
lets GC corrupt styled text and cursor option
data

Fixes #1212
2026-07-03 11:14:25 +02:00
Simon Klee 55aefeaea7 agents: add portable instructions
Add safe type intersection and pitfalls around ABI names, pointer
handling, callbacks, and string encoding
2026-05-12 11:54:57 +02:00
Simon Klee d7ce851cbf fmt changes (#856)
swap prettier with oxfmt/oxlint, update CI, and fix the formatting/lint
issues needed for the new checks to pass.
2026-03-23 15:59:52 +01:00
AJ Bienz fa11fb72a2 refactor: replace Bun.file usages with node:fs (#776) 2026-03-09 14:25:40 +01:00
Sebastian 53017b68f4 markdown rendering via tree-sitter and code renderable (#247) 2025-10-31 18:40:38 +01:00
Sebastian 2822f5091a Textarea (#224)
reworked all text handling and rendering
2025-10-22 12:06:54 +02:00
Sebastian Herrlinger 4d7fac1275 scalable scrollbox + no native buffer retention 2025-09-05 14:59:40 +02:00
Dax Raad 6cc89cb219 rebrand 2025-07-29 11:37:38 -04:00
Sebastian Herrlinger 75ea16cb89 init 2025-07-21 18:10:22 +02:00