Commit graph

32 commits

Author SHA1 Message Date
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
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
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
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
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
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
a1ad8b843f added rant 2026-01-03 17:57:07 -08:00
dullfig
ab062bca18 re-writing docs and code 2026-01-03 14:48:57 -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
dullfig
48b4a2b2bd major changes to message bus, and xml listener 2026-01-01 15:05:13 -08:00
dullfig
262c14458e major changes to base, renamed base to xmlListener 2025-12-31 15:08:42 -08:00
dullfig
3ebf72bfb5 Merge remote-tracking branch 'origin/main' 2025-12-30 23:35:46 -08:00
dullfig
ed4c1c88ea major changes to base 2025-12-30 23:35:31 -08:00
dan
f3b90963b8 Replace XMLListener stub with real foundation
- Minimal, universal base for all capabilities
- Required listens_to class attribute
- Async handle() with convo_id preservation rule
- make_response() helper for thread continuity
- Explicit name, config, per-instance logger
- Clear documentation and NotImplementedError guard

This is the true substrate the entire organism will build on.
2025-12-29 12:16:03 -08:00
dullfig
4c3a5bad02 major changes to base 2025-12-28 21:14:08 -08:00
dullfig
16be31ecce test dummy file 2025-12-28 18:45:26 -08:00
dullfig
73e7457ebb Major design solidification and documentation sync — December 26, 2025 2025-12-26 16:51:19 -08:00
dullfig
e79bf4cbb6 changed agentserver.py 2025-12-25 22:03:53 -08:00
dullfig
20c11cb2c2 initial dir structure 2025-12-25 21:52:36 -08:00