159 Commits

Author SHA1 Message Date
Patrick Fanella
c313eed706 Merge pull request #87 from subculture-collective/feat/twitch-bot
feat(twitch): wire tmi.js IRC bot and connect to court API
2026-03-01 10:59:09 -06:00
Patrick Fanella
eebdb39015 Merge pull request #86 from subculture-collective/feat/sfx-audio
feat(sfx): wire Howler.js SFX audio into renderer
2026-03-01 10:58:49 -06:00
Patrick Fanella
0ee79d4c64 Merge pull request #89 from subculture-collective/copilot/sub-pr-87
fix(twitch): address IRC bot review feedback — start guard, self-echo, botUsername, session cache, env restore
2026-03-01 10:58:35 -06:00
Patrick Fanella
b9a08a0a7a Merge pull request #88 from subculture-collective/copilot/sub-pr-86
fix(sfx): address audio.js bugs, vendor Howler, fix README path, remove unrelated doc
2026-03-01 10:58:22 -06:00
copilot-swe-agent[bot]
671c7d7dc3 fix(sfx): address PR review - audio bugs, README path, vendor Howler, remove unrelated doc
Co-authored-by: PatrickFanella <61631520+PatrickFanella@users.noreply.github.com>
2026-03-01 16:48:55 +00:00
copilot-swe-agent[bot]
7cefd1f8e6 fix(twitch): address all 5 PR review comments
Co-authored-by: PatrickFanella <61631520+PatrickFanella@users.noreply.github.com>
2026-03-01 16:43:59 +00:00
copilot-swe-agent[bot]
f38a2c84b3 Initial plan 2026-03-01 16:39:45 +00:00
copilot-swe-agent[bot]
e000d4acd6 Initial plan 2026-03-01 16:39:25 +00:00
ce2ff8d268 docs: add SFX and Twitch bot implementation plans 2026-03-01 10:26:39 -06:00
32c3ec28cf test(twitch): add forwardCommand routing tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 10:14:19 -06:00
8306c4dcef fix(twitch): use structured logger for bot startup error
Replace console.warn with the structured logger already imported and used
throughout server.ts, keeping the logging style consistent with other
warn calls in the file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 10:12:31 -06:00
8ec5e1eaf1 feat(twitch): initialise TwitchBot in server startup, noop when credentials absent
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 10:10:43 -06:00
5dc395b152 fix(twitch): remove all listeners on stop, document tmi.d.ts workaround
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 10:09:28 -06:00
9799dfafa9 feat(twitch): implement connectIRC with tmi.js, add forwardCommand
- Add getActiveSessionId callback to BotConfig interface
- Add tmi.d.ts module declaration (tmi.js 1.8.5 ships no TypeScript types)
- Import Client and ChatUserstate from tmi.js via named imports
- Replace connectIRC stub with real tmi.Client setup: identity, channel subscription, message handler
- Message handler resolves active session ID per-message and delegates to forwardCommand
- Add forwardCommand: routes press/present/vote/sentence to court API endpoints via fetch
- Update stop() to disconnect tmi.Client and null the field
- Add getActiveSessionId: async () => null stub to initTwitchBot env-var fallback config

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 10:05:44 -06:00
2432f435a4 feat(twitch): wire commands.ts into TwitchBot.parseCommand
Delegates parseCommand to parseChatCommand from commands.ts after rate-limit
check, aligns ParsedCommand.params to required (matching CommandParseResult),
and adds bot.test.ts with 5 passing unit tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 10:01:03 -06:00
0b957a9bff docs: add assets/sfx README with placeholder instructions 2026-03-01 09:59:16 -06:00
a6a9843a0a feat(sfx): initialise Howler audio in createCourtRenderer 2026-03-01 09:58:14 -06:00
5c7db075a7 feat(sfx): wire audio.playSfx into objection/holdIt/takeThat cues 2026-03-01 09:56:27 -06:00
43efce1305 fix(sfx): wrap Howl instantiation in try-catch for graceful error handling 2026-03-01 09:55:25 -06:00
a4ebe2c564 feat(sfx): add audio.js Howler module 2026-03-01 09:53:45 -06:00
dc270c9753 chore: add Howler.js CDN to index.html 2026-03-01 09:52:24 -06:00
Patrick Fanella
6cc6249e23 Merge pull request #84 from subculture-collective/feat/court-flow-redesign
feat: court flow redesign — structured witness exam, objections, random events, pacing
2026-03-01 09:41:18 -06:00
Patrick Fanella
1c69a06aea Merge pull request #85 from subculture-collective/copilot/sub-pr-84
fix: address review feedback on court flow redesign — objection routing, RNG, pacing, shuffle
2026-03-01 09:41:07 -06:00
copilot-swe-agent[bot]
d8a3d5f312 fix: apply review feedback — injectable RNG, Fisher-Yates, objection routing, pacing, doc fix
Co-authored-by: PatrickFanella <61631520+PatrickFanella@users.noreply.github.com>
2026-03-01 15:31:40 +00:00
copilot-swe-agent[bot]
99fec3c669 Initial plan 2026-03-01 15:25:04 +00:00
00a7465153 feat: display-based pacing at 200 CPM
Replace hard-coded PAUSE_MS delays after generated turns with pauses
calculated from dialogue length at 200 characters-per-minute, firing
the next LLM call at 80% of display time (pre-fetch ratio) so the
response arrives just as the current line finishes rendering.

Also set the client typewriter to 200 CPM (from 48 chars/sec) so
server and renderer stay in sync.

- Add DISPLAY_CPM=200, PREFETCH_RATIO=0.8, displayPauseMs() to session-flow.ts
- Remove openingBetweenSides, witnessBetweenTurns, closingBetweenSides from PAUSE_MS
- Capture generateBudgetedTurn return value wherever a post-turn pause follows
- runRandomEvent now returns Promise<CourtTurn> so callers can pace by it
- Remove redundant pre-bailiff pause (witnessBetweenCycles covers witness gaps)
- public/app.js: TYPEWRITER_CHARS_PER_SECOND = 200 / 60

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 09:20:39 -06:00
085de3b515 fix: remove unused prosecutorTurn variable in direct exam loop 2026-02-28 23:23:55 -06:00
22215ad920 feat: restructure witness exam — bailiff intro, direct/cross, script builder, random events, objections
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 23:21:12 -06:00
d2119c1dff feat: two-layer objection detection — organic self-trigger + classifier safety net
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 23:17:35 -06:00
6c1215f3cb feat: random event catalogue with injectable rng for deterministic testing 2026-02-28 23:15:20 -06:00
c7424bd5ed fix: npm test glob — let node expand src/**/*.test.ts so phases tests are discovered 2026-02-28 23:13:25 -06:00
851f1bac88 feat: witness script builder draws variable round counts per witness
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 23:12:22 -06:00
773fae07bf feat: increase pacing delays for Twitch viewing comfort 2026-02-28 23:10:05 -06:00
b3d12fd3c5 feat: randomise mock dialogue fallback with versatile category lines
Replace the single hardcoded string per category in mockReply with module-level
MOCK_LINES / MOCK_LINES_DEFAULT pools (5-6 generic lines each) and a pickRandom
helper, eliminating repetitive output during live runs. Loosen the brittle test
assertion from a literal string match to a non-empty check.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 23:08:41 -06:00
3ff7d8d6c8 docs: court flow redesign implementation plan
6-task plan: mock dialogue variety, pacing, script builder,
random events, objection detection, witness exam rewrite.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 22:59:20 -06:00
8c19d06604 docs: court flow redesign design doc
Approved design for witness exam restructure, script builder,
random events, layered LLM objections, pacing increases, and
mock dialogue variety.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 22:54:49 -06:00
Patrick Fanella
75ad740996 Merge pull request #83 from subculture-collective/feat/aa-character-agents
feat: replace abstract agents with 13 Ace Attorney characters
2026-02-28 22:13:17 -06:00
3779978768 chore: AA character agents implementation complete
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 19:51:49 -06:00
7d8e93932b fix: update test files to use AA character agent IDs
Replace hardcoded old agent IDs ('chora', 'subrosa', 'thaum', 'praxis',
'mux', 'primus') with their AA character equivalents ('phoenix',
'edgeworth', 'maya', 'apollo', 'gumshoe', 'godot') across all test
files. Also updates orchestrator.test.ts to use participantsFromRoleAssignments(assignCourtRoles()) pattern and import.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 19:49:41 -06:00
2cdcef0720 fix: degrade empty participants override to auto-cast instead of 500
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 19:47:44 -06:00
d121250e14 feat: await async buildCourtSystemPrompt, auto-cast session participants from archetype pools
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 19:46:08 -06:00
7783fc4fcb feat: make buildCourtSystemPrompt async, inject voice persona and transcript samples
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 19:43:23 -06:00
f28afd5dec fix: scope pickOne fallback to source pool, not global AGENT_IDS 2026-02-28 19:41:53 -06:00
398fd8bdba feat: rewrite assignCourtRoles with archetype pool drawing, add participantsFromRoleAssignments
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 19:39:38 -06:00
9572ae2aa0 feat: add transcript-sampler singleton with lazy-load cache and TDD tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 19:37:20 -06:00
49b4fa42ab feat: add 13 AA character agent configs with voice personas and role archetypes 2026-02-28 19:34:51 -06:00
f9b002640b docs: clarify RoleArchetype vs CourtRole distinction with comment 2026-02-28 19:32:42 -06:00
854fd079b7 feat: replace AgentId union with AA character slugs, add RoleArchetype
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 19:30:32 -06:00
8c2fc66b68 docs: add AA character agents implementation plan
Step-by-step TDD plan for replacing abstract agents with 13 Ace Attorney
characters, including transcript sampler, archetype pool casting, and
async prompt injection.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 19:16:14 -06:00
3680870ae6 docs: add AA character agents design doc
Captures the approved design for replacing abstract agents with 13 Ace
Attorney characters, including roster, role archetypes, runtime transcript
sampling, and prompt integration plan.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-28 19:11:11 -06:00