Commit Graph

745 Commits

Author SHA1 Message Date
d71ccb95c6 fix: guards on resize handler and render loop, O_RDONLY for /dev/tty 2026-05-14 14:10:57 -04:00
55166fc9ff fix: add nil guards on w and h in tui-main before initial render
backend-size can return nil for height (especially when the /dev/tty
ioctl fallback hasn't been compiled in yet). view functions had nil
guards but the direct (- h 4) calls in tui-main's initial render
crashed before reaching them.
2026-05-14 14:04:27 -04:00
f5fdfe73d6 fix: move terminate-process inside let* scope
cat-proc and tty-in were defined by let* but the let* closed at
sleep's third ), putting them out of scope for terminate-process
and read-char. Restructured closing parens so the let* body wraps
the full loop + cleanup.
2026-05-14 14:02:59 -04:00
b6ceb2525a fix: remove useless export COLUMNS/LINES from script
SBCL strips these from the environment regardless.
2026-05-14 13:46:37 -04:00
337b8cdd86 fix: nil guards on w and h in all view functions
Prevents crash when backend-size returns nil for height.
Defaults to 80x24 if dimensions are nil or invalid.
2026-05-14 13:41:15 -04:00
c4c1629816 fix: auto-clear cl-tty cache before TUI startup
Every passepartout tui run now deletes stale cl-tty fasls,
ensuring the latest backend-size fixes (ioctl fd0, env vars,
stty size, tput) are always compiled in.
2026-05-14 13:38:56 -04:00
7cb43a953d fix: export COLUMNS LINES before exec sbcl
bash sets COLUMNS and LINES but doesn't export them to
subprocesses. Without export, SBCL's posix-getenv returns nil
and the terminal size fallback fails. Add explicit export
before the exec sbcl line.
2026-05-14 13:36:59 -04:00
39a9a3d7f2 fix: remove :force t from cl-tty quickload (causes slow startup)
The :force t forces recompilation of cl-tty and all its dependencies
(including ironclad) on every run, making startup take 30+ seconds.
Without :force t, quickload uses timestamp-based caching. If cl-tty
source changes, delete ~/.cache/common-lisp manually.
2026-05-14 13:24:19 -04:00
4bfb407094 fix: draw hint before prompt so cursor stays at input line
view-input drew prompt first (row h-3), then hint (row h-2),
leaving the cursor at end of the hint line after 'complete'.
Typed characters appeared there. Swapped order: hint first,
prompt last, so cursor ends at the > prompt.
2026-05-14 12:51:21 -04:00
d5b4c8c8f0 fix: draw input after separator so cursor stays at input line
The render order was: view-chat → view-input → draw-separator.
After the separator draw, the cursor ended up at row h-4 (the
separator line). Typed characters echoed by the terminal appeared
on the separator line, above the > prompt. Swapped so the input
line is drawn last: view-chat → draw-separator → view-input.
2026-05-14 12:48:01 -04:00
c0d0ddfeec fix: use stdbuf -o0 cat for unbuffered pipe input, remove debug
- Changed cat subprocess to stdbuf -o0 cat (unbuffered output)
  so characters arrive immediately through the pipe
- Added cat PID to startup messages for diagnostics
- Removed pipe debug logging (trace.log, pipe.log)
- Cat pipe input confirmed working: read-char returns #\a, #\b, #\Newline
- Remaining issue: frame-message format mismatch with daemon
  (pre-existing, not related to input changes)
2026-05-14 12:43:00 -04:00
b9a4318ef8 reorg: tangle to XDG, remove stale lisp files, fix tui input
- Changed all 50 org file :tangle targets from ../lisp/ to
  ~/.local/share/passepartout/lisp/ (XDG data dir)
- Removed 49 generated .lisp files from project lisp/ directory
- Removed tests/system-integration-tests.lisp (generated)
- Removed lisp/*.fasl (compiled, stale)
- Updated core-manifest.org to tangle .asd to XDG root
- Remapped quicklisp symlink: local-projects/passepartout → XDG

TUI fixes in channel-tui-main.org:
- Removed with-raw-terminal (stty raw breaks fd 0 reads in this SBCL)
- Use cat subprocess + pipe for keyboard input (via :input :interactive)
- Blocking read-char on pipe with with-timeout 0.1s for daemon processing
- Key events queued via drain-queue alongside daemon messages
- Full dialog key routing (Escape, Up/Down, Enter, filters, Backspace)
- SIGWINCH resize handling
- Post-handshake backend-size re-query
- Daemon version in status bar (was v0.5.0 hardcoded)
- Handshake version stored in state, no add-msg
- :daemon-version and :size-queried in state plist
- view-status uses draw-rect for background
- Test section gated with #+passepartout-tests
2026-05-14 12:34:06 -04:00
0ad9d3bdb5 fix: threaded keyboard reader, key events via queue
- Keyboard input now runs in a separate bordeaux-thread that
  reads from fd 0 via blocking read-char and queues :key events
- Main loop processes :key events from drain-queue alongside
  :daemon and :disconnected events
- Removed blocking read-char/with-timeout from main loop (caused
  freeze when with-timeout couldn't interrupt the read syscall)
- Added full dialog key routing in the key event handler
- Added debug logging for key events (tui-keys.log)
2026-05-14 10:32:46 -04:00
a8f8d841a4 fix: re-query backend-size before initial render
The first backend-size query may return 80x24 before the terminal
settles. Re-query immediately before the initial render to pick up
the actual terminal dimensions.
2026-05-14 10:12:31 -04:00
ec38589237 fix: blocking read-char with with-timeout, dialog key routing
- Replaced read-event (broken on fd 0 in this SBCL) with direct
  blocking read-char wrapped in sb-ext:with-timeout 0.1
- This gives reliable key input + periodic wakeup for daemon messages
- Added dialog key routing back (escape to close, up/down, enter to
  select, character filtering, backspace)
- Fixed # of closing parens to match new structure
- Removed debug logging
2026-05-14 09:41:43 -04:00
21d054bc38 fix: use read-event with ctrl flag, add resize handling
- Switched back to read-event be :timeout 0.01 for proper key-event
  dispatch with the ctrl/alt/shift flags
- Fixed Ctrl+P/B/Q/L dispatch: check key-event-ctrl flag to
  construct :CTRL-<key> keyword symbol (read-event returns :P + ctrl=t,
  not :CTRL-P)
- Added :size-queried state flag and post-handshake backend-size re-query
- Removed hardcoded Connected v0.5.0 message from connect-daemon
- Removed Connected v0.7.2 system message (version shown in status bar)
- view-status now uses draw-rect for background (instead of dotimes loop)
- Added startup message showing backend type and detected dimensions
2026-05-14 09:31:16 -04:00
adca69d29c fix: remove hardcoded v0.5.0, show daemon version in status bar
- Removed connect-daemon's hardcoded "* Connected v0.5.0 *" message
  (fired before handshake arrived, was always stale)
- Added :daemon-version slot to state plist, filled by handshake handler
- view-status now shows version: "● passepartout v0.7.2 msgs:N Rules:N"
- passepartout script: force cl-tty recompile (:force t) to pick up
  CSI positioning, ioctl sizing, and detection fixes
2026-05-14 09:11:22 -04:00
1884372660 fix: use blocking read-char via listen for reliable input
read-char-no-hang on fd 0 streams never returns data because
sb-unix:unix-simple-poll on fd 0 returns NIL in this SBCL
environment. Switched to (listen tty) + (read-char tty) which
blocks until a key is pressed — correct interactive TUI behavior.
Also switched from (open "/dev/tty") to
(sb-sys:make-fd-stream 0 :input t :buffering :none) to directly
read from stdin.
2026-05-14 09:02:02 -04:00
11cb466d4f fix: add SIGWINCH resize handling for /dev/tty input path
Main loop now checks cl-tty.input::*terminal-resized-p* on every
iteration. When set (by SIGWINCH handler), re-queries backend-size
and marks all regions dirty for re-render.
2026-05-14 08:56:00 -04:00
226f979d38 fix: /dev/tty input, gate test code, fix code-char bug
- Replaced cl-tty read-event with direct read-char-no-hang from
  /dev/tty for reliable input (avoids unix-simple-poll fd 0 issue)
- Added (let ((tty ...)) wrapper to open /dev/tty once at startup
- Fixed (code-char raw-ch) bug: raw-ch is already a CHARACTER
- Fixed one extra close paren that closed (let ((ch ...)) early
- Gated fiveam test section behind #+passepartout-tests reader
  conditional to prevent crash on TUI startup when fiveam not loaded
2026-05-14 08:53:21 -04:00
a9705253a5 fix: restore read-event for reliable input, working TUI
- Replaced read-char-no-hang/stdin-input with cl-tty read-event
  (blocks until data, works regardless of --load stream)
- Added initial render before main loop via direct-to-backend
- Added read-event resize handling
- Removed stale fasl/crash/theme files
- Fixed paren balance in tui-main
- TUI starts, accepts input, daemon responds (msgs:3->4)
- 237 tests pass
2026-05-13 20:46:44 -04:00
ce3e8ed44c fix: use read-char-no-hang instead of cl-tty read-raw-byte
- Replaced read-event/read-raw-byte with read-char-no-hang from
  *standard-input* for reliable non-blocking terminal input
- Added escape sequence decoding (CSI sequences for arrows, PageUp/Dn,
  Home, End, F-keys)
- Added Ctrl+letter handling (0x01-0x1a mapped to :CTRL-X keywords)
- Added direct key dispatch for Ctrl+P (palette), Ctrl+B (sidebar),
  Ctrl+L (redraw), Ctrl+Q (quit), Ctrl+D/F/G, PageUp/Dn, Home/End
- Fixed cl-tty read-raw-byte to check poll result before reading
- Initial render before main loop so startup messages appear immediately
- All 237 tests pass
2026-05-13 20:23:51 -04:00
7d3dc479eb fix: initial render before loop, restore read-event timeout=0
- Added initial render (backend-clear + view-all) before main loop
  so startup messages appear immediately
- Restored read-event with :timeout 0 from git HEAD
- Removed dispatch-key-event from main loop (simplified to direct on-key)
- Removed :enter from :local keymap (handled directly in on-key)
- Retained direct-to-backend rendering (no framebuffer)
- Retained msgs count in status bar for debugging
- 237/237 tests pass
2026-05-13 20:09:40 -04:00
35fbf1d418 bump passepartout: v0.9.0 Warm TUI Redesign fixes 2026-05-13 19:49:45 -04:00
b17c501231 fix: replace draw-rect on framebuffer with draw-text
draw-rect has no method on raw arrays (only on framebuffer-backend,
simple-backend, modern-backend). Three calls in view-status, view-chat,
and view-sidebar passed the framebuffer array to draw-rect, causing
'no applicable method' crash on startup.

Replaced with (draw-text ... (make-string w #\Space) nil bg) which
fills the same area with background spaces.
2026-05-13 19:20:00 -04:00
15d16fd520 bump passepartout: v0.9.0 Warm TUI Redesign — blank slate
Complete rewrite of the TUI with warm amber/gold color palette and
clean three-zone layout (chat top, input bottom, status very bottom).

1. Layout restructure: input at y=h-3, hint at y=h-2, status at y=h-1
2. Warm palette: 20-key amber/gold theme, 8 warm presets
3. Readline keybindings: Ctrl+A/E/U/W/K/Y/L/D/F/G in :global keymap
4. Chat messages: user boxes (┌─└─), agent headers, collapsible tools
5. Command palette: Ctrl+P top-centered overlay, warm colors
6. Sidebar: Ctrl+B toggle, right panel with focus/rules/context/MCP
7. Keybindings: :ctrl+x, :?, mouse wheel support
8. Search: existing /search with match highlighting
9. Help overlay: ? shows keybinding and command reference
2026-05-13 19:13:20 -04:00
e27cffa4e0 fix: all 21 TUI test failures — KEY_ENTER, KEY_BACKSPACE, Escape handling
- KEY_ENTER (343) and KEY_BACKSPACE (263) were not handled in on-key
  causing Enter/Backspace to silently fail in tests using ncurses keycodes
- Escape (27) was not matched for streaming interrupt in on-key
- theme-color test expected keyword :white but function returns hex string
2026-05-13 18:08:29 -04:00
b5a07a5dcb bump passepartout: v0.8.0 TUI upgrade — all 6 items
Minibuffer (dialog stack), conversation view (ScrollBox+Markdown),
command palette (Ctrl+P), sidebar (6 panels, Ctrl+B), status bar
(degraded-mode signaling), keybinding layer (defkeymap).
2026-05-13 17:57:54 -04:00
60ce9c894c fix: backend-clear called with framebuffer instead of backend
Main loop was calling (backend-clear curr-fb) where curr-fb is a
framebuffer array. Changed to (backend-clear be) using the cl-tty
backend, which writes the terminal clear escape sequence.
2026-05-13 16:29:50 -04:00
36e7d51fce fix: add missing keyword clause in printable branch of on-key
The revert removed the (keyword ...) clause from the typecase in
on-key's printable branch. Keyword symbols from the main loop
(:a, :h, etc.) fell through to (t nil), making all character input
silently ignored. Typing and sending now works correctly.
2026-05-13 16:25:37 -04:00
af4d81ec9f fix: add word-wrap function, complete TUI migration
- Add missing word-wrap function (was declared in contract but never defined)
- TUI now renders correctly: draw-text on framebuffer arrays works
- Daemon connection verified
- All three view functions (status, chat, input) call draw-text correctly
2026-05-13 16:06:05 -04:00
79896c5ffd fix: bypass ASDF compile for TUI load, use direct compile-file+load 2026-05-13 14:53:27 -04:00
4b60e8c544 fix: stty graceful failure, backend-size TYPE-ERROR safety net
- cl-tty stty calls now use :ignore-error-status t (works in PTY/piped env)
- backend-size wraps in ignore-errors with 80x24 fallback in resize handler
- Both fixes enable TUI to run in environments without full terminal capabilities
2026-05-13 14:21:57 -04:00
885fc3f92e fix: resolve TUI compilation errors, replace ST calls with GETF
- Remove dead croatoan-to-tty-event keymap dispatch clause from on-key
- Replace all (st :key) with (getf *state* :key) and all
  (setf (st :key) val) with (setf (getf *state* :key) val)
  to avoid SBCL cross-file SETF expander issues (239 replacements)
- Fix redraw arity: called with 4 args but defined with 3
- TUI now loads, initializes, and connects to daemon successfully
2026-05-13 14:04:25 -04:00
6e69c4a724 v0.8.0: complete cl-tty TUI migration — remove all Croatoan deps
- Replace numeric key code dispatch with cl-tty keyword events
- Replace Croatoan code-key/key-name normalization with direct keyword dispatch
- Update main loop to construct Ctrl-key keywords from cl-tty key-event modifiers
- Remove croatoan-to-tty-event compatibility shim and its test
- Remove duplicate Esc handling from main loop (now handled by on-key)
- Update all documentation contracts, prose, docstrings to remove Croatoan refs
- Remove :croatoan from package dependencies
- All event handling now goes through cl-tty keymaps or keyword dispatch
2026-05-13 12:46:43 -04:00
761678bbd6 docs: trim roadmap to v1.0.0, move v2.0.0+ to stoa
Cut v2.0.0 (Lisp Machine Emergence), v3.0.0+ (Cannibalization), v4.0.0+
(Native Inference, Hardware, True Agency) from passepartout roadmap.
These belong to Stoa — the body/environment layer. Passepartout now
only tracks the path to Neurosymbolic Maturity (v1.0.0).
2026-05-13 11:48:08 -04:00
2d18fa4525 docs: port TUI roadmap to cl-tty, mark Emacs as secondary client
v0.8.0: Information Radiator now built on cl-tty v1.1.0. Minibuffer
uses cl-tty Dialog stack. New TODO items: conversation view (ScrollBox
+ Markdown), command palette (Select), sidebar (slot system), status bar
(Box + Theme), keybindings (keymap).

v0.9.1: Emacs is now an optional secondary client, not the primary
bridge. cl-tty is the primary TUI.
2026-05-13 11:41:41 -04:00
f8d56cdeba tangle: channel-tui-view.lisp from org source
Some checks failed
Deploy (Gitea) / deploy (push) Failing after 4s
2026-05-13 09:17:51 -04:00
00211cf685 wip: unified minibuffer panel, v0.9.1 Emacs dev env in ROADMAP
- Unified minibuffer slash-command panel (panel-based wizard, settings,
  help sub-mode stack) — channel-tui state/view changes
- ROADMAP: v0.8.0 broken into atomic DONE items, v0.9.1 added with
  Emacs major mode + M-x command surface TODOs
- Semver discipline from v0.7.1 onward (X.Y.Z)
2026-05-13 09:17:48 -04:00
a8901d9675 docs: restructure ROADMAP for atomic releases, merge neurosymbolic design decisions
ROADMAP.org: restructure v0.8.1-v1.0.0 with atomic minor releases.
Eval harness at v0.9.0. 62 releases from v0.9.0 to v1.0.0.
Neurosymbolic phases (0-7) interleaved with agent features.
Lisp Machine UI deferred to v2.0.0. Cannibalization in v3.0.0+.

DESIGN_DECISIONS.org: merge neurosymbolic design rationale from
notes/ into 9-part unified document. Add McCarthy lineage,
hallucination problem, five architecture options, cardinality
policies, organic ontology, ontology versioning, sufficiency
criterion, Merkle DAG, layered auth, self-preservation, MOMo
validation, competitive argument.
2026-05-13 09:17:48 -04:00
c227877302 v0.8.3: TUI stabilization — box calls, package fixes, sandbox, configure
Bug fixes:
- Fix box() calls: set color-pair before box, pass ACS default chtype integers
- Fix markdown functions: move to passepartout.channel-tui package where
  Croatoan is imported; use add-attributes/remove-attributes instead of
  :bold/:underline kwargs to add-string; call theme-color in gate-trace-lines
  to convert theme keys to Croatoan colors
- Fix sandbox: remove dex:get/dex:post from restricted symbols
  (blocked neuro-provider from loading)
- Export *log-lock* from passepartout (was unbound in jailed skill packages)
- Fix configure: always deploy to XDG, skip cp when source==dest
- Fix bash crash handler format string (~~ escaping)
- Revert test reorder in 28 files (caused package leakage in skill loader)

Design cleanup:
- Extract tui-run-screen from tui-main for clean separation
- Remove inject-stimulus alias
- Merge *backend-registry* into *probabilistic-backends*
- Fix read-framed-message whitespace DoS (4096-iteration max)
- Add *read-eval* nil to dispatcher-approvals-process read-from-string
2026-05-13 09:17:48 -04:00
8fd56dece3 v0.8.2: cleanup + prose + structure + decomposition + budget + errors
Phase 1 — dedup + hardening (~9 items):
- Remove duplicate *skill-registry* defvar from core-skills
- Merge *backend-registry* into *probabilistic-backends*, delete backend-register
- Remove inject-stimulus alias, standardize on stimulus-inject
- Add pre-eval sandbox (skill-source-scan) blocks restricted symbols before eval
- Remove dead plist-get function; remove duplicate json-alist-to-plist export
- Fix read-framed-message whitespace DoS (4096-iteration max)
- Add *read-eval* nil to dispatcher-approvals-process read-from-string (RCE)
- Add test-op to ASDF; update .asd version 0.4.3→0.7.2

Phase 2 — prose + contracts + reorder:
- Split ROADMAP: 2623→1089 lines (TODO only), CHANGELOG: 260→1528 lines (full DONE history, 14 versions reverse chron)
- Add Contracts + Overview to 6 channel files + embedding-native + programming-standards + symbolic-scope
- Reorder 28 .org files: Contract → Test Suite → Implementation (TDD order)
- Add 7-phase inline prose to think() in core-reason
- Expand USER_MANUAL: 183→461 lines (10 new sections)

Phase 3 — decomposition + export organization:
- Decompose think() into think-assemble-prompt, think-call-llm, think-parse-response orchestrator
- Organize 188 exports into 16 grouped sections by module

Phase 4 — budget enforcement + error protocol:
- Per-session budget enforcement (SESSION_BUDGET_USD env var, budget-exhausted-p, guard in think-call-llm)
- Error condition hierarchy (6 conditions: pipeline-error, llm-error, gate-error, budget-error, protocol-error)
- Restarts in loop-process: skip-signal, use-fallback, abort-pipeline
2026-05-13 09:17:48 -04:00
27d203ad67 v0.8.1: deduplication cleanup — remove duplicate defpackage/defvar blocks from programming-tools, duplicate plist-keywords-normalize from programming-lisp, duplicate *VAULT-MEMORY* from security-vault; TUI defensive fixes — add word-wrap function, wrap on-key in ignore-errors; daemon startup hardening — optional skill loads with handler-case 2026-05-13 09:17:48 -04:00
2ac87b626a v0.8.0: Information Radiator, Command Palette, TrueColor Themes, Setup Wizard
- Sidebar: permanent 42-col panel with 7 data panels (Gate Trace, Focus,
  Rules, Context gauge, Files, Cost, Protection); 4-window Croatoan layout
  at >=120 cols, toggle via Ctrl+X+B
- Command palette: Ctrl+P overlay with fuzzy-filtered categorized items,
  keyboard navigation, Enter to execute; view-palette rendering
- TrueColor themes: 4 new presets (nord, tokyonight, catppuccin, monokai)
  with 27 hex keys via theme-hex-to-rgb
- Setup wizard: Ctrl+\ /setup 4-step overlay (provider, key, memory, save)
  writing .env with in-TUI rendering
- Daemon enrichment: dispatcher block counts, cost session summary,
  modified files tracking, context usage percentage
- Daemon fixes: fboundp guards for count-tokens/provider-token-cost,
  tool registry save/restore in safety tests, SELF_BUILD_MODE cleanup
- 139 tests pass across all suites (0 failures)
2026-05-13 09:17:48 -04:00
Hermes
d77d41f3a8 fix .asd version: 0.4.3 -> 0.7.2 (was 3 releases behind)
Some checks failed
Deploy (Gitea) / deploy (push) Failing after 16s
2026-05-12 20:06:43 +00:00
138f909a33 release: v0.7.2 — checklist complete
Some checks failed
Deploy (Gitea) / deploy (push) Failing after 3s
Release checklist:
- ROADMAP: v0.7.2 section DONE with LOGBOOK, all 14 items DONE
  with LOGBOOK timestamps, Pads marked DONE
- README: 16 new Stable capability rows for v0.7.2 features,
  fixed streaming version (v0.7.1)
- CHANGELOG: v0.7.2 entry with all feature summaries
- core-transport: make-hello-message "0.7.2"
- .env.example: TAG_CATEGORIES, SELF_BUILD_MODE

Core: 92/92  TUI Main: 104/104  TUI View: 29/29  Neuro: 13/13
2026-05-08 21:54:55 -04:00
b3ce9056de v0.7.2: pads — Page Up/Down scroll by 10 lines (was 5) — TDD
Page Up/Down now scroll by 10 message lines per page (was 5).
Updated comments. Pads: PageUp tests scroll exceeds 5; PageDown
clamps to zero. Uses :ppage/:npage keywords in tests.

- channel-tui-main: PageUp/Down+10, 2 tests
- TUI Main: 104/104
2026-05-08 21:50:25 -04:00
1201b916d8 v0.7.2: tool hardening — read-only response caching — TDD
*tool-cache* hash table caches read-only tool results keyed by
tool-name-args. Cache check before execution in
action-tool-execute; cache miss → execute + store. Cache hit
skips tool execution entirely.

tool-cache-key and tool-cache-clear helpers. cache-test tool
verifies re-execution is skipped on second call.

- core-act: *tool-cache*, tool-cache-key, tool-cache-clear,
  cache check wired into action-tool-execute, 1 test
- Core: 92/92  TUI Main: 102/102

v0.7.2 complete. All 14 items + 10 refinements. 92 core, 102 TUI.
2026-05-08 21:30:09 -04:00
f7b3e20a15 v0.7.2: context debugging — /context why + /context dropped — TDD
/context why <id> now shows full memory object details: parent,
children count, hash prefix, title from attributes.

/context dropped replaced literal stub with computed estimate of
pruned messages based on token budget (msg_count * 60 vs 8192).

- channel-tui-main: enhanced both debug handlers
- TUI Main: 102/102
2026-05-08 21:26:45 -04:00
da5718b97c v0.7.2: Merkle audit — audit-verify-hash with hash integrity check — TDD
audit-verify-hash counts total objects and those with missing/empty
hashes. /audit verify uses it to report VERIFY PASS or MISSING
HASHES count. fboundp-guarded.

- core-memory: audit-verify-hash fn, 1 test
- channel-tui-main: updated /audit verify handler
- Core: 90/90  TUI Main: 102/102
2026-05-08 21:24:20 -04:00