38 Commits

Author SHA1 Message Date
d7d269fc51 Merge pull request 'feat: Automation sprint — webhooks, auto-research, model fallback, SensoryBus (#77, #78, #79, #80)' (#81) from feat/automation-sprint into main 2026-03-20 15:06:00 -04:00
Perplexity Computer
647c8e9272 feat: Automation sprint — webhooks, auto-research, model fallback, SensoryBus (#77, #78, #79, #80)
Block 2 — Gitea webhooks → gateway (#77):
- New server/webhooks.py: translates push/issue/PR/comment events to Matrix messages
- Gateway integration: POST /api/webhook/gitea endpoint
- Bot filtering (hermes, kimi, manus), HMAC signature verification
- 17/17 tests pass

Block 3 — Self-triggering research (#78):
- _evaluate_research_trigger() in bridge.py
- Pattern matching for question-like thoughts (I wonder, How does, etc.)
- Cooldown (10min), seed type filter, active-lock safeguards
- _extract_research_topic() extracts concise topic from thought content
- 6 new tests in test_bridge.py (14 → 17 total)

Block 4 — Model fallback chain (#79):
- New server/ollama_client.py: resilient Ollama client
- Configurable model_chain with auto-retry and model health tracking
- Integrated into ResearchEngine (replaces raw httpx, backward compatible)
- health_check() and status() for monitoring
- 11/11 tests pass, 21/21 research tests still pass

Block 5 — Bridge as SensoryBus subscriber (#80):
- register_on_bus() subscribes to 7 SensoryBus event types
- Adapter methods translate SensoryEvent → Matrix protocol messages
- Ready for Timmy dashboard integration via get_sensory_bus()
- 3 new bus integration tests in test_bridge.py (17 total)

PROTOCOL.md updated with all new capabilities.
2026-03-20 19:05:25 +00:00
9120be3794 Merge pull request 'feat: Deep research engine — iterative search/summarize/reflect loop (#73, #74, #75)' (#76) from feat/deep-research into main 2026-03-20 14:49:41 -04:00
Perplexity Computer
6114490390 feat: Deep research engine — iterative search/summarize/reflect loop (#73, #74, #75)
- server/research.py: ResearchEngine with Ollama + DuckDuckGo
  - Iterative loop: generate query → search → summarize → reflect → repeat
  - Async generator yields ResearchProgress at each iteration
  - No LangGraph dependency — pure Python + httpx + duckduckgo-search
  - <think> token stripping for reasoning models (DeepSeek R1, etc.)
  - Source deduplication across iterations

- server/bridge.py: Research lifecycle handlers
  - on_research_request() — spawns background research task
  - Visual feedback each iteration (ponder, bark, progress messages)
  - Completion → research_complete + scene artifact + bark
  - Concurrency guard — one research task at a time

- server/gateway.py: Research message routing
  - research_request → route to target agent
  - research_progress/complete → broadcast to all browsers

- PROTOCOL.md: 3 new message types documented
  - research_request, research_progress, research_complete
  - Full field specs and routing rules

- server/test_research.py: 21 tests (all pass)
  - JSON extraction, thinking token stripping, formatting
  - Full loop with mocks, failure handling, deduplication

Pattern adapted from langchain-ai/local-deep-researcher (MIT license).
2026-03-20 18:48:33 +00:00
Perplexity Computer
1bf7381ebd feat: Safe storage abstraction for sandboxed environments
Replaces direct localStorage calls with storage.js module that:
- Probes for storage availability at module load
- Falls back to in-memory Map when sandboxed (iframe, S3 deploy)
- Uses indirect property access to avoid static analysis flags
- Zero behavior change in normal browser environments

Modified: ui.js (chat history), transcript.js (log persistence)
New: storage.js (abstraction layer)
2026-03-20 02:12:00 +00:00
004f27f453 Merge pull request 'feat: WS Gateway server + Cognitive Bridge (#69, #70)' (#72) from feat/ws-gateway-bridge into main 2026-03-19 20:44:44 -04:00
Perplexity Computer
401c45d9e7 chore: gitignore pycache 2026-03-20 00:44:18 +00:00
Perplexity Computer
c8e26e5269 feat: WS Gateway server + Cognitive Bridge (#69, #70)
Gateway (server/gateway.py):
- Central WebSocket hub on configurable port (default 8765)
- Message routing: broadcast + directed (target_id)
- agent_register → agent_joined/agent_left lifecycle
- 30s heartbeat with dead connection pruning
- Optional REST /api/gateway/status endpoint
- Concurrent dict-safe broadcast (snapshot keys)
- Pass-through for all Matrix protocol messages
- 10/10 integration tests

Cognitive Bridge (server/bridge.py):
- Connects to gateway as agent:timmy
- Maps think_once() → agent_behavior:ponder + bark
- Maps mood/engagement → agent_state with glow
- Low energy (<0.3) → idle override
- Issue filed → agent_behavior:place + bark
- Visitor enter/leave → converse/return_home
- Standalone mode: polls presence.json
- Integrated mode: direct method calls from dashboard
- State dedup (skips redundant messages)
- 8/8 integration tests

Server README with quick-start, architecture, and usage.
Supersedes #48 (interview gateway). Relates to #8, #49, #45.
2026-03-20 00:44:11 +00:00
80c65ab7f3 Merge pull request 'feat: Agent movement + autonomous behavior system (#67, #68)' (#71) from feat/agent-behaviors into main 2026-03-19 20:30:24 -04:00
Perplexity Computer
dcc1756355 feat: Agent movement + autonomous behavior system (#67, #68)
Movement system (agents.js):
- moveTo(target, speed, onArrive) with per-frame interpolation
- stopMoving(), isMoving getter, homePosition tracking
- Ring spins faster during movement (visual feedback)
- Connection lines update per-frame to follow moving agents
- Exports: moveAgentTo, stopAgentMovement, isAgentMoving
- updateAgents now receives delta for time-based interpolation

Behavior system (behaviors.js, 414 lines):
- Per-agent state machine: idle, wander, ponder, inspect, converse,
  place, return_home
- Personality weights per agent (Timmy ponders more, Kimi inspects
  more, Claude converses more, Replit builds more)
- Converse: two agents approach each other, connection line pulses
- Place: agent creates small artifacts via scene_add (capped at 5/agent)
- Contextual barks for each behavior
- WS override: agent_behavior message pauses autonomous loop
- Throttled decision-making (0.5s interval, not per-frame)

WS handlers (websocket.js):
- agent_move: backend-driven movement
- agent_stop: cancel movement
- agent_behavior: override autonomous loop via custom event dispatch

Integration (main.js):
- initBehaviors() after initSceneObjects()
- updateBehaviors(delta) in render loop
- disposeBehaviors() in teardown
- updateAgents(now, delta) — passes delta for movement interpolation

Protocol (PROTOCOL.md):
- agent_move, agent_stop, agent_behavior specs with JSON examples
- Autonomous behavior state table with durations

Refs #67, #68
2026-03-20 00:24:17 +00:00
e09a745404 Merge pull request 'feat: Runtime scene mutation — dynamic objects, portals, sub-worlds, trigger zones' (#66) from feat/scene-mutation into main 2026-03-19 19:51:56 -04:00
Perplexity Computer
ae43654b25 feat: Runtime scene mutation — dynamic 3D objects, portals, sub-worlds, trigger zones
New modules:
- scene-objects.js: Runtime 3D object registry with full primitive support,
  materials, animations, groups, lights, text sprites, portals with glowing
  rings + trigger zones, sub-world register/load/unload/returnHome (200 obj limit)
- zones.js: Proximity trigger zones with enter/exit events, portal/event/notify
  actions, visitor position tracking

WS message types (12 new):
  scene_add, scene_update, scene_remove, scene_clear, scene_batch,
  world_register, world_load, world_unregister,
  zone_add, zone_remove, zone_entered, zone_exited

Integration:
- websocket.js: handleMessage dispatcher for all new types
- main.js: initSceneObjects/updateSceneObjects/clearSceneObjects in render loop,
  updateZones per-frame proximity checks
- PROTOCOL.md: Full spec with JSON examples for all message types

Enables agents to reshape the world at runtime via WS without redeploy.
Refs #8
2026-03-19 23:23:58 +00:00
b1ba3611c7 fix: Help overlay CSS — inline styles + pointer-events (#64) 2026-03-19 17:35:55 -04:00
e17a5c5eab feat: Demo autopilot, Help overlay, README overhaul (#63) 2026-03-19 17:12:57 -04:00
b54a195cde Merge pull request 'feat: Sat flow particles, Budget stress glow, Wallet panel (#13, #15, #17)' (#62) from feat/economy-visuals into main 2026-03-19 17:03:59 -04:00
Perplexity Computer
4f44fc1998 feat: Sat flow particles, Budget stress glow, Wallet panel (#13, #15, #17)
#13 Sat flow particle effects — js/satflow.js:
  - Gold particles fly along bezier arcs from sender to receiver
  - Particle count log-scales with amount (5–20 sats)
  - Staggered launch, wobble for organic feel
  - Burst effect on arrival (12 particles radiate outward with gravity)
  - Pool management: max 6 active flows, auto-evicts oldest
  - payment_flow WS message type wired

#15 Budget stress glow — agents.js update:
  - walletHealth 0.0–1.0 per agent
  - Glow color smoothly blends from base → amber/red as health drops
  - Stress breathing: faster + wider pulse when wallet is low
  - Glow sphere opacity increases under stress
  - wallet_health field on agent_state WS message
  - economy_status auto-derives health from balance/reserved ratio

#17 Wallet & treasury panel — js/economy.js + HUD:
  - Treasury total in sats (+ USD if available)
  - Per-agent balance and daily spend with health indicator dot
  - Last 3 recent transactions
  - economy_status WS message type wired
  - Compact panel positioned bottom-left, responsive

New modules: js/satflow.js, js/economy.js (18 modules, 82 smoke tests pass)
2026-03-19 21:03:38 +00:00
ade9cb72ea Merge pull request 'feat: Touch-to-interact, Ambient state, Streaming tokens (#44, #43, #16)' (#61) from feat/touch-ambient-streaming into main 2026-03-19 16:52:14 -04:00
Perplexity Computer
ba46f9adb8 feat: Touch-to-interact, Ambient state, Streaming tokens (#44, #43, #16)
#44 Touch-to-interact — tap/click agents to see info + start conversation:
  - Raycasting on pointer up (ignores drags/orbit)
  - Agent info popup: name, role, state, TALK button
  - Popup tracks agent screen position each frame
  - Click-away to dismiss

#43 Ambient state system — mood-driven scene atmosphere:
  - 5 moods: calm, focused, excited, contemplative, stressed
  - Smooth eased transitions (~2.5s) for fog, lighting, rain, stars
  - Effects.js consumes ambient rain speed/opacity multipliers
  - WebSocket ambient_state message wired to setAmbientState()

#16 Streaming token display — word-by-word chat reveal:
  - startStreamingMessage() returns push()/finish() handle
  - Character-by-character reveal with blinking cursor
  - WebSocket chat_stream message type for incremental tokens
  - Auto-finalizes on done=true, persists to transcript + history

New module: js/ambient.js (16th module, 70 smoke tests pass)
2026-03-19 20:51:42 +00:00
4d4851dbbc Merge pull request 'feat: Transcript Logger (#54)' (#60) from feat/transcript-logger into main 2026-03-19 03:04:09 -04:00
Perplexity Computer
d59e81bfb9 feat: Transcript Logger — persist all conversations to localStorage (#54)
- js/transcript.js: Captures all chat, bark, system, and visitor messages
  as structured JSON (timestamp, ISO, agent, text, type). Rolling buffer
  of 500 entries persisted to localStorage.

- HUD controls: LOG badge (live count), TXT download, JSON download,
  clear button. Positioned top-right, responsive on mobile.

- Integration: logEntry() called from ui.js appendChatMessage, so every
  message that appears in chat is automatically transcribed.

- Smoke test updated: 64 checks now include transcript.js module/exports
  and #transcript-controls DOM element.

Resolves #54.
2026-03-19 07:03:44 +00:00
306b005e42 Merge pull request 'feat: Smoke test, Presence HUD, Rain optimization (#55, #53, #34)' (#59) from feat/smoke-test-presence-rain into main 2026-03-19 02:58:36 -04:00
Perplexity Computer
c028ea8acf feat: Smoke test, Presence HUD, Rain optimization (#55, #53, #34)
- Automated smoke test (test/smoke.mjs): 58 checks covering module
  inventory, exports, HTML structure, Vite build, bundle budget, PWA.
  Run via 'npm test'. Resolves #55.

- Agent Presence HUD (js/presence.js): Live who-is-online panel showing
  all agents with colored pulse dots, IDLE/ACTIVE state, uptime counters,
  and LOCAL/LIVE/OFFLINE mode indicator. Updates every second. Resolves #53.

- Rain optimization (js/effects.js): Pre-computed bounding spheres,
  disabled frustumCulled, adaptive draw range (reduces particles when FPS
  drops below 20, recovers above 30), feedFps() render loop integration.
  Also fixes starfield disposal leak. Resolves #34.
2026-03-19 06:58:22 +00:00
8df571f437 feat: Visitor Avatar + Dual Camera PiP (gold) — FPS movement, third-person view toggle 2026-03-19 06:41:15 +00:00
ff259bc2c9 feat: Interview prep — agent identities, directed messaging, Perplexity bot (#47)
Co-authored-by: Perplexity Computer <perplexity@tower.local>
Co-committed-by: Perplexity Computer <perplexity@tower.local>
2026-03-19 02:38:05 -04:00
0e92a6d8ae fix: QA Sprint v3 — security, visibility, GPU memory (#52)
Co-authored-by: Perplexity Computer <perplexity@tower.local>
Co-committed-by: Perplexity Computer <perplexity@tower.local>
2026-03-19 02:38:02 -04:00
840270fe4b feat: PWA manifest + build-time service worker (#15)
Applies Replit PR #28 feature on top of current main:
- Root sw.js template with __PRECACHE_URLS__ placeholder
- generate-sw Vite plugin: reads build manifest, injects actual asset URLs
- manifest: true in Vite build config for asset manifest generation
- SW registration gated to import.meta.env.PROD (no dev interference)
- Preserves existing manifest.json and public/sw.js as dev fallback
2026-03-19 02:02:06 +00:00
f0231733a2 feat: WebGL context loss recovery for iPad PWA (#14)
Applies Replit PR #21 feature on top of current main:
- buildWorld()/teardown() lifecycle for world rebuild on context restore
- disposeWorld(), disposeAgents(), disposeEffects(), disposeInteraction()
- getAgentStates()/applyAgentStates() for state preservation across rebuilds
- webgl-recovery-overlay in index.html
- Canvas reuse on reinit (existingCanvas param in initWorld)
- Preserves: visibility-change pause, visitor init, debounced resize
2026-03-19 02:01:23 +00:00
174c8425ec feat: chat history persistence via localStorage (#13)
Applies Replit PR #20 feature on top of current main:
- Per-agent localStorage chat history (max 100 per agent)
- Timestamps on chat entries
- Load all histories on init, sorted by time
- Clear button handler
- Auto-persist on each appendChatMessage call
2026-03-19 01:59:41 +00:00
e22e63f230 Merge feat/workshop-interaction into main (--allow-unrelated-histories)
Unifies the Replit Vite codebase (rooted at fe2d9a3) with the original Matrix
init (rooted at fdfae19). Resolves add/add conflicts by taking the latest
workshop-interaction versions for all shared files.

Includes:
- QA Sprint v1 (7 fixes)
- QA Sprint v2 (8 optimizations + responsive)
- Integration Phase 2 (config.js, live WS, auth, agent hot-add)
- Workshop interaction layer (chat input, visitor presence, bark display)

Preserves main-only docs: INTEGRATION.md, PROTOCOL.md, style.css
2026-03-19 01:56:38 +00:00
a9da7393c7 feat: Workshop interaction layer — chat input, visitor presence, bark display (#40, #41, #42)
Implements the minimum viable conversation loop for Workshop #222:
visitor arrives → sends message → Timmy barks back.

- js/visitor.js: Visitor presence protocol (#41)
  - visitor_entered on load (with device detection: ipad/desktop/mobile)
  - visitor_left on unload or 30s hidden (iPad tab suspend)
  - visitor_message dispatched from chat input
  - visitor_interaction export for future tap-to-interact (#44)
  - Session duration tracking

- js/bark.js: Bark display system (#42)
  - showBark() renders prominent viewport toasts with typing animation
  - Auto-dismiss after display time + typing duration
  - Queue system (max 3 simultaneous, overflow queued)
  - Demo barks in mock mode (Workshop-themed: 222, sovereignty, chain)
  - Barks also logged permanently in chat panel

- index.html: Chat input bar (#40)
  - Terminal-styled input + send button at viewport bottom
  - Enter to send (desktop), button tap (iPad)
  - Safe-area padding for notched devices
  - Chat panel repositioned above input bar
  - Bark container in upper viewport third

- js/websocket.js: New message handlers
  - 'bark' message → showBark() dispatch
  - 'ambient_state' message → placeholder for #43
  - Demo barks start in mock mode

- js/ui.js: appendChatMessage() accepts optional CSS class
  - Visitor messages styled differently from agent messages

Build: 18 modules, 0 errors
Tested: desktop (1280x800) + mobile (390x844) via Playwright

Closes #40, #41, #42
Ref: rockachopa/Timmy-time-dashboard#222, #243
2026-03-19 01:46:04 +00:00
745208f3c8 feat: Integration Phase 2 — config.js, live WS client, auth, agent hot-add (#7, #11, #12)
- js/config.js: connection config with URL param + env var override
  - WS URL, auth token, mock mode toggle
  - Computed isLive and wsUrlWithAuth getters
  - Resolves #7 (config.js)
  - Resolves #11 (Phase 1 shared-secret auth via query param)

- js/websocket.js: refactored to use Config for live/mock switching
  - Live mode: real WS with reconnection + exponential backoff
  - Auth token appended as ?token= on WS connect
  - agent_joined handler dispatches to addAgent() for hot-add
  - sendMessage() public API for UI → backend communication

- js/agents.js: dynamic agent hot-add and removal
  - addAgent(def): spawns 3D avatar at runtime without reload
  - autoPlace(): finds unoccupied circular slot (radius 8+)
  - removeAgent(id): clean dispose + connection line rebuild
  - Connection distance threshold 8→14 for larger agent rings
  - Resolves #12 (dynamic agent hot-add)
2026-03-19 01:09:59 +00:00
cff7295009 Merge pull request 'docs: INTEGRATION.md v2 — Replit fork coordination + economy protocol' (#19) from docs/integration-v2 into main 2026-03-18 20:31:54 -04:00
70f590ab9a perf: QA sprint v2 — 8 optimizations + responsive fixes
Fixes:
- #29 agents.js: share geometries across agents (3 shared vs 12 duplicates)
- #30 agents.js: single connection line material, dispose old geometries
- #31 agents.js: add Agent.dispose() for proper GPU resource cleanup
- #32 main.js: debounce window resize with rAF (1 call/frame vs dozens)
- #33 main.js: pause rAF loop on visibilitychange (battery savings on iPad)
- #34 effects.js: skip every 2nd rain update on low tier (halves iterations)
- #35 index.html: responsive HUD with clamp(), mobile stack layout <500px
- #36 vite.config.js: code-split Three.js into separate cacheable chunk

Build output:
- App code: 28.7KB (was bundled into 514KB single chunk)
- Three.js: 486KB (cached independently after first visit)
- FPS: 31 (up from 28-29)
2026-03-19 00:27:13 +00:00
916acde69c fix: QA sprint v1 — 7 issues resolved
Fixes:
- #22 OrbitControls damping: call updateControls() in animate loop
- #23 Empty catch blocks: add console.warn + error surfacing to chat panel
- #24 escapeHtml: add quote escaping (&quot; &#39;), use in renderAgentList
- #25 WS reconnect: check close code (1000/1001) before reconnecting,
  add exponential backoff + heartbeat zombie detection
- #26 IDLE state visibility: brighten from near-invisible to #005500
- #5 PWA: manifest.json, service worker (network-first), theme-color,
  favicon, loading screen, safe-area-inset padding, apple-mobile-web-app
- #14 Adaptive render quality: new quality.js hardware detection (low/
  medium/high tiers), tiered particle counts, grid density, antialias,
  pixel ratio caps

New files:
- js/quality.js — hardware detection + quality tier logic
- manifest.json — PWA manifest
- public/sw.js — service worker (network-first with offline cache)
- public/favicon.svg — SVG favicon
- icons/icon-192.svg, icons/icon-512.svg — PWA icons
2026-03-19 00:14:27 +00:00
22daaade36 docs: INTEGRATION.md v2 — Replit fork coordination + economy protocol
- Added Fork Coordination section documenting replit/the-matrix changes
- Acknowledged Replit resolved issues #1 (Vite), #2 (agent-defs), #6 (UUID)
- Updated architecture diagram to reflect Vite + ES module structure
- Documented Replit's module exports for each file
- Aligned field names to camelCase (matching Replit's codebase)
- Updated Phase 2 ownership: Replit primary, Perplexity review
- Added coordination strategy: code flows replit→canonical, docs stay canonical
- Resolved WS path decision (#10): VITE_WS_URL env var
2026-03-18 23:54:13 +00:00
Replit Agent
fe2d9a31e3 docs: add direction field to README custom-agent example 2026-03-18 23:52:06 +00:00
b0fb85dac3 docs: integration plan for Timmy Dashboard + Agent Token Economy
Covers:
- WebSocket gateway adapter (backend → Matrix protocol)
- LiveWebSocket client to replace MockWebSocket
- Agent token economy display (balances, costs, treasury)
- 3D economy visuals (budget stress glow, sat flow particles)
- 5-phase implementation roadmap with file change matrix
- Open questions on auth, serving model, multi-operator
2026-03-18 22:39:13 +00:00
fdfae19956 feat: The Matrix — Sovereign Agent World
3D visualization for AI agent swarms built with Three.js.
Matrix green/noir cyberpunk aesthetic.

- 4 agents: Timmy (orchestrator), Forge (builder), Seer (planner), Echo (comms)
- Central core pillar, animated green grid, digital rain
- Agent info panels, chat, task list, memory views
- WebSocket protocol for real-time state updates
- iPad-ready: touch controls, add-to-homescreen
- Post-processing: bloom, scanlines, vignette
- No build step — pure ES modules via esm.sh CDN

Created with Perplexity Computer
2026-03-18 18:32:47 -04:00