Commit graph

73 commits

Author SHA1 Message Date
dullfig
ce37278dcd Fix output area to show content at bottom
- Use HSplit with filler + output to push content to bottom
- Output window uses dont_extend_height so it only takes needed space
- Empty filler expands to fill remaining space above

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:52:33 -08:00
dullfig
d59dd4968d Fix output scrolling - show only last 50 lines
Instead of trying to scroll the window, just display the most
recent lines that fit on screen. Full history is kept but only
the last 50 lines are rendered.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:50:07 -08:00
dullfig
80f8226b1d Add threads list to context buffer get_stats() 2026-01-11 14:46:27 -08:00
dullfig
abc5902b60 Fix console registry for cross-module access
- Create separate console_registry module to avoid __main__ vs module import issue
- Handler now correctly finds TUI console instance
- Response output should now appear in TUI output area

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:44:10 -08:00
dullfig
161ddee138 Add debug output to trace console routing 2026-01-11 14:42:25 -08:00
dullfig
3e5803d41b Fix FormattedText newline handling 2026-01-11 14:39:21 -08:00
dullfig
5a76797613 Add refresh loop for reliable TUI output updates
- Remove patch_stdout (was buffering until exit)
- Add 100ms refresh loop that periodically invalidates the app
- Ensures output buffer changes are displayed in real-time

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:37:02 -08:00
dullfig
cc5257d342 Fix TUI output with patch_stdout
- Add patch_stdout to capture external prints in TUI mode
- Any stdout from handlers/pump appears in output area, not prompt
- Simplify response handler logic

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:34:03 -08:00
dullfig
01598bd708 Remove fallback print from response handler to debug TUI output 2026-01-11 14:33:29 -08:00
dullfig
ad507cd54a Fix TUI console response display
- Add thread-safe invalidation for cross-task updates
- Fix response handler to properly route to TUI output
- Add debug output if console hook fails

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:30:36 -08:00
dullfig
6a5c047d1e Add split-screen TUI console with prompt_toolkit
New console features:
- Scrolling output area above separator line
- Status bar with organism name
- Input area at bottom
- Color-coded messages by source
- Command history with up/down arrows
- Graceful fallback to simple mode on unsupported terminals

Usage:
  python run_organism.py           # TUI mode (or fallback)
  python run_organism.py --simple  # Force simple mode

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:23:19 -08:00
dullfig
ad081d412c Fix platform.complete() to use correct LLM router API
- Import `complete` not `generate` from agentserver.llm
- Pass `model` parameter required by router
- Return response.content (string) not response object

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:05:53 -08:00
dullfig
987c6aa214 Add platform-managed PromptRegistry and LLM API
Platform architecture for trusted orchestration:
- PromptRegistry: immutable system prompts per agent, loaded at bootstrap
- platform.complete(): assembles LLM calls (prompt + history + user msg)
- Handlers use platform API, cannot see/modify prompts
- organism.yaml now supports prompt field per listener

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 13:57:51 -08:00
dullfig
d7825335eb fixing docs 2026-01-11 13:50:05 -08:00
dullfig
e23fa6a2a9 Add platform architecture design doc
Documents the trust model for context and prompt management:
- Platform as trusted orchestration layer
- Context buffer: pure message history, keyed by UUID, auto-GC
- Prompt registry: immutable, invisible to agents
- LLM call assembly: platform controls, agents request
- Handler sandbox: what agents can/cannot do

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 13:49:42 -08:00
dullfig
5fe63bf943 Add /monitor command to show recent thread messages
Shows last 20 messages from a specific thread or last 5 per thread
when using /monitor *. Color-coded by direction (console=green,
responses=cyan).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 18:32:32 -08:00
dullfig
f75aa3eee6 Add SecureConsole v3.0 with password authentication
- SecureConsole with Argon2id password hashing
- Password stored in ~/.xml-pipeline/console.key
- Protected commands require password re-entry
- Attach/detach model with idle timeout
- Fallback to simple input for incompatible terminals
- @listener message injection into pump
- Boot handler no longer sends to old console
- Response handler prints to stdout with prompt refresh

Dependencies: argon2-cffi, prompt_toolkit

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 18:24:24 -08:00
dullfig
379f5a0258 Use BufferSlot as single source of truth for handler dispatch
Handlers now receive payload references directly from the context
buffer slot rather than independent copies. Metadata is derived
via slot_to_handler_metadata() ensuring consistency.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 17:51:38 -08:00
dullfig
f195835bea Update secure console design: simplify detached mode
When detached, console changes prompt from '>' to '#' and rejects
@messages while still accepting /commands. Simpler than the ring
buffer approach - operator can still check status and re-attach.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 17:44:57 -08:00
dullfig
fc8b6608cf Add secure console design doc (v3.0)
Design for keyboard-only privileged interface:
- OOB port eliminated — privileged ops via keyboard only
- Argon2id password protection for destructive commands
- Attach/detach model with idle timeout
- Ring buffer for messages while detached

Key security properties:
- No network attack surface for privileged operations
- Password required for /restart, /kill
- Handler returns None on timeout → organism continues headless
- /attach + password to reconnect

Commands: /status /listeners /threads /buffer /config /restart
          /kill /pause /resume /attach /detach /timeout /quit

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 17:40:05 -08:00
dullfig
fc7170a02e Add context buffer - virtual memory manager for AI agents
Implements thread-scoped, append-only storage for validated payloads.
Handlers receive immutable references; messages cannot be modified
after insertion.

Core components:
- BufferSlot: frozen dataclass holding payload + metadata
- ThreadContext: append-only buffer per thread
- ContextBuffer: global manager with GC and limits

Design parallels OS virtual memory:
- Thread ID = virtual address space
- Buffer slot = memory page
- Immutable reference = read-only mapping
- Thread isolation = process isolation

