Skip to content

feat: AgentEvent types, Decimal monetary fields, brand unification#124

Merged
luokerenx4 merged 4 commits intomasterfrom
dev
Apr 15, 2026
Merged

feat: AgentEvent types, Decimal monetary fields, brand unification#124
luokerenx4 merged 4 commits intomasterfrom
dev

Conversation

@luokerenx4
Copy link
Copy Markdown
Contributor

Summary

Three significant changes that touch core infrastructure:

1. AgentEvent type system (5fde2d1) — 8 files, +378/-12

Introduces AgentEventMap, a typed registry that maps event type strings (e.g. cron.fire, heartbeat.done, message.received) to their payload interfaces. Each event type gets:

  • Compile-time safetyEventLog.append() now has typed overloads, so payloads are checked at the call site
  • Runtime validation — TypeBox schemas compiled to Ajv validators, so malformed payloads are caught before they hit the log
  • Typed subscriptionssubscribeType('cron.fire', cb) gives the callback a properly typed payload, removing all manual as casts

All existing consumers (CronListener, Heartbeat, SnapshotScheduler, ConnectorCenter) migrated to typed API. Also adds a trigger event type for future webhook/API ingest.

2. Decimal monetary fields (dbe3535) — 31 files, +405/-389

Eliminates IEEE 754 floating-point artifacts (e.g. 0.30000000000000004) from all monetary fields across the entire trading stack. This is a breaking interface change:

  • Position.avgCost, marketPrice, marketValue, unrealizedPnL, realizedPnLnumber to string
  • AccountInfo.netLiquidation, totalCashValue, buyingPower, etc. → number to string
  • GitState, AggregatedEquity, UTASnapshot — all monetary fields follow
  • All broker implementations (CCXT, Alpaca, IBKR, Mock) now use Decimal arithmetic internally and output .toString()
  • IBKR SDK decoder updated: updatePortfolio callback passes string values via decodeDecimal() instead of decodeFloat(parseFloat)
  • Frontend (PortfolioPage, api/types.ts) updated to consume string values

3. Brand unification (7a7f586) — 11 files, +19/-19

Replace all instances of "Open Alice" (with space) with "OpenAlice" (no space) for consistent branding and SEO. Covers README, CLAUDE.md, CONTRIBUTING, CHANGELOG, package.json, UI title/sidebar, cliff.toml, and ibkr DESIGN.md.

Test plan

  • pnpm test — unit tests pass (especially agent-event, event-log, TradingGit, guards, broker, fx-service specs)
  • npx tsc --noEmit — no type errors from the number→string migration
  • Verify portfolio page renders monetary values correctly (no NaN, no floating-point artifacts)
  • Verify event log accepts typed events and rejects malformed payloads
  • Check "OpenAlice" branding appears correctly in UI sidebar and browser tab

🤖 Generated with Claude Code

Ame and others added 4 commits April 15, 2026 11:18
Define AgentEventMap — a typed registry mapping event type strings to
their payload interfaces. Each type has a TypeBox schema compiled to an
Ajv validator. EventLog.append() now validates payloads at runtime and
provides typed overloads for compile-time safety.

Migrated all consumers to use typed subscriptions, removing manual
`as` casts. Added `trigger` event type for future webhook/API ingest.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… fields

All monetary fields (avgCost, marketPrice, marketValue, unrealizedPnL,
realizedPnL, netLiquidation, totalCashValue, etc.) changed from number
to string across Position, AccountInfo, GitState, and AggregatedEquity
interfaces. Broker computations now use Decimal arithmetic internally
and output .toString(). This prevents IEEE 754 artifacts like
0.30000000000000004 from reaching the frontend.

The IBKR SDK decoder also updated — updatePortfolio callback now passes
string values via decodeDecimal() instead of decodeFloat(parseFloat).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace all instances of "Open Alice" with "OpenAlice" across docs,
config, and UI for consistent branding and better SEO matching.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Decimal migration changed AggregatedEquity fields to string but
missed the inline return type in api/trading.ts, causing CI build
failure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@luokerenx4 luokerenx4 merged commit 091f744 into master Apr 15, 2026
2 checks passed
timFinn pushed a commit to timFinn/OpenAlice that referenced this pull request Apr 16, 2026
Upstream changes:
- AgentEvent type system with runtime validation
- Decimal precision for monetary fields (all brokers)
- Profile-based AI config with preset catalog
- Codex AI provider (OpenAI via ChatGPT OAuth)
- UI reorganization (Automation, Logs, News pages)
- News feed view with filtering + /api/news endpoint
- Currency-aware portfolio + FX rates
- CCXT Hyperliquid support + dynamic credentials
- Commodity canonical naming + catalog
- Telegram auth + trading panel
- Session awareness tools + Dev workbench

Fork features preserved:
- Signal router (8 signals, 2m poll)
- Market Pulse dashboard (/pulse)
- Paper bot scorecard + attribution
- Economy tools (FRED, CPI, rates)
- Quote streaming (Alpaca WS + CCXT Pro)
- Safety guards (6 autonomous guards)
- Dual account architecture
- Heartbeat active-hours + compaction
- Fear & Greed, GDELT, prediction markets

Merge fixes:
- Guards/portfolio-analytics adapted to Decimal string fields
- Calculator spec updated for CalculateOutput { value, dataRange }
- Technical indicators (STOCHRSI, ADX, OBV, VWAP, PIVOT) accept TrackedValues
- Persona hot-reload merged with date injection
- Commodity provider uses correct providers.commodity config
timFinn added a commit to timFinn/OpenAlice that referenced this pull request Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant