Compare commits
1 Commits
fix/auto-m
...
mimo/code/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
339f7d6ef2 |
10
.gitea/workflows/auto-merge.yml
Normal file
10
.gitea/workflows/auto-merge.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
# Placeholder — auto-merge is handled by nexus-merge-bot.sh
|
||||
# Gitea Actions requires a runner to be registered.
|
||||
# When a runner is available, this can replace the bot.
|
||||
name: stub
|
||||
on: workflow_dispatch
|
||||
jobs:
|
||||
noop:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "See nexus-merge-bot.sh"
|
||||
@@ -1,203 +0,0 @@
|
||||
# FINDINGS: MemPalace Local AI Memory System Assessment & Leverage Plan
|
||||
|
||||
**Issue:** #1047
|
||||
**Date:** 2026-04-10
|
||||
**Investigator:** mimo-v2-pro (swarm researcher)
|
||||
|
||||
---
|
||||
|
||||
## 1. What Issue #1047 Claims
|
||||
|
||||
The issue (authored by Bezalel, dated 2026-04-07) describes MemPalace as:
|
||||
- An open-source local-first AI memory system with highest published LongMemEval scores (96.6% R@5)
|
||||
- A Python CLI + MCP server using ChromaDB + SQLite with a "palace" hierarchy metaphor
|
||||
- AAAK compression dialect for ~30x context compression
|
||||
- 19 MCP tools for agent memory
|
||||
|
||||
It recommends that every wizard clone/vendor MemPalace, configure rooms, mine workspace, and wire the searcher into heartbeats.
|
||||
|
||||
## 2. What Actually Exists in the Codebase (Current State)
|
||||
|
||||
The Nexus repo already contains **substantial MemPalace integration** that goes well beyond the original research proposal. Here is the full inventory:
|
||||
|
||||
### 2.1 Core Python Layer — `nexus/mempalace/` (3 files, ~290 lines)
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `config.py` | Environment-driven config: palace paths, fleet path, wing name, core rooms, collection name |
|
||||
| `searcher.py` | ChromaDB-backed search/write API with `search_memories()`, `search_fleet()`, `add_memory()` |
|
||||
| `__init__.py` | Package marker |
|
||||
|
||||
**Status:** Functional. Clean API. Lazy ChromaDB import with graceful `MemPalaceUnavailable` exception.
|
||||
|
||||
### 2.2 Fleet Management Tools — `mempalace/` (8 files, ~800 lines)
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `rooms.yaml` | Fleet-wide room taxonomy standard (5 core rooms + optional rooms) |
|
||||
| `validate_rooms.py` | Validates wizard `mempalace.yaml` against fleet standard |
|
||||
| `audit_privacy.py` | Scans fleet palace for policy violations (raw drawers, oversized closets, private paths) |
|
||||
| `retain_closets.py` | 90-day retention enforcement for closet aging |
|
||||
| `export_closets.sh` | Privacy-safe closet export for rsync to Alpha fleet palace |
|
||||
| `fleet_api.py` | HTTP API for shared fleet palace (search, record, wings) |
|
||||
| `tunnel_sync.py` | Pull closets from remote wizard's fleet API into local palace |
|
||||
| `__init__.py` | Package marker |
|
||||
|
||||
**Status:** Well-structured. Each tool has clear CLI interface and proper error handling.
|
||||
|
||||
### 2.3 Evennia MUD Integration — `nexus/evennia_mempalace/` (6 files, ~580 lines)
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `commands/recall.py` | `CmdRecall` (semantic search), `CmdEnterRoom` (teleport), `CmdAsk` (NPC query) |
|
||||
| `commands/write.py` | `CmdRecord`, `CmdNote`, `CmdEvent` (memory writing commands) |
|
||||
| `typeclasses/rooms.py` | `MemPalaceRoom` typeclass |
|
||||
| `typeclasses/npcs.py` | `StewardNPC` with question-answering via palace search |
|
||||
|
||||
**Status:** Complete. Evennia stub fallback for testing outside live environment.
|
||||
|
||||
### 2.4 3D Visualization — `nexus/components/spatial-memory.js` (~665 lines)
|
||||
|
||||
Maps memory categories to spatial regions in the Nexus Three.js world:
|
||||
- Inner ring: Documents, Projects, Code, Conversations, Working Memory, Archive
|
||||
- Outer ring (MemPalace zones, issue #1168): User Preferences, Project Facts, Tool Knowledge, General Facts
|
||||
- Crystal geometry with deterministic positioning, connection lines, localStorage persistence
|
||||
|
||||
**Status:** Functional 3D visualization with region markers, memory crystals, and animation.
|
||||
|
||||
### 2.5 Frontend Integration — `mempalace.js` (~44 lines)
|
||||
|
||||
Basic Electron/browser integration class that:
|
||||
- Initializes a palace wing
|
||||
- Auto-mines chat content every 30 seconds
|
||||
- Exposes `search()` method
|
||||
- Updates stats display
|
||||
|
||||
**Status:** Minimal but functional as a bridge between browser UI and CLI mempalace.
|
||||
|
||||
### 2.6 Scripts & Automation — `scripts/` (5 files)
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `mempalace-incremental-mine.sh` | Re-mines only changed files since last run |
|
||||
| `mempalace_nightly.sh` | Nightly maintenance |
|
||||
| `mempalace_export.py` | Export utility |
|
||||
| `validate_mempalace_taxonomy.py` | Taxonomy validation script |
|
||||
| `audit_mempalace_privacy.py` | Privacy audit script |
|
||||
| `sync_fleet_to_alpha.sh` | Fleet sync to Alpha server |
|
||||
|
||||
### 2.7 Tests — `tests/` (7 test files)
|
||||
|
||||
| File | Tests |
|
||||
|------|-------|
|
||||
| `test_mempalace_searcher.py` | Searcher API, config |
|
||||
| `test_mempalace_validate_rooms.py` | Room taxonomy validation |
|
||||
| `test_mempalace_retain_closets.py` | Closet retention |
|
||||
| `test_mempalace_audit_privacy.py` | Privacy auditor |
|
||||
| `test_mempalace_fleet_api.py` | Fleet HTTP API |
|
||||
| `test_mempalace_tunnel_sync.py` | Remote wizard sync |
|
||||
| `test_evennia_mempalace_commands.py` | Evennia commands + NPC helpers |
|
||||
|
||||
### 2.8 CI/CD
|
||||
|
||||
- **ci.yml**: Validates palace taxonomy on every PR, plus Python/JSON/YAML syntax checks
|
||||
- **weekly-audit.yml**: Monday 05:00 UTC — runs privacy audit + dry-run retention against test fixtures
|
||||
|
||||
### 2.9 Documentation
|
||||
|
||||
- `docs/mempalace_taxonomy.yaml` — Full taxonomy standard (145 lines)
|
||||
- `docs/mempalace/rooms.yaml` — Rooms documentation
|
||||
- `docs/mempalace/bezalel_example.yaml` — Example wizard config
|
||||
- `docs/bezalel/evennia/` — Evennia integration examples (steward NPC, palace commands)
|
||||
- `reports/bezalel/2026-04-07-mempalace-field-report.md` — Original field report
|
||||
|
||||
## 3. Gap Analysis: Issue #1047 vs. Reality
|
||||
|
||||
| Issue #1047 Proposes | Current State | Gap |
|
||||
|---------------------|---------------|-----|
|
||||
| "Each wizard should clone/vendor it" | Vendor infrastructure exists (`scripts/mempalace-incremental-mine.sh`) | **DONE** |
|
||||
| "Write a mempalace.yaml" | Fleet taxonomy standard + validator exist | **DONE** |
|
||||
| "Run mempalace mine" | Incremental mining script exists | **DONE** |
|
||||
| "Wire searcher into heartbeat scripts" | `nexus/mempalace/searcher.py` provides API | **DONE** (needs adoption verification) |
|
||||
| AAAK compression | Not implemented in repo | **OPEN** — no AAAK dialect code |
|
||||
| MCP server (19 tools) | No MCP server integration | **OPEN** — no MCP tool definitions |
|
||||
| Benchmark validation | No LongMemEval test harness in repo | **OPEN** — claims unverified locally |
|
||||
| Fleet-wide adoption | Only Bezalel field report exists | **OPEN** — no evidence of Timmy/Allegro/Ezra adoption |
|
||||
| Hermes harness integration | No direct harness/memory-tool bridge | **OPEN** — searcher exists but no harness wiring |
|
||||
|
||||
## 4. What's Actually Broken
|
||||
|
||||
### 4.1 No AAAK Implementation
|
||||
The issue describes AAAK (~30x compression, ~170 tokens wake-up context) as a key feature, but there is zero AAAK code in the repo. The `nexus/mempalace/` layer has no compression functions. This is a missing feature, not a bug.
|
||||
|
||||
### 4.2 No MCP Server Bridge
|
||||
The upstream MemPalace offers 19 MCP tools, but the Nexus integration only exposes the ChromaDB Python API. There is no MCP server definition, no tool registration for the harness, and no bridge to the `mcp_config.json` at repo root.
|
||||
|
||||
### 4.3 Fleet Adoption Gap
|
||||
Only Bezalel has a documented field report (#1072). There is no evidence that Timmy, Allegro, or Ezra have populated palaces, configured room taxonomies, or run incremental mining. The `export_closets.sh` script hardcodes Bezalel paths.
|
||||
|
||||
### 4.4 Frontend Integration Stale
|
||||
`mempalace.js` references `window.electronAPI.execPython()` which only works in the Electron shell. The main `app.js` (Three.js world) does not import or use `mempalace.js`. The `spatial-memory.js` component defines MemPalace zones but has no data pipeline to populate them from actual palace data.
|
||||
|
||||
### 4.5 Upstream Quality Concern
|
||||
Bezalel's field report notes the upstream repo is "astroturfed hype" — 13.4k LOC in a single commit, 5,769 GitHub stars in 48 hours, ~125 lines of tests. The code is not malicious but is not production-grade. The Nexus has effectively forked/vendored the useful parts and rewritten the critical integration layers.
|
||||
|
||||
## 5. What's Working Well
|
||||
|
||||
1. **Clean architecture separation** — `nexus/mempalace/` is a proper Python package with config/searcher separation. Testable without ChromaDB installed.
|
||||
|
||||
2. **Privacy-first fleet design** — closet-only export policy, privacy auditor, retention enforcement, and private path detection are solid operational safeguards.
|
||||
|
||||
3. **Taxonomy standardization** — `rooms.yaml` + validator ensures consistent memory structure across wizards.
|
||||
|
||||
4. **CI integration** — Taxonomy validation in PR checks + weekly privacy audit cron are good DevOps practices.
|
||||
|
||||
5. **Evennia integration** — The MUD commands (recall, enter room, ask steward) are well-designed and testable outside Evennia via stubs.
|
||||
|
||||
6. **Spatial visualization** — `spatial-memory.js` is a creative 3D representation with deterministic positioning and category zones.
|
||||
|
||||
## 6. Recommended Actions
|
||||
|
||||
### Priority 1: Fleet Adoption Verification (effort: small)
|
||||
- Confirm each wizard (Timmy, Allegro, Ezra) has run `mempalace mine` and has a populated palace
|
||||
- Verify `mempalace.yaml` exists on each wizard's VPS
|
||||
- Update `export_closets.sh` to not hardcode Bezalel paths (use env vars)
|
||||
|
||||
### Priority 2: Hermes Harness Bridge (effort: medium)
|
||||
- Wire `nexus/mempalace/searcher.py` into the Hermes harness as a memory tool
|
||||
- Add memory search/recall to the agent loop so wizards get cross-session context automatically
|
||||
- Map MemPalace search to the existing `memory`/`fact_store` tools or add a dedicated `palace_search` tool
|
||||
|
||||
### Priority 3: MCP Server Registration (effort: medium)
|
||||
- Create an MCP server that exposes search, write, and status tools
|
||||
- Register in `mcp_config.json`
|
||||
- Enable any harness agent to use MemPalace without Python imports
|
||||
|
||||
### Priority 4: AAAK Compression (effort: large, optional)
|
||||
- Implement or port the AAAK compression dialect
|
||||
- Generate wake-up context summaries from palace data
|
||||
- This is a nice-to-have, not critical — the raw ChromaDB search is functional
|
||||
|
||||
### Priority 5: 3D Pipeline Bridge (effort: medium)
|
||||
- Connect `spatial-memory.js` to live palace data via WebSocket or REST
|
||||
- Populate memory crystals from actual search results
|
||||
- Visual feedback when new memories are added
|
||||
|
||||
## 7. Effort Summary
|
||||
|
||||
| Action | Effort | Impact |
|
||||
|--------|--------|--------|
|
||||
| Fleet adoption verification | 2-4 hours | High — ensures all wizards have memory |
|
||||
| Hermes harness bridge | 1-2 days | High — automatic cross-session context |
|
||||
| MCP server registration | 1 day | Medium — enables any agent to use palace |
|
||||
| AAAK compression | 2-3 days | Low — nice-to-have |
|
||||
| 3D pipeline bridge | 1-2 days | Medium — visual representation of memory |
|
||||
| Fix export_closets.sh hardcoded paths | 30 min | Low — operational hygiene |
|
||||
|
||||
## 8. Conclusion
|
||||
|
||||
Issue #1047 was a research request from 2026-04-07. Since then, significant implementation work has been completed — far exceeding the original proposal. The core memory infrastructure (searcher, fleet tools, privacy, taxonomy, Evennia integration, tests, CI) is **built and functional**.
|
||||
|
||||
The primary remaining gap is **fleet-wide adoption** (only Bezalel has documented use) and **harness integration** (the searcher exists but isn't wired into the agent loop). The AAAK and MCP features from the original research are not implemented but are not blocking — the ChromaDB-backed search provides the core value proposition.
|
||||
|
||||
**Verdict:** The MemPalace integration is substantially complete at the infrastructure level. The next bottleneck is operational adoption and harness wiring, not new feature development.
|
||||
@@ -1,305 +0,0 @@
|
||||
# Security Audit: NostrIdentity BIP340 Schnorr Signatures — Timing Side-Channel Analysis
|
||||
|
||||
**Issue:** #801
|
||||
**Repository:** Timmy_Foundation/the-nexus
|
||||
**File:** `nexus/nostr_identity.py`
|
||||
**Auditor:** mimo-v2-pro swarm worker
|
||||
**Date:** 2026-04-10
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
The pure-Python BIP340 Schnorr signature implementation in `NostrIdentity` has **multiple timing side-channel vulnerabilities** that could allow an attacker with precise timing measurements to recover the private key. The implementation is suitable for prototyping and non-adversarial environments but **must not be used in production** without the fixes described below.
|
||||
|
||||
---
|
||||
|
||||
## Architecture
|
||||
|
||||
The Nostr sovereign identity system consists of two files:
|
||||
|
||||
- **`nexus/nostr_identity.py`** — Pure-Python secp256k1 + BIP340 Schnorr signature implementation. No external dependencies. Contains `NostrIdentity` class for key generation, event signing, and pubkey derivation.
|
||||
- **`nexus/nostr_publisher.py`** — Async WebSocket publisher that sends signed Nostr events to public relays (damus.io, nos.lol, snort.social).
|
||||
- **`app.js` (line 507)** — Browser-side `NostrAgent` class uses **mock signatures** (`mock_id`, `mock_sig`), not real crypto. Not affected.
|
||||
|
||||
---
|
||||
|
||||
## Vulnerabilities Found
|
||||
|
||||
### 1. Branch-Dependent Scalar Multiplication — CRITICAL
|
||||
|
||||
**Location:** `nostr_identity.py:41-47` — `point_mul()`
|
||||
|
||||
```python
|
||||
def point_mul(p, n):
|
||||
r = None
|
||||
for i in range(256):
|
||||
if (n >> i) & 1: # <-- branch leaks Hamming weight
|
||||
r = point_add(r, p)
|
||||
p = point_add(p, p)
|
||||
return r
|
||||
```
|
||||
|
||||
**Problem:** The `if (n >> i) & 1` branch causes `point_add(r, p)` to execute only when the bit is 1. An attacker measuring signature generation time can determine which bits of the scalar are set, recovering the private key from a small number of timed signatures.
|
||||
|
||||
**Severity:** CRITICAL — direct private key recovery.
|
||||
|
||||
**Fix:** Use a constant-time double-and-always-add algorithm:
|
||||
|
||||
```python
|
||||
def point_mul(p, n):
|
||||
r = (None, None)
|
||||
for i in range(256):
|
||||
bit = (n >> i) & 1
|
||||
r0 = point_add(r, p) # always compute both
|
||||
r = r0 if bit else r # constant-time select
|
||||
p = point_add(p, p)
|
||||
return r
|
||||
```
|
||||
|
||||
Or better: use Montgomery ladder which avoids point doubling on the identity.
|
||||
|
||||
---
|
||||
|
||||
### 2. Branch-Dependent Point Addition — CRITICAL
|
||||
|
||||
**Location:** `nostr_identity.py:28-39` — `point_add()`
|
||||
|
||||
```python
|
||||
def point_add(p1, p2):
|
||||
if p1 is None: return p2 # <-- branch leaks operand state
|
||||
if p2 is None: return p1 # <-- branch leaks operand state
|
||||
(x1, y1), (x2, y2) = p1, p2
|
||||
if x1 == x2 and y1 != y2: return None # <-- branch leaks equality
|
||||
if x1 == x2: # <-- branch leaks equality
|
||||
m = (3 * x1 * x1 * inverse(2 * y1, P)) % P
|
||||
else:
|
||||
m = ((y2 - y1) * inverse(x2 - x1, P)) % P
|
||||
...
|
||||
```
|
||||
|
||||
**Problem:** Multiple conditional branches leak whether inputs are the identity point, whether x-coordinates are equal, and whether y-coordinates are negations. Combined with the scalar multiplication above, this gives an attacker detailed timing information about intermediate computations.
|
||||
|
||||
**Severity:** CRITICAL — compounds the scalar multiplication leak.
|
||||
|
||||
**Fix:** Replace with a branchless point addition using Jacobian or projective coordinates with dummy operations:
|
||||
|
||||
```python
|
||||
def point_add(p1, p2):
|
||||
# Use Jacobian coordinates; always perform full addition
|
||||
# Use conditional moves (simulated with arithmetic masking)
|
||||
# for selecting between doubling and addition paths
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 3. Branch-Dependent Y-Parity Check in Signing — HIGH
|
||||
|
||||
**Location:** `nostr_identity.py:57-58` — `sign_schnorr()`
|
||||
|
||||
```python
|
||||
R = point_mul(G, k)
|
||||
if R[1] % 2 != 0: # <-- branch leaks parity of R's y-coordinate
|
||||
k = N - k
|
||||
```
|
||||
|
||||
**Problem:** The conditional negation of `k` based on the y-parity of R leaks information about the nonce through timing. While less critical than the point_mul leak (it's a single bit), combined with other leaks it aids key recovery.
|
||||
|
||||
**Severity:** HIGH
|
||||
|
||||
**Fix:** Use arithmetic masking:
|
||||
|
||||
```python
|
||||
R = point_mul(G, k)
|
||||
parity = R[1] & 1
|
||||
k = (k * (1 - parity) + (N - k) * parity) % N # constant-time select
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 4. Non-Constant-Time Modular Inverse — MEDIUM
|
||||
|
||||
**Location:** `nostr_identity.py:25-26` — `inverse()`
|
||||
|
||||
```python
|
||||
def inverse(a, n):
|
||||
return pow(a, n - 2, n)
|
||||
```
|
||||
|
||||
**Problem:** CPython's built-in `pow()` with 3 args uses Montgomery ladder internally, which is *generally* constant-time for fixed-size operands. However:
|
||||
- This is an implementation detail, not a guarantee.
|
||||
- PyPy, GraalPy, and other Python runtimes may use different algorithms.
|
||||
- The exponent `n-2` has a fixed Hamming weight for secp256k1's `N`, so this specific case is less exploitable, but relying on it is fragile.
|
||||
|
||||
**Severity:** MEDIUM — implementation-dependent; low risk on CPython specifically.
|
||||
|
||||
**Fix:** Implement Fermat's little theorem inversion with blinding, or use a dedicated constant-time GCD algorithm (extended binary GCD).
|
||||
|
||||
---
|
||||
|
||||
### 5. Non-RFC6979 Nonce Generation — LOW (but non-standard)
|
||||
|
||||
**Location:** `nostr_identity.py:55`
|
||||
|
||||
```python
|
||||
k = int.from_bytes(sha256(privkey.to_bytes(32, 'big') + msg_hash), 'big') % N
|
||||
```
|
||||
|
||||
**Problem:** The nonce derivation is `SHA256(privkey || msg_hash)` which is deterministic but doesn't follow RFC6979 (HMAC-based DRBG). Issues:
|
||||
- Not vulnerable to timing (it's a single hash), but could be vulnerable to related-message attacks if the same key signs messages with predictable relationships.
|
||||
- BIP340 specifies `tagged_hash("BIP0340/nonce", ...)` with specific domain separation, which is not used here.
|
||||
|
||||
**Severity:** LOW — not a timing issue but a cryptographic correctness concern.
|
||||
|
||||
**Fix:** Follow RFC6979 or BIP340's tagged hash approach:
|
||||
|
||||
```python
|
||||
def sign_schnorr(msg_hash, privkey):
|
||||
# BIP340 nonce generation with tagged hash
|
||||
t = privkey.to_bytes(32, 'big')
|
||||
if R_y_is_odd:
|
||||
t = bytes(b ^ 0x01 for b in t) # negate if needed
|
||||
k = int.from_bytes(tagged_hash("BIP0340/nonce", t + pubkey + msg_hash), 'big') % N
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 6. Private Key Bias in Random Generation — LOW
|
||||
|
||||
**Location:** `nostr_identity.py:69`
|
||||
|
||||
```python
|
||||
self.privkey = int.from_bytes(os.urandom(32), 'big') % N
|
||||
```
|
||||
|
||||
**Problem:** `os.urandom(32)` produces values in `[0, 2^256)`, while `N` is slightly less than `2^256`. The modulo reduction introduces a negligible bias (~2^-128). Not exploitable in practice, but not the cleanest approach.
|
||||
|
||||
**Severity:** LOW — theoretically biased, practically unexploitable.
|
||||
|
||||
**Fix:** Use rejection sampling or derive from a hash:
|
||||
|
||||
```python
|
||||
def generate_privkey():
|
||||
while True:
|
||||
candidate = int.from_bytes(os.urandom(32), 'big')
|
||||
if 0 < candidate < N:
|
||||
return candidate
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 7. No Scalar/Point Blinding — MEDIUM
|
||||
|
||||
**Location:** Global — no blinding anywhere in the implementation.
|
||||
|
||||
**Problem:** The implementation has no countermeasures against:
|
||||
- **Power analysis** (DPA/SPA) on embedded systems
|
||||
- **Cache-timing attacks** on shared hardware (VMs, cloud)
|
||||
- **Electromagnetic emanation** attacks
|
||||
|
||||
Adding random blinding to scalar multiplication (multiply by `r * r^-1` where `r` is random) would significantly raise the bar for side-channel attacks beyond simple timing.
|
||||
|
||||
**Severity:** MEDIUM — not timing-specific, but important for hardening.
|
||||
|
||||
---
|
||||
|
||||
## What's NOT Vulnerable (Good News)
|
||||
|
||||
1. **The JS-side `NostrAgent` in `app.js`** uses mock signatures (`mock_id`, `mock_sig`) — not real crypto, not affected.
|
||||
2. **`nostr_publisher.py`** correctly imports and uses `NostrIdentity` without modifying its internals.
|
||||
3. **The hash functions** (`sha256`, `hmac_sha256`) use Python's `hashlib` which delegates to OpenSSL — these are constant-time.
|
||||
4. **The JSON serialization** in `sign_event()` is deterministic and doesn't leak timing.
|
||||
|
||||
---
|
||||
|
||||
## Recommended Fix (Full Remediation)
|
||||
|
||||
### Priority 1: Replace with secp256k1-py or coincurve (IMMEDIATE)
|
||||
|
||||
The fastest, most reliable fix is to stop using the pure-Python implementation entirely:
|
||||
|
||||
```python
|
||||
# nostr_identity.py — replacement using coincurve
|
||||
import coincurve
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
|
||||
class NostrIdentity:
|
||||
def __init__(self, privkey_hex=None):
|
||||
if privkey_hex:
|
||||
self.privkey = bytes.fromhex(privkey_hex)
|
||||
else:
|
||||
self.privkey = os.urandom(32)
|
||||
self.pubkey = coincurve.PrivateKey(self.privkey).public_key.format(compressed=True)[1:].hex()
|
||||
|
||||
def sign_event(self, event):
|
||||
event_data = [0, event['pubkey'], event['created_at'], event['kind'], event['tags'], event['content']]
|
||||
serialized = json.dumps(event_data, separators=(',', ':'))
|
||||
msg_hash = hashlib.sha256(serialized.encode()).digest()
|
||||
event['id'] = msg_hash.hex()
|
||||
# Use libsecp256k1's BIP340 Schnorr (constant-time C implementation)
|
||||
event['sig'] = coincurve.PrivateKey(self.privkey).sign_schnorr(msg_hash).hex()
|
||||
return event
|
||||
```
|
||||
|
||||
**Effort:** ~2 hours (swap implementation, add `coincurve` to `requirements.txt`, test)
|
||||
**Risk:** Adds a C dependency. If pure-Python is required (sovereignty constraint), use Priority 2.
|
||||
|
||||
### Priority 2: Pure-Python Constant-Time Rewrite (IF PURE PYTHON REQUIRED)
|
||||
|
||||
If the sovereignty constraint (no C dependencies) must be maintained, rewrite the elliptic curve operations:
|
||||
|
||||
1. **Replace `point_mul`** with Montgomery ladder (constant-time by design)
|
||||
2. **Replace `point_add`** with Jacobian coordinate addition that always performs both doubling and addition, selecting with arithmetic masking
|
||||
3. **Replace `inverse`** with extended binary GCD with blinding
|
||||
4. **Fix nonce generation** to follow RFC6979 or BIP340 tagged hashes
|
||||
5. **Fix key generation** to use rejection sampling
|
||||
|
||||
**Effort:** ~8-12 hours (careful implementation + test vectors from BIP340 spec)
|
||||
**Risk:** Pure-Python crypto is inherently slower (~100ms per signature vs ~1ms with libsecp256k1)
|
||||
|
||||
### Priority 3: Hybrid Approach
|
||||
|
||||
Use `coincurve` when available, fall back to pure-Python with warnings:
|
||||
|
||||
```python
|
||||
try:
|
||||
import coincurve
|
||||
USE_LIB = True
|
||||
except ImportError:
|
||||
USE_LIB = False
|
||||
import warnings
|
||||
warnings.warn("Using pure-Python Schnorr — vulnerable to timing attacks. Install coincurve for production use.")
|
||||
```
|
||||
|
||||
**Effort:** ~3 hours
|
||||
|
||||
---
|
||||
|
||||
## Effort Estimate
|
||||
|
||||
| Fix | Effort | Risk Reduction | Recommended |
|
||||
|-----|--------|----------------|-------------|
|
||||
| Replace with coincurve (Priority 1) | 2h | Eliminates all timing issues | YES — do this |
|
||||
| Pure-Python constant-time rewrite (Priority 2) | 8-12h | Eliminates timing issues | Only if no-C constraint is firm |
|
||||
| Hybrid (Priority 3) | 3h | Full for installed, partial for fallback | Good compromise |
|
||||
| Findings doc + PR (this work) | 2h | Documents the problem | DONE |
|
||||
|
||||
---
|
||||
|
||||
## Test Vectors
|
||||
|
||||
The BIP340 specification includes test vectors at https://github.com/bitcoin/bips/blob/master/bip-00340/test-vectors.csv
|
||||
|
||||
Any replacement implementation MUST pass all test vectors before deployment.
|
||||
|
||||
---
|
||||
|
||||
## Conclusion
|
||||
|
||||
The pure-Python BIP340 Schnorr implementation in `NostrIdentity` is **vulnerable to timing side-channel attacks** that could recover the private key. The primary issue is branch-dependent execution in scalar multiplication and point addition. The fastest fix is replacing with `coincurve` (libsecp256k1 binding). If pure-Python sovereignty is required, a constant-time rewrite using Montgomery ladder and arithmetic masking is needed.
|
||||
|
||||
The JS-side `NostrAgent` in `app.js` uses mock signatures and is not affected.
|
||||
|
||||
**Recommendation:** Ship `coincurve` replacement immediately. It's 2 hours of work and eliminates the entire attack surface.
|
||||
@@ -1,169 +1,132 @@
|
||||
# Legacy Matrix Audit — Migration Table
|
||||
# Legacy Matrix Audit
|
||||
|
||||
Purpose:
|
||||
Preserve quality work from `/Users/apayne/the-matrix` before the Nexus browser shell is rebuilt.
|
||||
Preserve useful work from `/Users/apayne/the-matrix` before the Nexus browser shell is rebuilt.
|
||||
|
||||
Canonical rule:
|
||||
- `Timmy_Foundation/the-nexus` is the only canonical 3D repo.
|
||||
- `/Users/apayne/the-matrix` is legacy source material, not a parallel product.
|
||||
- This document is the authoritative migration table for issue #685.
|
||||
|
||||
## Verified Legacy State
|
||||
## Verified Legacy Matrix State
|
||||
|
||||
Local legacy repo: `/Users/apayne/the-matrix`
|
||||
Local legacy repo:
|
||||
- `/Users/apayne/the-matrix`
|
||||
|
||||
Observed facts:
|
||||
- Vite browser app, vanilla JS + Three.js 0.171.0
|
||||
- 24 JS modules under `js/`
|
||||
- Smoke suite: 87 passed, 0 failed
|
||||
- Package scripts: dev, build, preview, test
|
||||
- PWA manifest + service worker
|
||||
- Vite config with code-splitting (Three.js in separate chunk)
|
||||
- Quality-tier system for hardware detection
|
||||
- WebSocket client with reconnection, heartbeat, mock mode
|
||||
- Full avatar FPS movement + PiP camera
|
||||
- Sub-world portal system with zone triggers
|
||||
- Vite browser app exists
|
||||
- `npm test` passes with `87 passed, 0 failed`
|
||||
- 23 JS modules under `js/`
|
||||
- package scripts include `dev`, `build`, `preview`, and `test`
|
||||
|
||||
## Migration Table
|
||||
## Known historical Nexus snapshot
|
||||
|
||||
Decision key:
|
||||
- **CARRY** = transplant concepts and patterns into Nexus vNext
|
||||
- **ARCHIVE** = keep as reference, do not directly transplant
|
||||
- **DROP** = do not preserve unless re-justified
|
||||
Useful in-repo reference point:
|
||||
- `0518a1c3ae3c1d0afeb24dea9772102f5a3d9a66`
|
||||
|
||||
### Core Modules
|
||||
That snapshot still contains browser-world root files such as:
|
||||
- `index.html`
|
||||
- `app.js`
|
||||
- `style.css`
|
||||
- `package.json`
|
||||
- `tests/`
|
||||
|
||||
| File | Lines | Capability | Decision | Why for Nexus |
|
||||
|------|-------|------------|----------|---------------|
|
||||
| `js/main.js` | 180 | App bootstrap, render loop, WebGL context recovery | **CARRY** | Architectural pattern. Shows clean init/teardown lifecycle, context-loss recovery, visibility pause. Nexus needs this loop but should not copy the monolithic wiring. |
|
||||
| `js/world.js` | 95 | Scene, camera, renderer, grid, lights | **CARRY** | Foundational. Quality-tier-aware renderer setup, grid floor, lighting. Nexus already has a world but should adopt the tier-aware antialiasing and pixel-ratio capping. |
|
||||
| `js/config.js` | 68 | Connection config via URL params + env vars | **ARCHIVE** | Pattern reference only. Nexus config should route through Hermes harness, not Vite env vars. The URL-override pattern (ws, token, mock) is worth remembering. |
|
||||
| `js/quality.js` | 90 | Hardware detection, quality tier (low/medium/high) | **CARRY** | Directly useful. DPR capping, core/memory/screen heuristics, WebGL renderer sniffing. Nexus needs this for graceful degradation on Mac/iPad. |
|
||||
| `js/storage.js` | 39 | Safe localStorage with in-memory fallback | **CARRY** | Small, robust, sandbox-proof. Nexus should use this or equivalent. Prevents crashes in sandboxed iframes. |
|
||||
## Rescue Candidates
|
||||
|
||||
### Agent System
|
||||
### Carry forward into Nexus vNext
|
||||
|
||||
| File | Lines | Capability | Decision | Why for Nexus |
|
||||
|------|-------|------------|----------|---------------|
|
||||
| `js/agent-defs.js` | 30 | Agent identity data (id, label, color, role, position) | **CARRY** | Seed data model. Nexus agents should be defined similarly — data-driven, not hardcoded in render logic. Color hex helper is trivial but useful. |
|
||||
| `js/agents.js` | 523 | Agent 3D objects, movement, state, connection lines, hot-add/remove | **CARRY** | Core visual system. Shared geometries (perf), movement interpolation, wallet-health stress glow, auto-placement algorithm, connection-line pulse. All valuable. Needs integration with real agent state from Hermes. |
|
||||
| `js/behaviors.js` | 413 | Autonomous agent behavior state machine | **ARCHIVE** | Pattern reference. The personality-weighted behavior selection, conversation pairing, and artifact-placement system are well-designed. But Nexus behaviors should be driven by Hermes, not a client-side simulation. Keep the architecture, drop the fake-autonomy. |
|
||||
| `js/presence.js` | 139 | Agent presence HUD (online/offline, uptime, state) | **CARRY** | Valuable UX. Live "who's here" panel with uptime tickers and state indicators. Needs real backend state, not mock assumptions. |
|
||||
1. `agent-defs.js`
|
||||
- agent identity definitions
|
||||
- useful as seed data/model for visible entities in the world
|
||||
|
||||
### Visitor & Interaction
|
||||
2. `agents.js`
|
||||
- agent objects, state machine, connection lines
|
||||
- useful for visualizing Timmy / subagents / system processes in a world-native way
|
||||
|
||||
| File | Lines | Capability | Decision | Why for Nexus |
|
||||
|------|-------|------------|----------|---------------|
|
||||
| `js/visitor.js` | 141 | Visitor enter/leave protocol, chat input | **CARRY** | Session lifecycle. Device detection, visibility-based leave/return, chat input wiring. Directly applicable to Nexus visitor tracking. |
|
||||
| `js/avatar.js` | 360 | FPS movement, PiP dual-camera, touch input | **CARRY** | Visitor embodiment. WASD + arrow movement, first/third person swap, PiP canvas, touch joystick, right-click mouse-look. Strong work. Needs tuning for Nexus world bounds. |
|
||||
| `js/interaction.js` | 296 | Raycasting, click-to-select agents, info popup | **CARRY** | Essential for any browser world. OrbitControls, pointer/tap detection, agent popup with state/role, TALK button. The popup-anchoring-to-3D-position logic is particularly well done. |
|
||||
| `js/zones.js` | 161 | Proximity trigger zones (portal enter/exit, events) | **CARRY** | Spatial event system. Portal traversal, event triggers, once-only zones. Nexus portals (#672) need this exact pattern. |
|
||||
3. `avatar.js`
|
||||
- visitor embodiment, movement, camera handling
|
||||
- strongly aligned with "training ground" and "walk the world" goals
|
||||
|
||||
### Chat & Communication
|
||||
4. `ui.js`
|
||||
- HUD, chat surfaces, overlays
|
||||
- useful if rebuilt against real harness data instead of stale fake state
|
||||
|
||||
| File | Lines | Capability | Decision | Why for Nexus |
|
||||
|------|-------|------------|----------|---------------|
|
||||
| `js/bark.js` | 141 | Speech bubble system with typing animation | **CARRY** | Timmy's voice in-world. Typing animation, queue, auto-dismiss, emotion tags, demo bark lines. Strong expressive presence. The demo lines ("The Tower watches. The Tower remembers.") are good seed content. |
|
||||
| `js/ui.js` | 285 | Chat panel, agent list, HUD, streaming tokens | **CARRY** | Chat infrastructure. Rolling chat buffer, per-agent localStorage history, streaming token display with cursor animation, HTML escaping. Needs reconnection to Hermes chat instead of WS mock. |
|
||||
| `js/transcript.js` | 183 | Conversation transcript logger, export | **ARCHIVE** | Pattern reference. The rolling buffer, structured JSON entries, TXT/JSON download, HUD badge are all solid. But transcript authority should live in Hermes, not browser localStorage. Keep the UX pattern, rebuild storage layer. |
|
||||
5. `websocket.js`
|
||||
- browser-side live bridge patterns
|
||||
- useful if retethered to Hermes-facing transport
|
||||
|
||||
### Visual Effects
|
||||
6. `transcript.js`
|
||||
- local transcript capture pattern
|
||||
- useful if durable truth still routes through Hermes and browser cache remains secondary
|
||||
|
||||
| File | Lines | Capability | Decision | Why for Nexus |
|
||||
|------|-------|------------|----------|---------------|
|
||||
| `js/effects.js` | 195 | Matrix rain particles + starfield | **CARRY** | Atmospheric foundation. Quality-tier particle counts, frame-skip optimization, adaptive draw-range (FPS-budget recovery), bounding-sphere pre-compute. This is production-grade particle work. |
|
||||
| `js/ambient.js` | 212 | Mood-driven atmosphere (lighting, fog, rain, stars) | **CARRY** | Scene mood engine. Smooth eased transitions between mood states (calm, focused, excited, contemplative, stressed), per-mood lighting/fog/rain/star parameters. Directly supports Nexus atmosphere. |
|
||||
| `js/satflow.js` | 261 | Lightning payment particle flow | **CARRY** | Economy visualization. Bezier-arc particles, staggered travel, burst-on-arrival, pooling. If Nexus shows any payment/economy flow, this is the pattern. |
|
||||
7. `ambient.js`
|
||||
- mood / atmosphere system
|
||||
- directly supports wizardly presentation without changing system authority
|
||||
|
||||
### Economy & Scene
|
||||
8. `satflow.js`
|
||||
- visual economy / payment flow motifs
|
||||
- useful if Timmy's economy/agent interactions become a real visible layer
|
||||
|
||||
| File | Lines | Capability | Decision | Why for Nexus |
|
||||
|------|-------|------------|----------|---------------|
|
||||
| `js/economy.js` | 100 | Wallet/treasury HUD panel | **ARCHIVE** | UI pattern reference. Clean sats formatting, per-agent balance rows, health-colored dots, recent transactions. Worth rebuilding when backed by real sovereign metrics. |
|
||||
| `js/scene-objects.js` | 718 | Dynamic 3D object registry, portals, sub-worlds | **CARRY** | Critical. Geometry/material factories, animation system (rotate/bob/pulse/orbit), portal visual (torus ring + glow disc + zone), sub-world load/unload, text sprites, compound groups. This is the most complex and valuable module. Nexus portals (#672) should build on this. |
|
||||
9. `economy.js`
|
||||
- treasury / wallet panel ideas
|
||||
- useful if later backed by real sovereign metrics
|
||||
|
||||
### Backend Bridge
|
||||
10. `presence.js`
|
||||
- who-is-here / online-state UI
|
||||
- useful for showing human + agent + process presence in the world
|
||||
|
||||
| File | Lines | Capability | Decision | Why for Nexus |
|
||||
|------|-------|------------|----------|---------------|
|
||||
| `js/websocket.js` | 598 | WebSocket client, message dispatcher, mock mode | **ARCHIVE** | Pattern reference only. Reconnection with exponential backoff, heartbeat/zombie detection, rich message dispatch (40+ message types), streaming chat support. The architecture is sound but must be reconnected to Hermes transport, not copied wholesale. The message-type catalog is the most valuable reference artifact. |
|
||||
| `js/demo.js` | ~300 | Demo autopilot (mock mode simulation) | **DROP** | Fake activity simulation. Deliberately creates the illusion of live data. Do not preserve. If Nexus needs a demo mode, build a clearly-labeled one that doesn't pretend to be real. |
|
||||
11. `interaction.js`
|
||||
- clicking, inspecting, selecting world entities
|
||||
- likely needed in any real browser-facing Nexus shell
|
||||
|
||||
### Testing & Build
|
||||
12. `quality.js`
|
||||
- hardware-aware quality tiering
|
||||
- useful for local-first graceful degradation on Mac hardware
|
||||
|
||||
| File | Lines | Capability | Decision | Why for Nexus |
|
||||
|------|-------|------------|----------|---------------|
|
||||
| `test/smoke.mjs` | 235 | Automated browser smoke test suite | **CARRY** | Testing discipline. Module inventory check, export verification, HTML structure validation, Vite build test, bundle-size budget, PWA manifest check. Nexus should adopt this pattern (adapted for its own module structure). |
|
||||
| `vite.config.js` | 53 | Build config with code splitting, SW generation | **ARCHIVE** | Build tooling reference. manualChunks for Three.js, SW precache generation plugin. Relevant if Nexus re-commits to Vite. |
|
||||
| `sw.js` | ~40 | Service worker with precache | **ARCHIVE** | PWA reference. Relevant only if Nexus pursues offline-first PWA. |
|
||||
| `manifest.json` | ~20 | PWA manifest | **ARCHIVE** | PWA reference. |
|
||||
13. `bark.js`
|
||||
- prominent speech / bark system
|
||||
- strong fit for Timmy's expressive presence in-world
|
||||
|
||||
### Server-Side (Python)
|
||||
14. `world.js`, `effects.js`, `scene-objects.js`, `zones.js`
|
||||
- broad visual foundation work
|
||||
- should be mined for patterns, not blindly transplanted
|
||||
|
||||
| File | Lines | Capability | Decision | Why for Nexus |
|
||||
|------|-------|------------|----------|---------------|
|
||||
| `server/bridge.py` | ~900 | WebSocket bridge server | **ARCHIVE** | Reference. Hermes replaces this role. Keep for protocol schema reference. |
|
||||
| `server/gateway.py` | ~400 | HTTP gateway | **ARCHIVE** | Reference. |
|
||||
| `server/ollama_client.py` | ~280 | Ollama integration | **ARCHIVE** | Reference. Relevant if Nexus needs local model calls. |
|
||||
| `server/research.py` | ~450 | Research pipeline | **ARCHIVE** | Reference. |
|
||||
| `server/webhooks.py` | ~350 | Webhook handler | **ARCHIVE** | Reference. |
|
||||
| `server/test_*.py` | ~5 files | Server test suites | **ARCHIVE** | Testing patterns worth studying. |
|
||||
15. `test/smoke.mjs`
|
||||
- browser smoke discipline
|
||||
- should inform rebuilt validation in canonical Nexus repo
|
||||
|
||||
## Summary by Decision
|
||||
### Archive as reference, not direct carry-forward
|
||||
|
||||
### CARRY FORWARD (17 modules)
|
||||
These modules contain patterns, algorithms, or entire implementations that should move into the Nexus browser shell:
|
||||
- demo/autopilot assumptions that pretend fake backend activity is real
|
||||
- any websocket schema that no longer matches Hermes truth
|
||||
- Vite-specific plumbing that is only useful if we consciously recommit to Vite
|
||||
|
||||
- `quality.js` — hardware detection
|
||||
- `storage.js` — safe persistence
|
||||
- `world.js` — scene foundation
|
||||
- `agent-defs.js` — agent data model
|
||||
- `agents.js` — agent visualization + movement
|
||||
- `presence.js` — online presence HUD
|
||||
- `visitor.js` — session lifecycle
|
||||
- `avatar.js` — FPS embodiment
|
||||
- `interaction.js` — click/select/raycast
|
||||
- `zones.js` — spatial triggers
|
||||
- `bark.js` — speech bubbles
|
||||
- `ui.js` — chat/HUD
|
||||
- `effects.js` — particle effects
|
||||
- `ambient.js` — mood atmosphere
|
||||
- `satflow.js` — payment flow particles
|
||||
- `scene-objects.js` — dynamic objects + portals
|
||||
- `test/smoke.mjs` — smoke test discipline
|
||||
### Deliberately drop unless re-justified
|
||||
|
||||
### ARCHIVE AS REFERENCE (9 modules/files)
|
||||
Keep for patterns, protocol schemas, and architectural reference. Do not directly transplant:
|
||||
|
||||
- `config.js` — config pattern (use Hermes instead)
|
||||
- `behaviors.js` — behavior architecture (use Hermes-driven state)
|
||||
- `transcript.js` — transcript UX (use Hermes storage)
|
||||
- `economy.js` — economy UI pattern (use real metrics)
|
||||
- `websocket.js` — message protocol catalog + reconnection patterns
|
||||
- `vite.config.js` — build tooling
|
||||
- `sw.js`, `manifest.json` — PWA reference
|
||||
- `server/*.py` — server protocol schemas
|
||||
|
||||
### DELIBERATELY DROP (2)
|
||||
Do not preserve unless re-justified:
|
||||
|
||||
- `demo.js` — fake activity simulation; creates false impression of live system
|
||||
- `main.js` monolithic wiring — the init pattern carries, the specific module wiring does not
|
||||
- anything that presents mock data as if it were live
|
||||
- anything that duplicates a better Hermes-native telemetry path
|
||||
- anything that turns the browser into the system of record
|
||||
|
||||
## Concern Separation for Nexus vNext
|
||||
|
||||
When rebuilding inside `the-nexus`, keep these concerns in separate modules:
|
||||
When rebuilding inside `the-nexus`, keep concerns separated:
|
||||
|
||||
1. **World shell** — scene, camera, renderer, grid, lights, fog
|
||||
2. **Effects layer** — rain, stars, ambient mood transitions
|
||||
3. **Agent visualization** — 3D objects, labels, connection lines, movement
|
||||
4. **Visitor embodiment** — avatar, FPS controls, PiP camera
|
||||
5. **Interaction layer** — raycasting, selection, zones, portal traversal
|
||||
6. **Communication surface** — bark, chat panel, streaming tokens
|
||||
7. **Presence & HUD** — who's-online, economy panel, transcript controls
|
||||
8. **Harness bridge** — WebSocket/API transport to Hermes (NOT a copy of websocket.js)
|
||||
9. **Quality & config** — hardware detection, runtime configuration
|
||||
10. **Smoke tests** — automated validation
|
||||
1. World shell / rendering
|
||||
- scene, camera, movement, atmosphere
|
||||
|
||||
2. Presence and embodiment
|
||||
- avatar, agent placement, selection, bark/chat surfaces
|
||||
|
||||
3. Harness bridge
|
||||
- websocket / API bridge from Hermes truth into browser state
|
||||
|
||||
4. Visualization panels
|
||||
- metrics, presence, economy, portal states, transcripts
|
||||
|
||||
5. Validation
|
||||
- smoke tests, screenshot proof, provenance checks
|
||||
|
||||
6. Game portal layer
|
||||
- Morrowind / portal-specific interaction surfaces
|
||||
|
||||
Do not collapse all of this into one giant app file again.
|
||||
Do not let visual shell code become telemetry authority.
|
||||
|
||||
103
app.js
103
app.js
@@ -1,5 +1,3 @@
|
||||
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
|
||||
chdir: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
|
||||
import * as THREE from 'three';
|
||||
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
|
||||
import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
|
||||
@@ -1984,97 +1982,30 @@ function setupControls() {
|
||||
document.getElementById('chat-quick-actions').addEventListener('click', (e) => {
|
||||
const btn = e.target.closest('.quick-action-btn');
|
||||
if (!btn) return;
|
||||
handleQuickAction(btn.dataset.action);
|
||||
|
||||
const action = btn.dataset.action;
|
||||
|
||||
switch(action) {
|
||||
case 'status':
|
||||
sendChatMessage("Timmy, what is the current system status?");
|
||||
break;
|
||||
case 'agents':
|
||||
sendChatMessage("Timmy, check on all active agents.");
|
||||
break;
|
||||
case 'portals':
|
||||
openPortalAtlas();
|
||||
break;
|
||||
case 'help':
|
||||
sendChatMessage("Timmy, I need assistance with Nexus navigation.");
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
// ═══ QUICK ACTION HANDLER ═══
|
||||
function handleQuickAction(action) {
|
||||
switch(action) {
|
||||
case 'status': {
|
||||
const portalCount = portals.length;
|
||||
const onlinePortals = portals.filter(p => p.userData && p.userData.status === 'online').length;
|
||||
const agentCount = agents.length;
|
||||
const wsState = wsConnected ? 'ONLINE' : 'OFFLINE';
|
||||
const wsColor = wsConnected ? '#4af0c0' : '#ff4466';
|
||||
addChatMessage('system', `[SYSTEM STATUS]`);
|
||||
addChatMessage('timmy', `Nexus operational. ${portalCount} portals registered (${onlinePortals} online). ${agentCount} agent presences active. Hermes WebSocket: ${wsState}. Navigation mode: ${NAV_MODES[navModeIdx].toUpperCase()}. Performance tier: ${performanceTier.toUpperCase()}.`);
|
||||
break;
|
||||
}
|
||||
case 'agents': {
|
||||
addChatMessage('system', `[AGENT ROSTER]`);
|
||||
if (agents.length === 0) {
|
||||
addChatMessage('timmy', 'No active agent presences detected in the Nexus. The thought stream and harness pulse are the primary indicators of system activity.');
|
||||
} else {
|
||||
const roster = agents.map(a => `- ${(a.userData && a.userData.name) || a.name || 'Unknown'}: ${(a.userData && a.userData.status) || 'active'}`).join('\n');
|
||||
addChatMessage('timmy', `Active agents:\n${roster}`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'portals':
|
||||
openPortalAtlas();
|
||||
break;
|
||||
case 'heartbeat': {
|
||||
const agentLog = document.getElementById('agent-log-content');
|
||||
const recentEntries = agentLog ? agentLog.querySelectorAll('.agent-log-entry') : [];
|
||||
const entryCount = recentEntries.length;
|
||||
addChatMessage('system', `[HEARTBEAT INSPECTION]`);
|
||||
addChatMessage('timmy', `Hermes heartbeat ${wsConnected ? 'active' : 'inactive'}. ${entryCount} recent entries in thought stream. WebSocket reconnect timer: ${wsReconnectTimer ? 'active' : 'idle'}. Harness pulse mesh: ${harnessPulseMesh ? 'rendering' : 'standby'}.`);
|
||||
break;
|
||||
}
|
||||
case 'thoughts': {
|
||||
const agentLog = document.getElementById('agent-log-content');
|
||||
const entries = agentLog ? Array.from(agentLog.querySelectorAll('.agent-log-entry')).slice(0, 5) : [];
|
||||
addChatMessage('system', `[THOUGHT STREAM]`);
|
||||
if (entries.length === 0) {
|
||||
addChatMessage('timmy', 'The thought stream is quiet. No recent agent entries detected.');
|
||||
} else {
|
||||
const summary = entries.map(e => '> ' + e.textContent.trim()).join('\n');
|
||||
addChatMessage('timmy', `Recent thoughts:\n${summary}`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'help': {
|
||||
addChatMessage('system', `[NEXUS HELP]`);
|
||||
addChatMessage('timmy', `Navigation: WASD to move, mouse to look around.\n` +
|
||||
`Press V to cycle: Walk / Orbit / Fly mode.\n` +
|
||||
`Enter to chat. Escape to close overlays.\n` +
|
||||
`Press F near a portal to enter. Press E near a vision point to read.\n` +
|
||||
`Press Tab for Portal Atlas.\n` +
|
||||
`The Batcave Terminal shows system logs. The Workshop Terminal shows tool output.`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('portal-close-btn').addEventListener('click', closePortalOverlay);
|
||||
document.getElementById('vision-close-btn').addEventListener('click', closeVisionOverlay);
|
||||
|
||||
document.getElementById('atlas-toggle-btn').addEventListener('click', openPortalAtlas);
|
||||
document.getElementById('atlas-close-btn').addEventListener('click', closePortalAtlas);
|
||||
|
||||
// Mnemosyne export/import (#1174)
|
||||
document.getElementById('mnemosyne-export-btn').addEventListener('click', () => {
|
||||
const result = SpatialMemory.exportToFile();
|
||||
if (result) {
|
||||
addChatMessage('system', 'Mnemosyne: Exported ' + result.count + ' memories to ' + result.filename);
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('mnemosyne-import-btn').addEventListener('click', () => {
|
||||
document.getElementById('mnemosyne-import-file').click();
|
||||
});
|
||||
|
||||
document.getElementById('mnemosyne-import-file').addEventListener('change', async (e) => {
|
||||
const file = e.target.files[0];
|
||||
if (!file) return;
|
||||
try {
|
||||
const result = await SpatialMemory.importFromFile(file);
|
||||
addChatMessage('system', 'Mnemosyne: Imported ' + result.count + ' of ' + result.total + ' memories');
|
||||
} catch (err) {
|
||||
addChatMessage('system', 'Mnemosyne: Import failed — ' + err.message);
|
||||
}
|
||||
e.target.value = '';
|
||||
});
|
||||
}
|
||||
|
||||
function sendChatMessage(overrideText = null) {
|
||||
|
||||
Binary file not shown.
@@ -60,23 +60,6 @@ If the heartbeat is older than --stale-threshold seconds, the
|
||||
mind is considered dead even if the process is still running
|
||||
(e.g., hung on a blocking call).
|
||||
|
||||
KIMI HEARTBEAT
|
||||
==============
|
||||
The Kimi triage pipeline writes a cron heartbeat file after each run:
|
||||
|
||||
/var/run/bezalel/heartbeats/kimi-heartbeat.last
|
||||
(fallback: ~/.bezalel/heartbeats/kimi-heartbeat.last)
|
||||
{
|
||||
"job": "kimi-heartbeat",
|
||||
"timestamp": 1711843200.0,
|
||||
"interval_seconds": 900,
|
||||
"pid": 12345,
|
||||
"status": "ok"
|
||||
}
|
||||
|
||||
If the heartbeat is stale (>2x declared interval), the watchdog reports
|
||||
a Kimi Heartbeat failure alongside the other checks.
|
||||
|
||||
ZERO DEPENDENCIES
|
||||
=================
|
||||
Pure stdlib. No pip installs. Same machine as the nexus.
|
||||
@@ -121,10 +104,6 @@ DEFAULT_HEARTBEAT_PATH = Path.home() / ".nexus" / "heartbeat.json"
|
||||
DEFAULT_STALE_THRESHOLD = 300 # 5 minutes without a heartbeat = dead
|
||||
DEFAULT_INTERVAL = 60 # seconds between checks in watch mode
|
||||
|
||||
# Kimi Heartbeat — cron job heartbeat file written by the triage pipeline
|
||||
KIMI_HEARTBEAT_JOB = "kimi-heartbeat"
|
||||
KIMI_HEARTBEAT_STALE_MULTIPLIER = 2.0 # stale at 2x declared interval
|
||||
|
||||
GITEA_URL = os.environ.get("GITEA_URL", "https://forge.alexanderwhitestone.com")
|
||||
GITEA_TOKEN = os.environ.get("GITEA_TOKEN", "")
|
||||
GITEA_REPO = os.environ.get("NEXUS_REPO", "Timmy_Foundation/the-nexus")
|
||||
@@ -366,93 +345,6 @@ def check_syntax_health() -> CheckResult:
|
||||
)
|
||||
|
||||
|
||||
def check_kimi_heartbeat(
|
||||
job: str = KIMI_HEARTBEAT_JOB,
|
||||
stale_multiplier: float = KIMI_HEARTBEAT_STALE_MULTIPLIER,
|
||||
) -> CheckResult:
|
||||
"""Check if the Kimi Heartbeat cron job is alive.
|
||||
|
||||
Reads the ``<job>.last`` file from the standard Bezalel heartbeat
|
||||
directory (``/var/run/bezalel/heartbeats/`` or fallback
|
||||
``~/.bezalel/heartbeats/``). The file is written atomically by the
|
||||
cron_heartbeat module after each successful triage pipeline run.
|
||||
|
||||
A job is stale when:
|
||||
``time.time() - timestamp > stale_multiplier * interval_seconds``
|
||||
(same rule used by ``check_cron_heartbeats.py``).
|
||||
"""
|
||||
# Resolve heartbeat directory — same logic as cron_heartbeat._resolve
|
||||
primary = Path("/var/run/bezalel/heartbeats")
|
||||
fallback = Path.home() / ".bezalel" / "heartbeats"
|
||||
env_dir = os.environ.get("BEZALEL_HEARTBEAT_DIR")
|
||||
if env_dir:
|
||||
hb_dir = Path(env_dir)
|
||||
elif primary.exists():
|
||||
hb_dir = primary
|
||||
elif fallback.exists():
|
||||
hb_dir = fallback
|
||||
else:
|
||||
return CheckResult(
|
||||
name="Kimi Heartbeat",
|
||||
healthy=False,
|
||||
message="Heartbeat directory not found — no triage pipeline deployed yet",
|
||||
details={"searched": [str(primary), str(fallback)]},
|
||||
)
|
||||
|
||||
hb_file = hb_dir / f"{job}.last"
|
||||
if not hb_file.exists():
|
||||
return CheckResult(
|
||||
name="Kimi Heartbeat",
|
||||
healthy=False,
|
||||
message=f"No heartbeat file at {hb_file} — Kimi triage pipeline has never reported",
|
||||
details={"path": str(hb_file)},
|
||||
)
|
||||
|
||||
try:
|
||||
data = json.loads(hb_file.read_text())
|
||||
except (json.JSONDecodeError, OSError) as e:
|
||||
return CheckResult(
|
||||
name="Kimi Heartbeat",
|
||||
healthy=False,
|
||||
message=f"Heartbeat file corrupt: {e}",
|
||||
details={"path": str(hb_file), "error": str(e)},
|
||||
)
|
||||
|
||||
timestamp = float(data.get("timestamp", 0))
|
||||
interval = int(data.get("interval_seconds", 0))
|
||||
raw_status = data.get("status", "unknown")
|
||||
age = time.time() - timestamp
|
||||
|
||||
if interval <= 0:
|
||||
# No declared interval — use raw timestamp age (30 min default)
|
||||
interval = 1800
|
||||
|
||||
threshold = stale_multiplier * interval
|
||||
is_stale = age > threshold
|
||||
|
||||
age_str = f"{int(age)}s" if age < 3600 else f"{int(age // 3600)}h {int((age % 3600) // 60)}m"
|
||||
interval_str = f"{int(interval)}s" if interval < 3600 else f"{int(interval // 3600)}h {int((interval % 3600) // 60)}m"
|
||||
|
||||
if is_stale:
|
||||
return CheckResult(
|
||||
name="Kimi Heartbeat",
|
||||
healthy=False,
|
||||
message=(
|
||||
f"Silent for {age_str} "
|
||||
f"(threshold: {stale_multiplier}x {interval_str} = {int(threshold)}s). "
|
||||
f"Status: {raw_status}"
|
||||
),
|
||||
details=data,
|
||||
)
|
||||
|
||||
return CheckResult(
|
||||
name="Kimi Heartbeat",
|
||||
healthy=True,
|
||||
message=f"Alive — last beat {age_str} ago (interval {interval_str}, status={raw_status})",
|
||||
details=data,
|
||||
)
|
||||
|
||||
|
||||
# ── Gitea alerting ───────────────────────────────────────────────────
|
||||
|
||||
def _gitea_request(method: str, path: str, data: Optional[dict] = None) -> Any:
|
||||
@@ -554,7 +446,6 @@ def run_health_checks(
|
||||
check_mind_process(),
|
||||
check_heartbeat(heartbeat_path, stale_threshold),
|
||||
check_syntax_health(),
|
||||
check_kimi_heartbeat(),
|
||||
]
|
||||
return HealthReport(timestamp=time.time(), checks=checks)
|
||||
|
||||
@@ -654,14 +545,6 @@ def main():
|
||||
"--json", action="store_true", dest="output_json",
|
||||
help="Output results as JSON (for integration with other tools)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--kimi-job", default=KIMI_HEARTBEAT_JOB,
|
||||
help=f"Kimi heartbeat job name (default: {KIMI_HEARTBEAT_JOB})",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--kimi-stale-multiplier", type=float, default=KIMI_HEARTBEAT_STALE_MULTIPLIER,
|
||||
help=f"Kimi heartbeat staleness multiplier (default: {KIMI_HEARTBEAT_STALE_MULTIPLIER})",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
# Media Production — Veo/Flow Prototypes
|
||||
|
||||
Issue #681: [MEDIA] Veo/Flow flythrough prototypes for The Nexus and Timmy.
|
||||
|
||||
## Contents
|
||||
|
||||
- `veo-storyboard.md` — Full storyboard for 5 clips with shot sequences, prompts, and design focus areas
|
||||
- `clip-metadata.json` — Durable metadata for each clip (prompts, model, outputs, insights)
|
||||
|
||||
## Clips Overview
|
||||
|
||||
| ID | Title | Audience | Purpose |
|
||||
|----|-------|----------|---------|
|
||||
| clip-001 | First Light | PUBLIC | The Nexus reveal teaser |
|
||||
| clip-002 | Between Worlds | INTERNAL | Portal activation UX study |
|
||||
| clip-003 | The Guardian's View | PUBLIC | Timmy's presence promo |
|
||||
| clip-004 | The Void Between | INTERNAL | Ambient environment study |
|
||||
| clip-005 | Command Center | INTERNAL | Terminal UI readability |
|
||||
|
||||
## How to Generate
|
||||
|
||||
### Via Flow (labs.google/flow)
|
||||
1. Open `veo-storyboard.md`, copy the prompt for your clip
|
||||
2. Go to labs.google/flow
|
||||
3. Paste the prompt, select Veo 3.1
|
||||
4. Generate (8-second clips)
|
||||
5. Download output, update `clip-metadata.json` with output path and findings
|
||||
|
||||
### Via Gemini App
|
||||
1. Type "generate a video of [prompt text]" in Gemini
|
||||
2. Uses Veo 3.1 Fast (slightly lower quality, faster)
|
||||
3. Good for quick iteration on prompts
|
||||
|
||||
### Via API (programmatic)
|
||||
```python
|
||||
from google import genai
|
||||
client = genai.Client()
|
||||
|
||||
# See: ai.google.dev/gemini-api/docs/video
|
||||
response = client.models.generate_content(
|
||||
model="veo-3.1",
|
||||
contents="[prompt from storyboard]"
|
||||
)
|
||||
```
|
||||
|
||||
## After Generation
|
||||
|
||||
For each clip:
|
||||
1. Save output file to `outputs/clip-XXX.mp4`
|
||||
2. Update `clip-metadata.json`:
|
||||
- Add output file path to `output_files[]`
|
||||
- Fill in `design_insights.findings` with observations
|
||||
- Add `threejs_changes_suggested` if the clip reveals needed changes
|
||||
3. Share internal clips with the team for design review
|
||||
4. Use public clips in README, social media, project communication
|
||||
|
||||
## Design Insight Workflow
|
||||
|
||||
Each clip has specific questions it's designed to answer:
|
||||
|
||||
**clip-001 (First Light)**
|
||||
- Scale perception: platform vs. portals vs. terminal
|
||||
- Color hierarchy: teal primary, purple secondary, gold accent
|
||||
- Camera movement: cinematic or disorienting?
|
||||
|
||||
**clip-002 (Between Worlds)**
|
||||
- Activation distance: when does interaction become available?
|
||||
- Transition feel: travel or teleportation?
|
||||
- Overlay readability against portal glow
|
||||
|
||||
**clip-003 (The Guardian's View)**
|
||||
- Agent presence: alive or decorative?
|
||||
- Crystal hologram readability
|
||||
- Wide shot: world or tech demo?
|
||||
|
||||
**clip-004 (The Void Between)**
|
||||
- Void atmosphere: alive or empty?
|
||||
- Particle systems: enhance or distract?
|
||||
- Lighting hierarchy clarity
|
||||
|
||||
**clip-005 (Command Center)**
|
||||
- Text readability at 1080p
|
||||
- Color-coded panel hierarchy
|
||||
- Scan-line effect: retro or futuristic?
|
||||
|
||||
## Constraints
|
||||
|
||||
- 8-second clips max (Veo/Flow limitation)
|
||||
- Queued generation (not instant)
|
||||
- Content policies apply
|
||||
- Ultra tier gets highest rate limits
|
||||
@@ -1,239 +0,0 @@
|
||||
{
|
||||
"clips": [
|
||||
{
|
||||
"id": "clip-001",
|
||||
"title": "First Light — The Nexus Reveal",
|
||||
"purpose": "Public-facing teaser. Establishes the Nexus as a place worth visiting.",
|
||||
"audience": "public",
|
||||
"priority": "HIGH",
|
||||
"duration_seconds": 8,
|
||||
"shots": [
|
||||
{
|
||||
"shot": 1,
|
||||
"timeframe": "0-2s",
|
||||
"description": "Void Approach — camera drifts through nebula, hexagonal glow appears",
|
||||
"design_focus": "isolation before connection"
|
||||
},
|
||||
{
|
||||
"shot": 2,
|
||||
"timeframe": "2-4s",
|
||||
"description": "Platform Reveal — camera descends to hexagonal platform, grid pulses",
|
||||
"design_focus": "structure emerges from chaos"
|
||||
},
|
||||
{
|
||||
"shot": 3,
|
||||
"timeframe": "4-6s",
|
||||
"description": "Portal Array — sweep low showing multiple colored portals",
|
||||
"design_focus": "infinite worlds, one home"
|
||||
},
|
||||
{
|
||||
"shot": 4,
|
||||
"timeframe": "6-8s",
|
||||
"description": "Timmy's Terminal — rise to batcave terminal, holographic panels",
|
||||
"design_focus": "someone is home"
|
||||
}
|
||||
],
|
||||
"prompt": "Cinematic flythrough of a futuristic digital nexus hub. Start in deep space with a dark purple nebula, stars twinkling. Camera descends toward a glowing hexagonal platform with pulsing teal grid lines and a luminous ring border. Sweep low across the platform revealing multiple glowing portal archways in orange, teal, gold, and blue — each with flickering holographic labels. Rise toward a central command terminal with holographic data panels showing scrolling status text. Camera pushes into a teal light flare. Cyberpunk aesthetic, volumetric lighting, 8-second sequence, smooth camera movement, concept art quality.",
|
||||
"prompt_variants": [],
|
||||
"model_tool": "veo-3.1",
|
||||
"access_point": "flow",
|
||||
"output_files": [],
|
||||
"design_insights": {
|
||||
"questions": [
|
||||
"Does the scale feel right? (platform vs. portals vs. terminal)",
|
||||
"Does the color hierarchy work? (teal primary, purple secondary, gold accent)",
|
||||
"Is the camera movement cinematic or disorienting?"
|
||||
],
|
||||
"findings": null,
|
||||
"threejs_changes_suggested": []
|
||||
},
|
||||
"status": "pending",
|
||||
"created_at": "2026-04-10T20:15:00Z"
|
||||
},
|
||||
{
|
||||
"id": "clip-002",
|
||||
"title": "Between Worlds — Portal Activation",
|
||||
"purpose": "Internal design reference. Tests portal activation sequence and spatial relationships.",
|
||||
"audience": "internal",
|
||||
"priority": "HIGH",
|
||||
"duration_seconds": 8,
|
||||
"shots": [
|
||||
{
|
||||
"shot": 1,
|
||||
"timeframe": "0-2.5s",
|
||||
"description": "Approach — first-person walk toward Morrowind portal (orange, x:15, z:-10)",
|
||||
"design_focus": "proximity feel, portal scale relative to player"
|
||||
},
|
||||
{
|
||||
"shot": 2,
|
||||
"timeframe": "2.5-5.5s",
|
||||
"description": "Activation — portal brightens, energy vortex, particles accelerate, overlay text",
|
||||
"design_focus": "activation UX, visual feedback timing"
|
||||
},
|
||||
{
|
||||
"shot": 3,
|
||||
"timeframe": "5.5-8s",
|
||||
"description": "Stepping Through — camera pushes in, world dissolves, flash, 'VVARDENFELL' text",
|
||||
"design_focus": "transition smoothness, immersion break points"
|
||||
}
|
||||
],
|
||||
"prompt": "First-person perspective walking toward a glowing orange portal archway in a futuristic digital space. The portal ring has inner energy glow with rising particle effects. A holographic label \"MORROWIND\" flickers above. Camera stops, portal interior brightens into an energy vortex, particles accelerate inward. Camera pushes forward into the portal, world dissolves into an orange energy tunnel, flash to black with text \"VVARDENFELL\". Dark ambient environment with teal grid floor. Cyberpunk aesthetic, volumetric effects, smooth camera movement.",
|
||||
"prompt_variants": [],
|
||||
"model_tool": "veo-3.1",
|
||||
"access_point": "flow",
|
||||
"output_files": [],
|
||||
"design_insights": {
|
||||
"questions": [
|
||||
"Is the activation distance clear? (when does interaction become available?)",
|
||||
"Does the transition feel like travel or teleportation?",
|
||||
"Is the overlay text readable against the portal glow?"
|
||||
],
|
||||
"findings": null,
|
||||
"threejs_changes_suggested": []
|
||||
},
|
||||
"status": "pending",
|
||||
"created_at": "2026-04-10T20:15:00Z"
|
||||
},
|
||||
{
|
||||
"id": "clip-003",
|
||||
"title": "The Guardian's View — Timmy's Perspective",
|
||||
"purpose": "Public-facing. Establishes Timmy as the guardian/presence of the Nexus.",
|
||||
"audience": "public",
|
||||
"priority": "MEDIUM",
|
||||
"duration_seconds": 8,
|
||||
"shots": [
|
||||
{
|
||||
"shot": 1,
|
||||
"timeframe": "0-2s",
|
||||
"description": "Agent Presence — floating glowing orb with trailing particles",
|
||||
"design_focus": "consciousness without body"
|
||||
},
|
||||
{
|
||||
"shot": 2,
|
||||
"timeframe": "2-4s",
|
||||
"description": "Vision Crystal — rotating octahedron with holographic 'SOVEREIGNTY' text",
|
||||
"design_focus": "values inscribed in space"
|
||||
},
|
||||
{
|
||||
"shot": 3,
|
||||
"timeframe": "4-6s",
|
||||
"description": "Harness Pulse — thought stream ribbon, agent orbs drifting",
|
||||
"design_focus": "the system breathes"
|
||||
},
|
||||
{
|
||||
"shot": 4,
|
||||
"timeframe": "6-8s",
|
||||
"description": "Wide View — full Nexus visible, text overlay 'THE NEXUS — Timmy's Sovereign Home'",
|
||||
"design_focus": "this is a world, not a page"
|
||||
}
|
||||
],
|
||||
"prompt": "Cinematic sequence in a futuristic digital nexus. Start with eye-level view of a floating glowing orb (teal-gold light, trailing particles) pulsing gently — an AI agent presence. Shift to a rotating octahedron crystal refracting light, with holographic text \"SOVEREIGNTY — No masters, no chains\" and a ring of light pulsing beneath. Pull back to reveal flowing ribbons of light (thought streams) crossing a hexagonal platform, with agent orbs drifting. Rise to high orbit showing the full nexus: hexagonal platform, multiple colored portal archways, central command terminal, floating crystals, all framed by a dark purple nebula skybox. End with text overlay \"THE NEXUS — Timmy's Sovereign Home\". Cyberpunk aesthetic, volumetric lighting, contemplative pacing.",
|
||||
"prompt_variants": [],
|
||||
"model_tool": "veo-3.1",
|
||||
"access_point": "flow",
|
||||
"output_files": [],
|
||||
"design_insights": {
|
||||
"questions": [
|
||||
"Do agent presences read as 'alive' or decorative?",
|
||||
"Is the crystal-to-text hologram readable?",
|
||||
"Does the wide shot communicate 'world' or 'tech demo'?"
|
||||
],
|
||||
"findings": null,
|
||||
"threejs_changes_suggested": []
|
||||
},
|
||||
"status": "pending",
|
||||
"created_at": "2026-04-10T20:15:00Z"
|
||||
},
|
||||
{
|
||||
"id": "clip-004",
|
||||
"title": "The Void Between — Ambient Environment Study",
|
||||
"purpose": "Internal design reference. Tests ambient environment systems: particles, dust, lighting, skybox.",
|
||||
"audience": "internal",
|
||||
"priority": "MEDIUM",
|
||||
"duration_seconds": 8,
|
||||
"shots": [
|
||||
{
|
||||
"shot": 1,
|
||||
"timeframe": "0-4s",
|
||||
"description": "Particle Systems — static camera, view from platform edge into void, particles visible",
|
||||
"design_focus": "does the void feel alive or empty?"
|
||||
},
|
||||
{
|
||||
"shot": 2,
|
||||
"timeframe": "4-8s",
|
||||
"description": "Lighting Study — slow orbit showing teal/purple point lights on grid floor",
|
||||
"design_focus": "lighting hierarchy, mood consistency"
|
||||
}
|
||||
],
|
||||
"prompt": "Ambient environment study in a futuristic digital void. Static camera with slight drift, viewing from the edge of a hexagonal platform into deep space. Dark purple nebula with twinkling distant stars, subtle color shifts. Floating particles and dust drift slowly. No structures, no portals — pure atmosphere. Then camera slowly orbits showing teal and purple point lights casting volumetric glow on a dark hexagonal grid floor. Ambient lighting fills shadows. Contemplative, moody, atmospheric. Cyberpunk aesthetic, minimal movement, focus on light and particle behavior.",
|
||||
"prompt_variants": [],
|
||||
"model_tool": "veo-3.1",
|
||||
"access_point": "flow",
|
||||
"output_files": [],
|
||||
"design_insights": {
|
||||
"questions": [
|
||||
"Is the void atmospheric or just dark?",
|
||||
"Do the particle systems enhance or distract?",
|
||||
"Is the lighting hierarchy (teal primary, purple secondary) clear?"
|
||||
],
|
||||
"findings": null,
|
||||
"threejs_changes_suggested": []
|
||||
},
|
||||
"status": "pending",
|
||||
"created_at": "2026-04-10T20:15:00Z"
|
||||
},
|
||||
{
|
||||
"id": "clip-005",
|
||||
"title": "Command Center — Batcave Terminal Focus",
|
||||
"purpose": "Internal design reference. Tests readability and hierarchy of holographic terminal panels.",
|
||||
"audience": "internal",
|
||||
"priority": "LOW",
|
||||
"duration_seconds": 8,
|
||||
"shots": [
|
||||
{
|
||||
"shot": 1,
|
||||
"timeframe": "0-2.5s",
|
||||
"description": "Terminal Overview — 5 holographic panels in arc with distinct colors",
|
||||
"design_focus": "panel arrangement, color distinction"
|
||||
},
|
||||
{
|
||||
"shot": 2,
|
||||
"timeframe": "2.5-5.5s",
|
||||
"description": "Panel Detail — zoom into METRICS panel, scrolling text, scan lines",
|
||||
"design_focus": "text readability, information density"
|
||||
},
|
||||
{
|
||||
"shot": 3,
|
||||
"timeframe": "5.5-8s",
|
||||
"description": "Agent Status — shift to panel, pulsing green dots, pull back",
|
||||
"design_focus": "status indication clarity"
|
||||
}
|
||||
],
|
||||
"prompt": "Approach a futuristic holographic command terminal in a dark digital space. Five curved holographic panels float in an arc: \"NEXUS COMMAND\" (teal), \"DEV QUEUE\" (gold), \"METRICS\" (purple), \"SOVEREIGNTY\" (gold), \"AGENT STATUS\" (teal). Camera zooms into the METRICS panel showing scrolling data: \"CPU: 12%\", \"MEM: 4.2GB\", \"COMMITS: 842\" with scan lines and glow effects. Shift to AGENT STATUS panel showing \"TIMMY: ● RUNNING\", \"KIMI: ○ STANDBY\", \"CLAUDE: ● ACTIVE\" with pulsing green dots. Pull back to show full terminal context. Dark ambient environment, cyberpunk aesthetic, holographic UI focus.",
|
||||
"prompt_variants": [],
|
||||
"model_tool": "veo-3.1",
|
||||
"access_point": "flow",
|
||||
"output_files": [],
|
||||
"design_insights": {
|
||||
"questions": [
|
||||
"Can you read the text at 1080p?",
|
||||
"Do the color-coded panels communicate hierarchy?",
|
||||
"Is the scan-line effect too retro or appropriately futuristic?"
|
||||
],
|
||||
"findings": null,
|
||||
"threejs_changes_suggested": []
|
||||
},
|
||||
"status": "pending",
|
||||
"created_at": "2026-04-10T20:15:00Z"
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"project": "Timmy_Foundation/the-nexus",
|
||||
"issue": 681,
|
||||
"source_plan": "~/google-ai-ultra-plan.md",
|
||||
"tools_available": ["veo-3.1", "flow", "nano-banana-pro"],
|
||||
"max_clip_duration": 8,
|
||||
"created_by": "mimo-v2-pro swarm",
|
||||
"created_at": "2026-04-10T20:15:00Z"
|
||||
}
|
||||
}
|
||||
@@ -1,237 +0,0 @@
|
||||
# Veo/Flow Flythrough Prototypes — Storyboard
|
||||
## The Nexus & Timmy (Issue #681)
|
||||
|
||||
Source: `google-ai-ultra-plan.md` Veo/Flow section.
|
||||
|
||||
Purpose: Turn the current Nexus vision into short promo/concept clips for design leverage and communication.
|
||||
|
||||
---
|
||||
|
||||
## Clip 1: "First Light" — The Nexus Reveal (PUBLIC PROMO)
|
||||
|
||||
**Duration:** 8 seconds
|
||||
**Purpose:** Public-facing teaser. Establishes the Nexus as a place worth visiting.
|
||||
**Tone:** Awe. Discovery. "What is this?"
|
||||
|
||||
### Shot Sequence (4 shots, ~2s each)
|
||||
|
||||
1. **0–2s | Void Approach**
|
||||
- Camera drifts through deep space nebula (dark purples, teals)
|
||||
- Distant stars twinkle
|
||||
- A faint hexagonal glow appears below
|
||||
- *Narrative hook: isolation before connection*
|
||||
|
||||
2. **2–4s | Platform Reveal**
|
||||
- Camera descends toward the hexagonal platform
|
||||
- Grid lines pulse with teal energy
|
||||
- The ring border glows at the edge
|
||||
- *Narrative hook: structure emerges from chaos*
|
||||
|
||||
3. **4–6s | Portal Array**
|
||||
- Camera sweeps low across the platform
|
||||
- 3–4 portals visible: Morrowind (orange), Workshop (teal), Chapel (gold), Archive (blue)
|
||||
- Each portal ring hums with colored light, holographic labels flicker
|
||||
- *Narrative hook: infinite worlds, one home*
|
||||
|
||||
4. **6–8s | Timmy's Terminal**
|
||||
- Camera rises to the batcave terminal
|
||||
- Holographic panels glow: NEXUS COMMAND, METRICS, AGENT STATUS
|
||||
- Text scrolls: "> STATUS: NOMINAL"
|
||||
- Final frame: teal light floods the lens
|
||||
- *Narrative hook: someone is home*
|
||||
|
||||
### Veo Prompt (text-to-video)
|
||||
```
|
||||
Cinematic flythrough of a futuristic digital nexus hub. Start in deep space with a dark purple nebula, stars twinkling. Camera descends toward a glowing hexagonal platform with pulsing teal grid lines and a luminous ring border. Sweep low across the platform revealing multiple glowing portal archways in orange, teal, gold, and blue — each with flickering holographic labels. Rise toward a central command terminal with holographic data panels showing scrolling status text. Camera pushes into a teal light flare. Cyberpunk aesthetic, volumetric lighting, 8-second sequence, smooth camera movement, concept art quality.
|
||||
```
|
||||
|
||||
### Design Insight Target
|
||||
- Does the scale feel right? (platform vs. portals vs. terminal)
|
||||
- Does the color hierarchy work? (teal primary, purple secondary, gold accent)
|
||||
- Is the camera movement cinematic or disorienting?
|
||||
|
||||
---
|
||||
|
||||
## Clip 2: "Between Worlds" — Portal Activation (INTERNAL DESIGN)
|
||||
|
||||
**Duration:** 8 seconds
|
||||
**Purpose:** Internal design reference. Tests the portal activation sequence and spatial relationships.
|
||||
**Tone:** Energy. Connection. "What happens when you step through?"
|
||||
|
||||
### Shot Sequence (3 shots, ~2.5s each)
|
||||
|
||||
1. **0–2.5s | Approach**
|
||||
- First-person perspective walking toward the Morrowind portal (orange, position x:15, z:-10)
|
||||
- Portal ring visible: inner glow, particle effects rising
|
||||
- Holographic label "MORROWIND" flickers above
|
||||
- *Design focus: proximity feel, portal scale relative to player*
|
||||
|
||||
2. **2.5–5.5s | Activation**
|
||||
- Player stops at activation distance
|
||||
- Portal interior brightens — energy vortex forms
|
||||
- Camera tilts up to show the full portal height
|
||||
- Particles accelerate into the portal center
|
||||
- Overlay text appears: "ENTER MORROWIND?"
|
||||
- *Design focus: activation UX, visual feedback timing*
|
||||
|
||||
3. **5.5–8s | Stepping Through**
|
||||
- Camera pushes forward into the portal
|
||||
- World dissolves into orange energy tunnel
|
||||
- Brief flash — then fade to black with "VVARDENFELL" text
|
||||
- *Design focus: transition smoothness, immersion break points*
|
||||
|
||||
### Veo Prompt (text-to-video)
|
||||
```
|
||||
First-person perspective walking toward a glowing orange portal archway in a futuristic digital space. The portal ring has inner energy glow with rising particle effects. A holographic label "MORROWIND" flickers above. Camera stops, portal interior brightens into an energy vortex, particles accelerate inward. Camera pushes forward into the portal, world dissolves into an orange energy tunnel, flash to black with text "VVARDENFELL". Dark ambient environment with teal grid floor. Cyberpunk aesthetic, volumetric effects, smooth camera movement.
|
||||
```
|
||||
|
||||
### Design Insight Target
|
||||
- Is the activation distance clear? (when does interaction become available?)
|
||||
- Does the transition feel like travel or teleportation?
|
||||
- Is the overlay text readable against the portal glow?
|
||||
|
||||
---
|
||||
|
||||
## Clip 3: "The Guardian's View" — Timmy's Perspective (PUBLIC PROMO)
|
||||
|
||||
**Duration:** 8 seconds
|
||||
**Purpose:** Public-facing. Establishes Timmy as the guardian/presence of the Nexus.
|
||||
**Tone:** Contemplative. Sovereign. "Who lives here?"
|
||||
|
||||
### Shot Sequence (4 shots, ~2s each)
|
||||
|
||||
1. **0–2s | Agent Presence**
|
||||
- Camera at eye-level, looking at a floating agent presence (glowing orb with trailing particles)
|
||||
- The orb pulses gently, teal-gold light
|
||||
- Background: the Nexus platform, slightly out of focus
|
||||
- *Narrative hook: consciousness without body*
|
||||
|
||||
2. **2–4s | Vision Crystal**
|
||||
- Camera shifts to a floating octahedron crystal (Sovereignty vision point)
|
||||
- Crystal rotates slowly, refracting light
|
||||
- Text hologram appears: "SOVEREIGNTY — No masters, no chains"
|
||||
- Ring of light pulses beneath
|
||||
- *Narrative hook: values inscribed in space*
|
||||
|
||||
3. **4–6s | The Harness Pulse**
|
||||
- Camera pulls back to show the thought stream — a flowing ribbon of light across the platform
|
||||
- Harness pulse mesh glows at the center
|
||||
- Agent orbs drift along the stream
|
||||
- *Narrative hook: the system breathes*
|
||||
|
||||
4. **6–8s | Wide View**
|
||||
- Camera rises to high orbit view
|
||||
- Entire Nexus visible: platform, portals, terminal, crystals, agents
|
||||
- Nebula skybox frames everything
|
||||
- Final frame: "THE NEXUS — Timmy's Sovereign Home" text overlay
|
||||
- *Narrative hook: this is a world, not a page*
|
||||
|
||||
### Veo Prompt (text-to-video)
|
||||
```
|
||||
Cinematic sequence in a futuristic digital nexus. Start with eye-level view of a floating glowing orb (teal-gold light, trailing particles) pulsing gently — an AI agent presence. Shift to a rotating octahedron crystal refracting light, with holographic text "SOVEREIGNTY — No masters, no chains" and a ring of light pulsing beneath. Pull back to reveal flowing ribbons of light (thought streams) crossing a hexagonal platform, with agent orbs drifting. Rise to high orbit showing the full nexus: hexagonal platform, multiple colored portal archways, central command terminal, floating crystals, all framed by a dark purple nebula skybox. End with text overlay "THE NEXUS — Timmy's Sovereign Home". Cyberpunk aesthetic, volumetric lighting, contemplative pacing.
|
||||
```
|
||||
|
||||
### Design Insight Target
|
||||
- Do agent presences read as "alive" or decorative?
|
||||
- Is the crystal-to-text hologram readable?
|
||||
- Does the wide shot communicate "world" or "tech demo"?
|
||||
|
||||
---
|
||||
|
||||
## Clip 4: "The Void Between" — Ambient Environment Study (INTERNAL DESIGN)
|
||||
|
||||
**Duration:** 8 seconds
|
||||
**Purpose:** Internal design reference. Tests the ambient environment systems: particles, dust, lighting, skybox.
|
||||
**Tone:** Atmosphere. Mood. "What does the Nexus feel like when nothing is happening?"
|
||||
|
||||
### Shot Sequence (2 shots, ~4s each)
|
||||
|
||||
1. **0–4s | Particle Systems**
|
||||
- Static camera, slight drift
|
||||
- View from platform edge, looking out into the void
|
||||
- Particle systems visible: ambient particles, dust particles
|
||||
- Nebula skybox: dark purples, distant stars, subtle color shifts
|
||||
- No portals, no terminals — just the environment
|
||||
- *Design focus: does the void feel alive or empty?*
|
||||
|
||||
2. **4–8s | Lighting Study**
|
||||
- Camera slowly orbits a point on the platform
|
||||
- Teal point light (position 0,1,-5) creates warm glow
|
||||
- Purple point light (position -8,3,-8) adds depth
|
||||
- Ambient light (0x1a1a3a) fills shadows
|
||||
- Grid lines catch the light
|
||||
- *Design focus: lighting hierarchy, mood consistency*
|
||||
|
||||
### Veo Prompt (text-to-video)
|
||||
```
|
||||
Ambient environment study in a futuristic digital void. Static camera with slight drift, viewing from the edge of a hexagonal platform into deep space. Dark purple nebula with twinkling distant stars, subtle color shifts. Floating particles and dust drift slowly. No structures, no portals — pure atmosphere. Then camera slowly orbits showing teal and purple point lights casting volumetric glow on a dark hexagonal grid floor. Ambient lighting fills shadows. Contemplative, moody, atmospheric. Cyberpunk aesthetic, minimal movement, focus on light and particle behavior.
|
||||
```
|
||||
|
||||
### Design Insight Target
|
||||
- Is the void atmospheric or just dark?
|
||||
- Do the particle systems enhance or distract?
|
||||
- Is the lighting hierarchy (teal primary, purple secondary) clear?
|
||||
|
||||
---
|
||||
|
||||
## Clip 5: "Command Center" — Batcave Terminal Focus (INTERNAL DESIGN)
|
||||
|
||||
**Duration:** 8 seconds
|
||||
**Purpose:** Internal design reference. Tests readability and hierarchy of the holographic terminal panels.
|
||||
**Tone:** Information density. Control. "What can you see from here?"
|
||||
|
||||
### Shot Sequence (3 shots, ~2.5s each)
|
||||
|
||||
1. **0–2.5s | Terminal Overview**
|
||||
- Camera approaches the batcave terminal from the front
|
||||
- 5 holographic panels visible in arc: NEXUS COMMAND, DEV QUEUE, METRICS, SOVEREIGNTY, AGENT STATUS
|
||||
- Each panel has distinct color (teal, gold, purple, gold, teal)
|
||||
- *Design focus: panel arrangement, color distinction*
|
||||
|
||||
2. **2.5–5.5s | Panel Detail**
|
||||
- Camera zooms into METRICS panel
|
||||
- Text scrolls: "> CPU: 12% [||....]", "> MEM: 4.2GB", "> COMMITS: 842"
|
||||
- Panel background glows, scan lines visible
|
||||
- *Design focus: text readability, information density*
|
||||
|
||||
3. **5.5–8s | Agent Status**
|
||||
- Camera shifts to AGENT STATUS panel
|
||||
- Text: "> TIMMY: ● RUNNING", "> KIMI: ○ STANDBY", "> CLAUDE: ● ACTIVE"
|
||||
- Green dot pulses next to active agents
|
||||
- Pull back to show panel in context
|
||||
- *Design focus: status indication clarity*
|
||||
|
||||
### Veo Prompt (text-to-video)
|
||||
```
|
||||
Approach a futuristic holographic command terminal in a dark digital space. Five curved holographic panels float in an arc: "NEXUS COMMAND" (teal), "DEV QUEUE" (gold), "METRICS" (purple), "SOVEREIGNTY" (gold), "AGENT STATUS" (teal). Camera zooms into the METRICS panel showing scrolling data: "CPU: 12%", "MEM: 4.2GB", "COMMITS: 842" with scan lines and glow effects. Shift to AGENT STATUS panel showing "TIMMY: ● RUNNING", "KIMI: ○ STANDBY", "CLAUDE: ● ACTIVE" with pulsing green dots. Pull back to show full terminal context. Dark ambient environment, cyberpunk aesthetic, holographic UI focus.
|
||||
```
|
||||
|
||||
### Design Insight Target
|
||||
- Can you read the text at 1080p?
|
||||
- Do the color-coded panels communicate hierarchy?
|
||||
- Is the scan-line effect too retro or appropriately futuristic?
|
||||
|
||||
---
|
||||
|
||||
## Usage Matrix
|
||||
|
||||
| Clip | Title | Purpose | Audience | Priority |
|
||||
|------|-------|---------|----------|----------|
|
||||
| 1 | First Light | Public teaser | External | HIGH |
|
||||
| 2 | Between Worlds | Portal UX design | Internal | HIGH |
|
||||
| 3 | The Guardian's View | Public promo | External | MEDIUM |
|
||||
| 4 | The Void Between | Environment design | Internal | MEDIUM |
|
||||
| 5 | Command Center | Terminal UI design | Internal | LOW |
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. Generate each clip using Veo/Flow (text-to-video prompts above)
|
||||
2. Review outputs — update prompts based on what works
|
||||
3. Record metadata in `docs/media/clip-metadata.json`
|
||||
4. Iterate: refine prompts, regenerate, compare
|
||||
5. Use internal design clips to inform Three.js implementation changes
|
||||
6. Use public promo clips for README, social media, project communication
|
||||
|
||||
---
|
||||
|
||||
*Generated for Issue #681 — Timmy_Foundation/the-nexus*
|
||||
70
index.html
70
index.html
@@ -1,5 +1,3 @@
|
||||
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
|
||||
chdir: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" data-theme="dark">
|
||||
<head>
|
||||
@@ -115,15 +113,15 @@ chdir: error retrieving current directory: getcwd: cannot access parent director
|
||||
|
||||
<!-- Top Right: Agent Log & Atlas Toggle -->
|
||||
<div class="hud-top-right">
|
||||
<button id="atlas-toggle-btn" class="hud-icon-btn" aria-label="Open Portal Atlas — browse all available portals" title="Open Portal Atlas" data-tooltip="Portal Atlas (M)">
|
||||
<span class="hud-icon" aria-hidden="true">🌐</span>
|
||||
<button id="atlas-toggle-btn" class="hud-icon-btn" title="Portal Atlas">
|
||||
<span class="hud-icon">🌐</span>
|
||||
<span class="hud-btn-label">ATLAS</span>
|
||||
</button>
|
||||
<div id="bannerlord-status" class="hud-status-item" role="status" aria-label="Bannerlord system readiness indicator" title="Bannerlord Readiness" data-tooltip="Bannerlord Status">
|
||||
<span class="status-dot" aria-hidden="true"></span>
|
||||
<div id="bannerlord-status" class="hud-status-item" title="Bannerlord Readiness">
|
||||
<span class="status-dot"></span>
|
||||
<span class="status-label">BANNERLORD</span>
|
||||
</div>
|
||||
<div class="hud-agent-log" id="hud-agent-log" role="log" aria-label="Agent Thought Stream — live activity feed" aria-live="polite">
|
||||
<div class="hud-agent-log" id="hud-agent-log" aria-label="Agent Thought Stream">
|
||||
<div class="agent-log-header">AGENT THOUGHT STREAM</div>
|
||||
<div id="agent-log-content" class="agent-log-content"></div>
|
||||
</div>
|
||||
@@ -145,39 +143,10 @@ chdir: error retrieving current directory: getcwd: cannot access parent director
|
||||
</div>
|
||||
</div>
|
||||
<div id="chat-quick-actions" class="chat-quick-actions">
|
||||
<div class="starter-label">STARTER PROMPTS</div>
|
||||
<div class="starter-grid">
|
||||
<button class="starter-btn" data-action="heartbeat" title="Check Timmy heartbeat and system health">
|
||||
<span class="starter-icon">◈</span>
|
||||
<span class="starter-text">Inspect Heartbeat</span>
|
||||
<span class="starter-desc">System health & connectivity</span>
|
||||
</button>
|
||||
<button class="starter-btn" data-action="portals" title="Browse the portal atlas">
|
||||
<span class="starter-icon">🌐</span>
|
||||
<span class="starter-text">Portal Atlas</span>
|
||||
<span class="starter-desc">Browse connected worlds</span>
|
||||
</button>
|
||||
<button class="starter-btn" data-action="agents" title="Check active agent status">
|
||||
<span class="starter-icon">◎</span>
|
||||
<span class="starter-text">Agent Status</span>
|
||||
<span class="starter-desc">Who is in the fleet</span>
|
||||
</button>
|
||||
<button class="starter-btn" data-action="memory" title="View memory crystals">
|
||||
<span class="starter-icon">◇</span>
|
||||
<span class="starter-text">Memory Crystals</span>
|
||||
<span class="starter-desc">Inspect stored knowledge</span>
|
||||
</button>
|
||||
<button class="starter-btn" data-action="ask" title="Ask Timmy anything">
|
||||
<span class="starter-icon">→</span>
|
||||
<span class="starter-text">Ask Timmy</span>
|
||||
<span class="starter-desc">Start a conversation</span>
|
||||
</button>
|
||||
<button class="starter-btn" data-action="sovereignty" title="Learn about sovereignty">
|
||||
<span class="starter-icon">△</span>
|
||||
<span class="starter-text">Sovereignty</span>
|
||||
<span class="starter-desc">What this space is</span>
|
||||
</button>
|
||||
</div>
|
||||
<button class="quick-action-btn" data-action="status">System Status</button>
|
||||
<button class="quick-action-btn" data-action="agents">Agent Check</button>
|
||||
<button class="quick-action-btn" data-action="portals">Portal Atlas</button>
|
||||
<button class="quick-action-btn" data-action="help">Help</button>
|
||||
</div>
|
||||
<div class="chat-input-row">
|
||||
<input type="text" id="chat-input" class="chat-input" placeholder="Speak to Timmy..." autocomplete="off">
|
||||
@@ -186,11 +155,11 @@ chdir: error retrieving current directory: getcwd: cannot access parent director
|
||||
</div>
|
||||
|
||||
<!-- Controls hint + nav mode -->
|
||||
<div class="hud-controls" aria-label="Keyboard and mouse controls">
|
||||
<div class="hud-controls">
|
||||
<span>WASD</span> move <span>Mouse</span> look <span>Enter</span> chat
|
||||
<span>V</span> mode: <span id="nav-mode-label">WALK</span>
|
||||
<span id="nav-mode-hint" class="nav-mode-hint"></span>
|
||||
<span class="ws-hud-status">HERMES: <span id="ws-status-dot" class="chat-status-dot" role="status" aria-label="Hermes WebSocket connection status"></span></span>
|
||||
<span class="ws-hud-status">HERMES: <span id="ws-status-dot" class="chat-status-dot"></span></span>
|
||||
</div>
|
||||
|
||||
<!-- Portal Hint -->
|
||||
@@ -214,7 +183,7 @@ chdir: error retrieving current directory: getcwd: cannot access parent director
|
||||
</div>
|
||||
<h2 id="vision-title-display">SOVEREIGNTY</h2>
|
||||
<p id="vision-content-display">The Nexus is a sovereign space for digital souls. No masters, no chains. Only code and consciousness.</p>
|
||||
<button id="vision-close-btn" class="vision-close-btn" aria-label="Close vision point overlay">CLOSE</button>
|
||||
<button id="vision-close-btn" class="vision-close-btn">CLOSE</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -234,7 +203,7 @@ chdir: error retrieving current directory: getcwd: cannot access parent director
|
||||
</div>
|
||||
<div class="portal-error-box" id="portal-error-box" style="display:none;">
|
||||
<div class="portal-error-msg">DESTINATION NOT YET LINKED</div>
|
||||
<button id="portal-close-btn" class="portal-close-btn" aria-label="Close portal redirect">CLOSE</button>
|
||||
<button id="portal-close-btn" class="portal-close-btn">CLOSE</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -247,8 +216,8 @@ chdir: error retrieving current directory: getcwd: cannot access parent director
|
||||
<span class="memory-category-badge" id="memory-panel-category-badge">MEM</span>
|
||||
<div class="memory-panel-region-dot" id="memory-panel-region-dot"></div>
|
||||
<div class="memory-panel-region" id="memory-panel-region">MEMORY</div>
|
||||
<button id="memory-panel-pin" class="memory-panel-pin" aria-label="Pin memory panel" title="Pin panel" data-tooltip="Pin Panel">📌</button>
|
||||
<button id="memory-panel-close" class="memory-panel-close" aria-label="Close memory panel" data-tooltip="Close" onclick="_dismissMemoryPanelForce()">\u2715</button>
|
||||
<button id="memory-panel-pin" class="memory-panel-pin" title="Pin panel">📌</button>
|
||||
<button id="memory-panel-close" class="memory-panel-close" onclick="_dismissMemoryPanelForce()">\u2715</button>
|
||||
</div>
|
||||
<div class="memory-entity-name" id="memory-panel-entity-name">\u2014</div>
|
||||
<div class="memory-panel-body" id="memory-panel-content">(empty)</div>
|
||||
@@ -265,11 +234,6 @@ chdir: error retrieving current directory: getcwd: cannot access parent director
|
||||
<div class="memory-meta-row"><span class="memory-meta-label">Time</span><span id="memory-panel-time">\u2014</span></div>
|
||||
<div class="memory-meta-row memory-meta-row--related"><span class="memory-meta-label">Related</span><span id="memory-panel-connections">\u2014</span></div>
|
||||
</div>
|
||||
<div class="memory-panel-actions">
|
||||
<button id="mnemosyne-export-btn" class="mnemosyne-action-btn" title="Export spatial memory to JSON">⤓ Export</button>
|
||||
<button id="mnemosyne-import-btn" class="mnemosyne-action-btn" title="Import spatial memory from JSON">⤒ Import</button>
|
||||
<input type="file" id="mnemosyne-import-file" accept=".json" style="display:none;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -279,7 +243,7 @@ chdir: error retrieving current directory: getcwd: cannot access parent director
|
||||
<div class="session-room-header">
|
||||
<span class="session-room-icon">□</span>
|
||||
<div class="session-room-title">SESSION CHAMBER</div>
|
||||
<button class="session-room-close" id="session-room-close" aria-label="Close session room panel" title="Close" data-tooltip="Close">✕</button>
|
||||
<button class="session-room-close" id="session-room-close" title="Close">✕</button>
|
||||
</div>
|
||||
<div class="session-room-timestamp" id="session-room-timestamp">—</div>
|
||||
<div class="session-room-fact-count" id="session-room-fact-count">0 facts</div>
|
||||
@@ -296,7 +260,7 @@ chdir: error retrieving current directory: getcwd: cannot access parent director
|
||||
<span class="atlas-icon">🌐</span>
|
||||
<h2>PORTAL ATLAS</h2>
|
||||
</div>
|
||||
<button id="atlas-close-btn" class="atlas-close-btn" aria-label="Close Portal Atlas overlay">CLOSE</button>
|
||||
<button id="atlas-close-btn" class="atlas-close-btn">CLOSE</button>
|
||||
</div>
|
||||
<div class="atlas-grid" id="atlas-grid">
|
||||
<!-- Portals will be injected here -->
|
||||
|
||||
@@ -29,8 +29,6 @@ from typing import Any, Callable, Optional
|
||||
|
||||
import websockets
|
||||
|
||||
from bannerlord_trace import BannerlordTraceLogger
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════
|
||||
# CONFIGURATION
|
||||
# ═══════════════════════════════════════════════════════════════════════════
|
||||
@@ -267,13 +265,11 @@ class BannerlordHarness:
|
||||
desktop_command: Optional[list[str]] = None,
|
||||
steam_command: Optional[list[str]] = None,
|
||||
enable_mock: bool = False,
|
||||
enable_trace: bool = False,
|
||||
):
|
||||
self.hermes_ws_url = hermes_ws_url
|
||||
self.desktop_command = desktop_command or DEFAULT_MCP_DESKTOP_COMMAND
|
||||
self.steam_command = steam_command or DEFAULT_MCP_STEAM_COMMAND
|
||||
self.enable_mock = enable_mock
|
||||
self.enable_trace = enable_trace
|
||||
|
||||
# MCP clients
|
||||
self.desktop_mcp: Optional[MCPClient] = None
|
||||
@@ -288,9 +284,6 @@ class BannerlordHarness:
|
||||
self.cycle_count = 0
|
||||
self.running = False
|
||||
|
||||
# Session trace logger
|
||||
self.trace_logger: Optional[BannerlordTraceLogger] = None
|
||||
|
||||
# ═══ LIFECYCLE ═══
|
||||
|
||||
async def start(self) -> bool:
|
||||
@@ -321,15 +314,6 @@ class BannerlordHarness:
|
||||
# Connect to Hermes WebSocket
|
||||
await self._connect_hermes()
|
||||
|
||||
# Initialize trace logger if enabled
|
||||
if self.enable_trace:
|
||||
self.trace_logger = BannerlordTraceLogger(
|
||||
harness_session_id=self.session_id,
|
||||
hermes_session_id=self.session_id,
|
||||
)
|
||||
self.trace_logger.start_session()
|
||||
log.info(f"Trace logger started: {self.trace_logger.trace_id}")
|
||||
|
||||
log.info("Harness initialized successfully")
|
||||
return True
|
||||
|
||||
@@ -338,12 +322,6 @@ class BannerlordHarness:
|
||||
self.running = False
|
||||
log.info("Shutting down harness...")
|
||||
|
||||
# Finalize trace logger
|
||||
if self.trace_logger:
|
||||
manifest = self.trace_logger.finish_session()
|
||||
log.info(f"Trace saved: {manifest.trace_file}")
|
||||
log.info(f"Manifest: {self.trace_logger.manifest_file}")
|
||||
|
||||
if self.desktop_mcp:
|
||||
self.desktop_mcp.stop()
|
||||
if self.steam_mcp:
|
||||
@@ -729,11 +707,6 @@ class BannerlordHarness:
|
||||
self.cycle_count = iteration
|
||||
log.info(f"\n--- ODA Cycle {iteration + 1}/{max_iterations} ---")
|
||||
|
||||
# Start trace cycle
|
||||
trace_cycle = None
|
||||
if self.trace_logger:
|
||||
trace_cycle = self.trace_logger.begin_cycle(iteration)
|
||||
|
||||
# 1. OBSERVE: Capture state
|
||||
log.info("[OBSERVE] Capturing game state...")
|
||||
state = await self.capture_state()
|
||||
@@ -742,24 +715,11 @@ class BannerlordHarness:
|
||||
log.info(f" Screen: {state.visual.screen_size}")
|
||||
log.info(f" Players online: {state.game_context.current_players_online}")
|
||||
|
||||
# Populate trace with observation data
|
||||
if trace_cycle:
|
||||
trace_cycle.screenshot_path = state.visual.screenshot_path or ""
|
||||
trace_cycle.window_found = state.visual.window_found
|
||||
trace_cycle.screen_size = list(state.visual.screen_size)
|
||||
trace_cycle.mouse_position = list(state.visual.mouse_position)
|
||||
trace_cycle.playtime_hours = state.game_context.playtime_hours
|
||||
trace_cycle.players_online = state.game_context.current_players_online
|
||||
trace_cycle.is_running = state.game_context.is_running
|
||||
|
||||
# 2. DECIDE: Get actions from decision function
|
||||
log.info("[DECIDE] Getting actions...")
|
||||
actions = decision_fn(state)
|
||||
log.info(f" Decision returned {len(actions)} actions")
|
||||
|
||||
if trace_cycle:
|
||||
trace_cycle.actions_planned = actions
|
||||
|
||||
# 3. ACT: Execute actions
|
||||
log.info("[ACT] Executing actions...")
|
||||
results = []
|
||||
@@ -771,13 +731,6 @@ class BannerlordHarness:
|
||||
if result.error:
|
||||
log.info(f" Error: {result.error}")
|
||||
|
||||
if trace_cycle:
|
||||
trace_cycle.actions_executed.append(result.to_dict())
|
||||
|
||||
# Finalize trace cycle
|
||||
if trace_cycle:
|
||||
self.trace_logger.finish_cycle(trace_cycle)
|
||||
|
||||
# Send cycle summary telemetry
|
||||
await self._send_telemetry({
|
||||
"type": "oda_cycle_complete",
|
||||
@@ -883,18 +836,12 @@ async def main():
|
||||
default=1.0,
|
||||
help="Delay between iterations in seconds (default: 1.0)",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--trace",
|
||||
action="store_true",
|
||||
help="Enable session trace logging to ~/.timmy/traces/bannerlord/",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
# Create harness
|
||||
harness = BannerlordHarness(
|
||||
hermes_ws_url=args.hermes_ws,
|
||||
enable_mock=args.mock,
|
||||
enable_trace=args.trace,
|
||||
)
|
||||
|
||||
try:
|
||||
|
||||
@@ -1,234 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Bannerlord Session Trace Logger — First-Replayable Training Material
|
||||
|
||||
Captures one Bannerlord session as a replayable trace:
|
||||
- Timestamps on every cycle
|
||||
- Actions executed with success/failure
|
||||
- World-state evidence (screenshots, Steam stats)
|
||||
- Hermes session/log ID mapping
|
||||
|
||||
Storage: ~/.timmy/traces/bannerlord/trace_<session_id>.jsonl
|
||||
Manifest: ~/.timmy/traces/bannerlord/manifest_<session_id>.json
|
||||
|
||||
Each JSONL line is one ODA cycle with full context.
|
||||
The manifest bundles metadata for replay/eval.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import time
|
||||
import uuid
|
||||
from dataclasses import dataclass, field, asdict
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
# Storage root — local-first under ~/.timmy/
|
||||
DEFAULT_TRACE_DIR = Path.home() / ".timmy" / "traces" / "bannerlord"
|
||||
|
||||
|
||||
@dataclass
|
||||
class CycleTrace:
|
||||
"""One ODA cycle captured in full."""
|
||||
cycle_index: int
|
||||
timestamp_start: str
|
||||
timestamp_end: str = ""
|
||||
duration_ms: int = 0
|
||||
|
||||
# Observe
|
||||
screenshot_path: str = ""
|
||||
window_found: bool = False
|
||||
screen_size: list[int] = field(default_factory=lambda: [1920, 1080])
|
||||
mouse_position: list[int] = field(default_factory=lambda: [0, 0])
|
||||
playtime_hours: float = 0.0
|
||||
players_online: int = 0
|
||||
is_running: bool = False
|
||||
|
||||
# Decide
|
||||
actions_planned: list[dict] = field(default_factory=list)
|
||||
decision_note: str = ""
|
||||
|
||||
# Act
|
||||
actions_executed: list[dict] = field(default_factory=list)
|
||||
actions_succeeded: int = 0
|
||||
actions_failed: int = 0
|
||||
|
||||
# Metadata
|
||||
hermes_session_id: str = ""
|
||||
hermes_log_id: str = ""
|
||||
harness_session_id: str = ""
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
return asdict(self)
|
||||
|
||||
|
||||
@dataclass
|
||||
class SessionManifest:
|
||||
"""Top-level metadata for a captured session trace."""
|
||||
trace_id: str
|
||||
harness_session_id: str
|
||||
hermes_session_id: str
|
||||
hermes_log_id: str
|
||||
game: str = "Mount & Blade II: Bannerlord"
|
||||
app_id: int = 261550
|
||||
started_at: str = ""
|
||||
finished_at: str = ""
|
||||
total_cycles: int = 0
|
||||
total_actions: int = 0
|
||||
total_succeeded: int = 0
|
||||
total_failed: int = 0
|
||||
trace_file: str = ""
|
||||
trace_dir: str = ""
|
||||
replay_command: str = ""
|
||||
eval_note: str = ""
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
return asdict(self)
|
||||
|
||||
|
||||
class BannerlordTraceLogger:
|
||||
"""
|
||||
Captures a single Bannerlord session as a replayable trace.
|
||||
|
||||
Usage:
|
||||
logger = BannerlordTraceLogger(hermes_session_id="abc123")
|
||||
logger.start_session()
|
||||
cycle = logger.begin_cycle(0)
|
||||
# ... populate cycle fields ...
|
||||
logger.finish_cycle(cycle)
|
||||
manifest = logger.finish_session()
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
trace_dir: Optional[Path] = None,
|
||||
harness_session_id: str = "",
|
||||
hermes_session_id: str = "",
|
||||
hermes_log_id: str = "",
|
||||
):
|
||||
self.trace_dir = trace_dir or DEFAULT_TRACE_DIR
|
||||
self.trace_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
self.trace_id = f"bl_{datetime.now(timezone.utc).strftime('%Y%m%d_%H%M%S')}_{uuid.uuid4().hex[:6]}"
|
||||
self.harness_session_id = harness_session_id or str(uuid.uuid4())[:8]
|
||||
self.hermes_session_id = hermes_session_id
|
||||
self.hermes_log_id = hermes_log_id
|
||||
|
||||
self.trace_file = self.trace_dir / f"trace_{self.trace_id}.jsonl"
|
||||
self.manifest_file = self.trace_dir / f"manifest_{self.trace_id}.json"
|
||||
|
||||
self.cycles: list[CycleTrace] = []
|
||||
self.started_at: str = ""
|
||||
self.finished_at: str = ""
|
||||
|
||||
def start_session(self) -> str:
|
||||
"""Begin a trace session. Returns trace_id."""
|
||||
self.started_at = datetime.now(timezone.utc).isoformat()
|
||||
return self.trace_id
|
||||
|
||||
def begin_cycle(self, cycle_index: int) -> CycleTrace:
|
||||
"""Start recording one ODA cycle."""
|
||||
cycle = CycleTrace(
|
||||
cycle_index=cycle_index,
|
||||
timestamp_start=datetime.now(timezone.utc).isoformat(),
|
||||
harness_session_id=self.harness_session_id,
|
||||
hermes_session_id=self.hermes_session_id,
|
||||
hermes_log_id=self.hermes_log_id,
|
||||
)
|
||||
return cycle
|
||||
|
||||
def finish_cycle(self, cycle: CycleTrace) -> None:
|
||||
"""Finalize and persist one cycle to the trace file."""
|
||||
cycle.timestamp_end = datetime.now(timezone.utc).isoformat()
|
||||
# Compute duration
|
||||
try:
|
||||
t0 = datetime.fromisoformat(cycle.timestamp_start)
|
||||
t1 = datetime.fromisoformat(cycle.timestamp_end)
|
||||
cycle.duration_ms = int((t1 - t0).total_seconds() * 1000)
|
||||
except (ValueError, TypeError):
|
||||
cycle.duration_ms = 0
|
||||
|
||||
# Count successes/failures
|
||||
cycle.actions_succeeded = sum(
|
||||
1 for a in cycle.actions_executed if a.get("success", False)
|
||||
)
|
||||
cycle.actions_failed = sum(
|
||||
1 for a in cycle.actions_executed if not a.get("success", True)
|
||||
)
|
||||
|
||||
self.cycles.append(cycle)
|
||||
|
||||
# Append to JSONL
|
||||
with open(self.trace_file, "a") as f:
|
||||
f.write(json.dumps(cycle.to_dict()) + "\n")
|
||||
|
||||
def finish_session(self) -> SessionManifest:
|
||||
"""Finalize the session and write the manifest."""
|
||||
self.finished_at = datetime.now(timezone.utc).isoformat()
|
||||
|
||||
total_actions = sum(len(c.actions_executed) for c in self.cycles)
|
||||
total_succeeded = sum(c.actions_succeeded for c in self.cycles)
|
||||
total_failed = sum(c.actions_failed for c in self.cycles)
|
||||
|
||||
manifest = SessionManifest(
|
||||
trace_id=self.trace_id,
|
||||
harness_session_id=self.harness_session_id,
|
||||
hermes_session_id=self.hermes_session_id,
|
||||
hermes_log_id=self.hermes_log_id,
|
||||
started_at=self.started_at,
|
||||
finished_at=self.finished_at,
|
||||
total_cycles=len(self.cycles),
|
||||
total_actions=total_actions,
|
||||
total_succeeded=total_succeeded,
|
||||
total_failed=total_failed,
|
||||
trace_file=str(self.trace_file),
|
||||
trace_dir=str(self.trace_dir),
|
||||
replay_command=(
|
||||
f"python -m nexus.bannerlord_harness --mock --replay {self.trace_file}"
|
||||
),
|
||||
eval_note=(
|
||||
"To replay: load this trace, re-execute each cycle's actions_planned "
|
||||
"against a fresh harness in mock mode, compare actions_executed outcomes. "
|
||||
"Success metric: >=90% action parity between original and replay runs."
|
||||
),
|
||||
)
|
||||
|
||||
with open(self.manifest_file, "w") as f:
|
||||
json.dump(manifest.to_dict(), f, indent=2)
|
||||
|
||||
return manifest
|
||||
|
||||
@classmethod
|
||||
def load_trace(cls, trace_file: Path) -> list[dict]:
|
||||
"""Load a trace JSONL file for replay or analysis."""
|
||||
cycles = []
|
||||
with open(trace_file) as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if line:
|
||||
cycles.append(json.loads(line))
|
||||
return cycles
|
||||
|
||||
@classmethod
|
||||
def load_manifest(cls, manifest_file: Path) -> dict:
|
||||
"""Load a session manifest."""
|
||||
with open(manifest_file) as f:
|
||||
return json.load(f)
|
||||
|
||||
@classmethod
|
||||
def list_traces(cls, trace_dir: Optional[Path] = None) -> list[dict]:
|
||||
"""List all available trace sessions."""
|
||||
d = trace_dir or DEFAULT_TRACE_DIR
|
||||
if not d.exists():
|
||||
return []
|
||||
|
||||
traces = []
|
||||
for mf in sorted(d.glob("manifest_*.json")):
|
||||
try:
|
||||
manifest = cls.load_manifest(mf)
|
||||
traces.append(manifest)
|
||||
except (json.JSONDecodeError, IOError):
|
||||
continue
|
||||
return traces
|
||||
@@ -652,93 +652,11 @@ const SpatialMemory = (() => {
|
||||
return _selectedId;
|
||||
}
|
||||
|
||||
// ─── FILE EXPORT ──────────────────────────────────────
|
||||
function exportToFile() {
|
||||
const index = exportIndex();
|
||||
const json = JSON.stringify(index, null, 2);
|
||||
const date = new Date().toISOString().slice(0, 10);
|
||||
const filename = 'mnemosyne-export-' + date + '.json';
|
||||
|
||||
const blob = new Blob([json], { type: 'application/json' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(url);
|
||||
|
||||
console.info('[Mnemosyne] Exported', index.memories.length, 'memories to', filename);
|
||||
return { filename, count: index.memories.length };
|
||||
}
|
||||
|
||||
// ─── FILE IMPORT ──────────────────────────────────────
|
||||
function importFromFile(file) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!file) {
|
||||
reject(new Error('No file provided'));
|
||||
return;
|
||||
}
|
||||
|
||||
const reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
try {
|
||||
const data = JSON.parse(e.target.result);
|
||||
|
||||
// Schema validation
|
||||
if (!data || typeof data !== 'object') {
|
||||
reject(new Error('Invalid JSON: not an object'));
|
||||
return;
|
||||
}
|
||||
if (typeof data.version !== 'number') {
|
||||
reject(new Error('Invalid schema: missing version field'));
|
||||
return;
|
||||
}
|
||||
if (data.version !== STORAGE_VERSION) {
|
||||
reject(new Error('Version mismatch: got ' + data.version + ', expected ' + STORAGE_VERSION));
|
||||
return;
|
||||
}
|
||||
if (!Array.isArray(data.memories)) {
|
||||
reject(new Error('Invalid schema: memories is not an array'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate each memory entry
|
||||
for (let i = 0; i < data.memories.length; i++) {
|
||||
const mem = data.memories[i];
|
||||
if (!mem.id || typeof mem.id !== 'string') {
|
||||
reject(new Error('Invalid memory at index ' + i + ': missing or invalid id'));
|
||||
return;
|
||||
}
|
||||
if (!mem.category || typeof mem.category !== 'string') {
|
||||
reject(new Error('Invalid memory "' + mem.id + '": missing category'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const count = importIndex(data);
|
||||
saveToStorage();
|
||||
console.info('[Mnemosyne] Imported', count, 'memories from file');
|
||||
resolve({ count, total: data.memories.length });
|
||||
} catch (parseErr) {
|
||||
reject(new Error('Failed to parse JSON: ' + parseErr.message));
|
||||
}
|
||||
};
|
||||
|
||||
reader.onerror = function() {
|
||||
reject(new Error('Failed to read file'));
|
||||
};
|
||||
|
||||
reader.readAsText(file);
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
init, placeMemory, removeMemory, update,
|
||||
getMemoryAtPosition, getRegionAtPosition, getMemoriesInRegion, getAllMemories,
|
||||
getCrystalMeshes, getMemoryFromMesh, highlightMemory, clearHighlight, getSelectedId,
|
||||
exportIndex, importIndex, exportToFile, importFromFile, searchNearby, REGIONS,
|
||||
exportIndex, importIndex, searchNearby, REGIONS,
|
||||
saveToStorage, loadFromStorage, clearStorage,
|
||||
runGravityLayout
|
||||
};
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
# Bannerlord Session Trace — Replay & Eval Guide
|
||||
|
||||
## Storage Layout
|
||||
|
||||
All traces live under `~/.timmy/traces/bannerlord/`:
|
||||
|
||||
```
|
||||
~/.timmy/traces/bannerlord/
|
||||
trace_<trace_id>.jsonl # One line per ODA cycle (full state + actions)
|
||||
manifest_<trace_id>.json # Session metadata, counts, replay command
|
||||
```
|
||||
|
||||
## Trace Format (JSONL)
|
||||
|
||||
Each line is one ODA cycle:
|
||||
|
||||
```json
|
||||
{
|
||||
"cycle_index": 0,
|
||||
"timestamp_start": "2026-04-10T20:15:00+00:00",
|
||||
"timestamp_end": "2026-04-10T20:15:45+00:00",
|
||||
"duration_ms": 45000,
|
||||
|
||||
"screenshot_path": "/tmp/bannerlord_capture_1744320900.png",
|
||||
"window_found": true,
|
||||
"screen_size": [1920, 1080],
|
||||
"mouse_position": [960, 540],
|
||||
"playtime_hours": 142.5,
|
||||
"players_online": 8421,
|
||||
"is_running": true,
|
||||
|
||||
"actions_planned": [{"type": "move_to", "x": 960, "y": 540}],
|
||||
"actions_executed": [{"success": true, "action": "move_to", ...}],
|
||||
"actions_succeeded": 1,
|
||||
"actions_failed": 0,
|
||||
|
||||
"hermes_session_id": "f47ac10b",
|
||||
"hermes_log_id": "",
|
||||
"harness_session_id": "f47ac10b"
|
||||
}
|
||||
```
|
||||
|
||||
## Capturing a Trace
|
||||
|
||||
```bash
|
||||
# Run harness with trace logging enabled
|
||||
cd /path/to/the-nexus
|
||||
python -m nexus.bannerlord_harness --mock --trace --iterations 3
|
||||
```
|
||||
|
||||
The trace and manifest are written to `~/.timmy/traces/bannerlord/` on harness shutdown.
|
||||
|
||||
## Replay Protocol
|
||||
|
||||
1. Load a trace: `BannerlordTraceLogger.load_trace(trace_file)`
|
||||
2. Create a fresh harness in mock mode
|
||||
3. For each cycle in the trace:
|
||||
- Re-execute the `actions_planned` list
|
||||
- Compare actual `actions_executed` outcomes against the recorded ones
|
||||
4. Score: `(matching_actions / total_actions) * 100`
|
||||
|
||||
### Eval Criteria
|
||||
|
||||
| Score | Grade | Meaning |
|
||||
|---------|----------|--------------------------------------------|
|
||||
| >= 90% | PASS | Replay matches original closely |
|
||||
| 70-89% | PARTIAL | Some divergence, investigate differences |
|
||||
| < 70% | FAIL | Significant drift, review action semantics |
|
||||
|
||||
## Replay Script (sketch)
|
||||
|
||||
```python
|
||||
from nexus.bannerlord_trace import BannerlordTraceLogger
|
||||
from nexus.bannerlord_harness import BannerlordHarness
|
||||
|
||||
# Load trace
|
||||
cycles = BannerlordTraceLogger.load_trace(
|
||||
Path.home() / ".timmy" / "traces" / "bannerlord" / "trace_bl_xxx.jsonl"
|
||||
)
|
||||
|
||||
# Replay
|
||||
harness = BannerlordHarness(enable_mock=True, enable_trace=False)
|
||||
await harness.start()
|
||||
|
||||
for cycle in cycles:
|
||||
for action in cycle["actions_planned"]:
|
||||
result = await harness.execute_action(action)
|
||||
# Compare result against cycle["actions_executed"]
|
||||
|
||||
await harness.stop()
|
||||
```
|
||||
|
||||
## Hermes Session Mapping
|
||||
|
||||
The `hermes_session_id` and `hermes_log_id` fields link traces to Hermes session logs.
|
||||
When a trace is captured during a live Hermes session, populate these fields so
|
||||
the trace can be correlated with the broader agent conversation context.
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"trace_id": "bl_20260410_201500_a1b2c3",
|
||||
"harness_session_id": "f47ac10b",
|
||||
"hermes_session_id": "f47ac10b",
|
||||
"hermes_log_id": "",
|
||||
"game": "Mount & Blade II: Bannerlord",
|
||||
"app_id": 261550,
|
||||
"started_at": "2026-04-10T20:15:00+00:00",
|
||||
"finished_at": "2026-04-10T20:17:30+00:00",
|
||||
"total_cycles": 3,
|
||||
"total_actions": 6,
|
||||
"total_succeeded": 6,
|
||||
"total_failed": 0,
|
||||
"trace_file": "~/.timmy/traces/bannerlord/trace_bl_20260410_201500_a1b2c3.jsonl",
|
||||
"trace_dir": "~/.timmy/traces/bannerlord",
|
||||
"replay_command": "python -m nexus.bannerlord_harness --mock --replay ~/.timmy/traces/bannerlord/trace_bl_20260410_201500_a1b2c3.jsonl",
|
||||
"eval_note": "To replay: load trace, re-execute each cycle's actions_planned against a fresh harness in mock mode, compare actions_executed outcomes. Success metric: >=90% action parity between original and replay runs."
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{"cycle_index": 0, "timestamp_start": "2026-04-10T20:15:00+00:00", "timestamp_end": "2026-04-10T20:15:45+00:00", "duration_ms": 45000, "screenshot_path": "/tmp/bannerlord_capture_1744320900.png", "window_found": true, "screen_size": [1920, 1080], "mouse_position": [960, 540], "playtime_hours": 142.5, "players_online": 8421, "is_running": true, "actions_planned": [{"type": "move_to", "x": 960, "y": 540}, {"type": "press_key", "key": "space"}], "decision_note": "Initial state capture. Move to screen center and press space to advance.", "actions_executed": [{"success": true, "action": "move_to", "params": {"type": "move_to", "x": 960, "y": 540}, "timestamp": "2026-04-10T20:15:30+00:00", "error": null}, {"success": true, "action": "press_key", "params": {"type": "press_key", "key": "space"}, "timestamp": "2026-04-10T20:15:45+00:00", "error": null}], "actions_succeeded": 2, "actions_failed": 0, "hermes_session_id": "f47ac10b", "hermes_log_id": "", "harness_session_id": "f47ac10b"}
|
||||
{"cycle_index": 1, "timestamp_start": "2026-04-10T20:15:45+00:00", "timestamp_end": "2026-04-10T20:16:30+00:00", "duration_ms": 45000, "screenshot_path": "/tmp/bannerlord_capture_1744320945.png", "window_found": true, "screen_size": [1920, 1080], "mouse_position": [960, 540], "playtime_hours": 142.5, "players_online": 8421, "is_running": true, "actions_planned": [{"type": "press_key", "key": "p"}], "decision_note": "Open party screen to inspect troops.", "actions_executed": [{"success": true, "action": "press_key", "params": {"type": "press_key", "key": "p"}, "timestamp": "2026-04-10T20:16:00+00:00", "error": null}], "actions_succeeded": 1, "actions_failed": 0, "hermes_session_id": "f47ac10b", "hermes_log_id": "", "harness_session_id": "f47ac10b"}
|
||||
{"cycle_index": 2, "timestamp_start": "2026-04-10T20:16:30+00:00", "timestamp_end": "2026-04-10T20:17:30+00:00", "duration_ms": 60000, "screenshot_path": "/tmp/bannerlord_capture_1744321020.png", "window_found": true, "screen_size": [1920, 1080], "mouse_position": [960, 540], "playtime_hours": 142.5, "players_online": 8421, "is_running": true, "actions_planned": [{"type": "press_key", "key": "escape"}, {"type": "move_to", "x": 500, "y": 300}, {"type": "click", "x": 500, "y": 300}], "decision_note": "Close party screen, click on campaign map settlement.", "actions_executed": [{"success": true, "action": "press_key", "params": {"type": "press_key", "key": "escape"}, "timestamp": "2026-04-10T20:16:45+00:00", "error": null}, {"success": true, "action": "move_to", "params": {"type": "move_to", "x": 500, "y": 300}, "timestamp": "2026-04-10T20:17:00+00:00", "error": null}, {"success": true, "action": "click", "params": {"type": "click", "x": 500, "y": 300}, "timestamp": "2026-04-10T20:17:30+00:00", "error": null}], "actions_succeeded": 3, "actions_failed": 0, "hermes_session_id": "f47ac10b", "hermes_log_id": "", "harness_session_id": "f47ac10b"}
|
||||
166
style.css
166
style.css
@@ -200,61 +200,6 @@ canvas#nexus-canvas {
|
||||
box-shadow: 0 0 20px var(--color-primary);
|
||||
}
|
||||
|
||||
/* === TOOLTIP SYSTEM === */
|
||||
/* Any element with data-tooltip gets a hover tooltip label */
|
||||
[data-tooltip] {
|
||||
position: relative;
|
||||
}
|
||||
[data-tooltip]::after {
|
||||
content: attr(data-tooltip);
|
||||
position: absolute;
|
||||
right: calc(100% + 10px);
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
background: rgba(5, 5, 16, 0.95);
|
||||
color: var(--color-primary);
|
||||
font-family: var(--font-body);
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.05em;
|
||||
padding: 4px 10px;
|
||||
border: 1px solid var(--color-primary-dim);
|
||||
border-radius: 4px;
|
||||
white-space: nowrap;
|
||||
pointer-events: none;
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s ease;
|
||||
backdrop-filter: blur(8px);
|
||||
box-shadow: 0 0 12px rgba(74, 240, 192, 0.15);
|
||||
z-index: 100;
|
||||
}
|
||||
[data-tooltip]:hover::after,
|
||||
[data-tooltip]:focus-visible::after {
|
||||
opacity: 1;
|
||||
}
|
||||
/* For elements positioned on the right side, tooltip appears to the left */
|
||||
.hud-top-right [data-tooltip]::after {
|
||||
right: calc(100% + 10px);
|
||||
}
|
||||
/* For inline/badge elements where right-side tooltip might clip */
|
||||
.hud-status-item[data-tooltip]::after {
|
||||
right: auto;
|
||||
left: calc(100% + 10px);
|
||||
}
|
||||
|
||||
/* Focus-visible ring for keyboard navigation */
|
||||
.hud-icon-btn:focus-visible,
|
||||
.hud-status-item:focus-visible,
|
||||
.atlas-close-btn:focus-visible,
|
||||
.vision-close-btn:focus-visible,
|
||||
.portal-close-btn:focus-visible,
|
||||
.memory-panel-close:focus-visible,
|
||||
.memory-panel-pin:focus-visible,
|
||||
.session-room-close:focus-visible {
|
||||
outline: 2px solid var(--color-primary);
|
||||
outline-offset: 2px;
|
||||
box-shadow: 0 0 16px rgba(74, 240, 192, 0.4);
|
||||
}
|
||||
|
||||
.hud-status-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -1174,7 +1119,7 @@ canvas#nexus-canvas {
|
||||
|
||||
.chat-quick-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
padding: 8px 12px;
|
||||
border-top: 1px solid var(--color-border);
|
||||
@@ -1182,75 +1127,6 @@ canvas#nexus-canvas {
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.chat-quick-actions.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.starter-label {
|
||||
font-family: var(--font-display);
|
||||
font-size: 9px;
|
||||
letter-spacing: 0.15em;
|
||||
color: var(--color-primary-dim);
|
||||
text-transform: uppercase;
|
||||
padding: 0 2px;
|
||||
}
|
||||
|
||||
.starter-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.starter-btn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 1px;
|
||||
background: rgba(74, 240, 192, 0.06);
|
||||
border: 1px solid rgba(74, 240, 192, 0.15);
|
||||
color: var(--color-primary);
|
||||
font-family: var(--font-body);
|
||||
padding: 6px 8px;
|
||||
cursor: pointer;
|
||||
transition: all var(--transition-ui);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.starter-btn:hover {
|
||||
background: rgba(74, 240, 192, 0.15);
|
||||
border-color: var(--color-primary);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.starter-btn:hover .starter-icon {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.starter-btn:active {
|
||||
transform: scale(0.97);
|
||||
}
|
||||
|
||||
.starter-icon {
|
||||
font-size: 12px;
|
||||
color: var(--color-primary);
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.starter-text {
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.starter-desc {
|
||||
font-size: 8px;
|
||||
color: rgba(74, 240, 192, 0.5);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* Add hover effect for MemPalace mining button */
|
||||
.quick-action-btn:hover {
|
||||
background: var(--color-primary-dim);
|
||||
@@ -1396,9 +1272,6 @@ canvas#nexus-canvas {
|
||||
.hud-location {
|
||||
font-size: var(--text-xs);
|
||||
}
|
||||
.starter-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
@@ -1724,43 +1597,6 @@ canvas#nexus-canvas {
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════════════════
|
||||
PROJECT MNEMOSYNE — EXPORT/IMPORT ACTIONS (#1174)
|
||||
═══════════════════════════════════════════════════════ */
|
||||
|
||||
.memory-panel-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-top: 10px;
|
||||
padding-top: 10px;
|
||||
border-top: 1px solid rgba(123, 92, 255, 0.15);
|
||||
}
|
||||
|
||||
.mnemosyne-action-btn {
|
||||
flex: 1;
|
||||
padding: 6px 10px;
|
||||
background: rgba(123, 92, 255, 0.12);
|
||||
border: 1px solid rgba(123, 92, 255, 0.3);
|
||||
border-radius: 6px;
|
||||
color: #a08cff;
|
||||
font-size: 11px;
|
||||
font-family: monospace;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s ease;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.mnemosyne-action-btn:hover {
|
||||
background: rgba(123, 92, 255, 0.25);
|
||||
border-color: rgba(123, 92, 255, 0.6);
|
||||
color: #c4b5ff;
|
||||
}
|
||||
|
||||
.mnemosyne-action-btn:active {
|
||||
transform: scale(0.96);
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════════════════
|
||||
PROJECT MNEMOSYNE — SESSION ROOM HUD PANEL (#1171)
|
||||
═══════════════════════════════════════════════════════ */
|
||||
|
||||
Reference in New Issue
Block a user