Integration:
- Incoming messages appended after pipeline validation
- Outgoing responses appended before serialization
- Full audit trail preserved

This is incremental - handlers still receive copies for backward
compatibility. Next step: skip serialization for internal routing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 17:20:43 -08:00
dullfig
a5e2ab22da Add thread registry, LLM router, console handler, and docs updates
Thread Registry:
- Root thread initialization at boot
- Thread chain tracking for message flow
- register_thread() for external message UUIDs

LLM Router:
- Multi-backend support with failover strategy
- Token bucket rate limiting per backend
- Async completion API with retries

Console Handler:
- Message-driven REPL (not separate async loop)
- ConsolePrompt/ConsoleInput payloads
- Handler returns None to disconnect

Boot System:
- System primitives module
- Boot message injected at startup
- Initializes root thread context

Documentation:
- Updated v2.1 docs for new architecture
- LLM router documentation
- Gap analysis cross-check

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 16:53:38 -08:00
dullfig
8aa58715df Add TodoUntil watcher system for async confirmation tracking
Implements an observer pattern where agents can register watchers
for conditions on their thread. When the condition is met, the
agent gets "nagged" on subsequent invocations until it explicitly
closes the todo.

Key components:
- TodoRegistry: thread-scoped watcher tracking with eyebrow state
- TodoUntil/TodoComplete payloads and system handlers
- HandlerMetadata.todo_nudge for delivering raised eyebrow notices
- Integration in StreamPump dispatch to check and nudge

Greeter now demonstrates the pattern:
1. Registers watcher for ShoutedResponse from shouter
2. On next invocation, sees nudge and closes completed todos
3. Includes nudge in LLM prompt for awareness

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 16:51:59 -08:00
dullfig
8fa92b8f56 Add multi-agent flow demo with shouter listener
Demonstrates message chaining: user -> greeter -> shouter -> user

- Add ShoutedResponse payload class (ALL CAPS response)
- Add handle_shout handler that forwards to original sender
- Update GreetingResponse to track original_sender
- Fix wrap_in_envelope to add xmlns="" to payloads
- Update organism.yaml with shouter listener
- Update tests for 2-listener configuration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 10:47:09 -08:00
dullfig
82b5fcdd78 Replace MessageBus with aiostream-based StreamPump
Major refactor of the message pump architecture:

- Replace bus.py with stream_pump.py using aiostream for composable
  stream processing with natural fan-out via flatmap
- Add to_id field to MessageState for explicit routing
- Fix routing to use to_id.class format (e.g., "greeter.greeting")
- Generate XSD schemas from xmlified payload classes
- Fix xmlable imports (absolute -> relative) and parse_element ctx

New features:
- handlers/hello.py: Sample Greeting/GreetingResponse handler
- config/organism.yaml: Sample organism configuration
- 41 tests (31 unit + 10 integration) all passing

Schema changes:
- envelope.xsd: Allow any namespace payloads (##other -> ##any)

Dependencies added to pyproject.toml:
- aiostream>=0.5 (core dependency)
- pyhumps, termcolor (for xmlable)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 10:41:17 -08:00
dullfig
dc16316aed fixing docs 2026-01-08 15:49:07 -08:00
dullfig
a1e1b9a1c0 fixing docs 2026-01-08 15:35:36 -08:00
dullfig
ab207d8f0b fixing docs 2026-01-08 12:30:58 -08:00
dullfig
e314bb01e8 fixing docs 2026-01-07 20:58:31 -08:00
dullfig
f2758e5c49 fixing docs 2026-01-07 16:39:55 -08:00
dullfig
3105648fd1 fixing docs 2026-01-07 13:12:08 -08:00
dullfig
6696c06e4f fixing docs 2026-01-07 12:31:47 -08:00
dullfig
86ad3c7eb2 fixing docs 2026-01-06 19:28:25 -08:00
dullfig
e6aa9cbd61 Merge remote-tracking branch 'origin/main' 2026-01-06 19:25:47 -08:00
dullfig
2e8ed88e42 fixing docs 2026-01-06 19:24:41 -08:00
dullfig
9ae2fb608d fixing docs 2026-01-06 19:23:40 -08:00
dullfig
ed66b16821 fixing docs 2026-01-04 23:33:46 -08:00
dullfig
67c77d568e added rant 2026-01-04 22:22:17 -08:00
dullfig
a1ad8b843f added rant 2026-01-03 17:57:07 -08:00
dullfig
9a3e7df851 major realignment of docs, v2.0 now 2026-01-03 16:37:42 -08:00
dullfig
ab062bca18 re-writing docs and code 2026-01-03 14:48:57 -08:00
dullfig
9e75cfffd6 added message pump overview and yaml configuration 2026-01-02 16:02:48 -08:00
dullfig
580f32c035 added message pump overview 2026-01-02 15:46:33 -08:00
dullfig
8723a121de added self-registration and autonomous grammar generation to docs 2026-01-02 15:35:00 -08:00
dullfig
807322be3e added self-registration and autonomous grammar generation to docs 2026-01-02 15:23:02 -08:00
dullfig
3f4a6990ed added self-registration and autonomous grammar generation to docs 2026-01-02 15:20:24 -08:00
dullfig
f9304f6794 added self-registration and autonomous grammar generation to docs 2026-01-02 15:05:26 -08:00
dullfig
df7d02b5c8 creating new file for thread context 2026-01-02 00:01:20 -08:00
dullfig
8c4ee6f20f re-wrote message bus to remove return value and add run() 2026-01-01 16:18:48 -08:00
dullfig
2e682f8f6d major changes to message bus, and xml listener 2026-01-01 15:27:20 -08:00