Commit Graph

276 Commits

Author SHA1 Message Date
anadoris007 16b7ef7521 feat(narrative): set status=alive on new characters 2026-04-20 22:23:59 +05:30
anadoris007 1a73b7f672 feat(narrative): add WorldStateStore for rules, locations, event log 2026-04-20 22:23:38 +05:30
anadoris007 3cf1e28ab9 docs: add God Mode + World State v1 implementation plan
10-task TDD plan covering:
- WorldStateStore (rules, locations, event log)
- Character status field
- 3 God Mode handlers (inject_event, modify_emotion, kill_character)
- Translator prompt extension + dead filter + brace escape
- E2E integration tests for injection and kill
- 6 API endpoints with validation
- 2 Vue views with shared nav + typed-name kill confirmation

Includes 2 marked user-contribution points:
- EVENT_ENFORCEMENT_STRENGTH (soft/medium/hard)
- Location schema fields (minimal vs atmosphere vs time_of_day)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 22:23:00 +05:30
anadoris007 1762c79228 docs: revise God Mode + World State spec per review feedback
Addresses 3 critical + 6 major + 7 minor issues from spec review:
- §5.0 new: specifies translator loads world_state, id/name keying
  conventions, brace-escape for user text in prompt
- §4.2/§4.3: god_mode interventions audit-log to event_log
- §4.3: kill auto-appends death event for narrative visibility
- §4.4: documents concurrency limitation
- §6.4/§6.5: navigation on all 3 views, typed-name kill confirmation
- §10: expanded non-goals (no-delete, unbounded log, global enforcement)
- §8: adds explicit prompt-inclusion regression test

Spec review: Approved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 22:18:57 +05:30
anadoris007 7d292e2b90 docs: add God Mode + World State v1 design spec
Minimal scope: 3 God Mode interventions (inject event, modify emotion,
kill character) + 3 World State primitives (locations, rules, event
log). File-based only — no OASIS simulation changes for v1.

Design trade-off: v1 God Mode affects the prose layer, not the
simulation loop. Agents don't "see" injected events; only the narrator
does. This ships faster and fits the creative-authoring use case.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 22:13:41 +05:30
anadoris007 d651cb830b test(narrative): add end-to-end pipeline test
Full-pipeline test: fake simulation dir → actions.jsonl → two
translate_round calls → assertions on beat persistence, character
evolution, and translator offset advancement.

Final test suite: 20/20 passing across action mapper, character
engine, story store, translator (read + prose + orchestration), and
E2E.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 22:05:08 +05:30
anadoris007 0c9b0c025d feat(narrative): add StoryTimelineView with StoryBeat and CharacterCard
New frontend surface for reading generated stories:
- StoryBeat.vue: renders a round's prose with character attribution
- CharacterCard.vue: compact roster card with animated emotion bars
- StoryTimelineView.vue: reading view with Init Characters, Refresh,
  Translate Next Round, and a tone input
- Route: /story/:simulationId

Recently-active characters are highlighted in the roster. Styling uses
the project's cream/brass palette for consistency with existing views.
Frontend builds cleanly (vite build).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 22:04:28 +05:30
anadoris007 d4557fd8b8 feat(narrative): add frontend API client
Five named exports covering narrative endpoints, following the
existing pattern in frontend/src/api/simulation.js (service +
requestWithRetry + named exports).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 22:02:44 +05:30
anadoris007 727f4403e3 feat(narrative): add narrative API blueprint
Five endpoints under /api/narrative/*:
- GET  /story/<sim_id>                — full story so far
- GET  /story/<sim_id>/round/<num>    — single round
- POST /translate                     — translate a round on demand
- GET  /characters/<sim_id>           — roster with emotional state
- POST /characters/<sim_id>/init      — bootstrap from OASIS profiles

Blueprint registered alongside existing graph/simulation/report
blueprints following the established pattern. Smoke-tested via Flask
test client.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 22:02:16 +05:30
anadoris007 caec8b5c77 feat(narrative): orchestrate round translation with state updates
translate_round() ties together:
  - reading the round's actions from actions.jsonl
  - generating prose via the LLM
  - updating per-character emotional state
  - persisting the beat, characters, and file offset

Full test suite now at 19/19 passing across action mapper, character
engine, story store, and translator.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 22:01:19 +05:30
anadoris007 9db7b399cc feat(narrative): add LLM-driven prose generation
Module-level call_llm() wrapper (patchable by tests) drives
PROSE_PROMPT_TEMPLATE rendering with character summaries, actions,
previous beats, and user-selected tone. Prompt tuned for punchy,
cinematic, dialogue-heavy voice.

Tests: 5/5 passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 22:00:29 +05:30
anadoris007 052fd87acd feat(narrative): add actions.jsonl round reader
Reads one round's worth of agent actions from the OASIS log file,
tracking file offset so callers can resume across translation calls.
Handles missing files, malformed JSON lines, and non-target rounds
gracefully.

Tests: 3/3 passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 21:29:15 +05:30
anadoris007 6b9e6eeeb2 feat(narrative): add CharacterEngine with emotional state tracking
Character profiles now track a six-dimension emotional state (anger,
fear, joy, sadness, trust, surprise) that evolves based on actions
taken. Initial deltas for all 13 OASIS actions chosen as a balanced
baseline (see module docstring for tuning guidance).

Tests: 5/5 passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 21:28:30 +05:30
anadoris007 05aa9f149e feat(narrative): add StoryStore for file-based narrative persistence
Three JSON files per simulation under narrative/ subdir:
- story_beats.json: chronological story passages
- translator_state.json: per-platform file offsets
- characters.json: extended character profiles

Tests: 4/4 passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 20:50:55 +05:30
anadoris007 2d782f04c1 feat(narrative): add action-to-verb mapping for OASIS actions
New narrative package with action_mapper module that maps the 13 OASIS
action types (CREATE_POST, LIKE_POST, REPOST, etc.) to narrative verbs
and interpretations used when generating story prose.

Tests: 4/4 passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 20:50:05 +05:30
anadoris007 c5cc599053 docs: add narrative layer design spec and implementation plan
- docs/superpowers/specs/2026-03-26-narrative-layer-design.md
- docs/superpowers/plans/2026-03-26-narrative-layer-foundation.md

Spec extends MiroFish into a creative storytelling platform via a new
narrative layer over the existing OASIS simulation engine.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 20:41:14 +05:30
666ghj fa0f6519b1 docs: rename README-EN.md to README.md as default English documentation 2026-04-02 16:52:29 +08:00
666ghj 0e9420e0f8 docs: rename README.md to README-ZH.md for Chinese documentation 2026-04-02 16:52:29 +08:00
BaiFu 7d07fb7f03
Merge pull request #440 from Ghostubborn/fix/security-deps
fix(security): 修复前端 3 个高危依赖漏洞
2026-04-02 15:17:46 +08:00
ghostubborn 223b283da7 fix(security): upgrade axios, rollup, picomatch to fix 3 high severity vulnerabilities 2026-04-02 15:00:33 +08:00
BaiFu af71244974
Merge pull request #428 from Ghostubborn/feat/i18n
feat(i18n): 添加多语言切换功能,支持中英文
2026-04-02 14:27:04 +08:00
ghostubborn ed465908db fix(i18n): set HTML lang attribute before Vue mounts via inline script 2026-04-02 14:21:09 +08:00
ghostubborn 65df257e19 chore(deps): upgrade vue-i18n from v9 to v11 2026-04-02 14:20:50 +08:00
ghostubborn f2404903d6 fix(i18n): validate Accept-Language header against registered locales 2026-04-02 14:20:15 +08:00
ghostubborn 2421010fe1 fix(i18n): fix English workflow desc font size with correct CSS selectors 2026-04-01 19:11:22 +08:00
ghostubborn 3929c3ade2 fix(i18n): further shorten English metrics and improve workflow layout 2026-04-01 19:07:19 +08:00
ghostubborn 21922da6cc fix(i18n): improve English layout for homepage left-pane and report title
- Add sans-serif font for English left-pane (status, workflow sections)
- Shorten English workflow step descriptions
- Reduce English report title font-size from 36px to 28px
2026-04-01 19:04:38 +08:00
ghostubborn c6cafdd532 fix(i18n): translate world1/world2 platform labels in interview tool display 2026-04-01 18:38:22 +08:00
ghostubborn 5072a2eaa8 feat(i18n): replace Chinese UI text in Step4Report.vue render functions
Only UI display text is replaced. Regex parsing patterns are kept as-is
since they match the backend output format.
2026-04-01 18:35:18 +08:00
ghostubborn 6db3f98a48 fix(i18n): fix English homepage layout with proper font and shorter copy
- Use sans-serif font for English titles, descriptions and navbar
- Shorten English hero text to avoid overflow
- Fix :global() scoped CSS issue that was setting root font-size to 3.5rem
- Use separate unscoped style block for html[lang] selectors
2026-04-01 18:04:05 +08:00
ghostubborn 24e9bee5be feat(i18n): replace all user-visible Chinese logger messages in zep_tools.py
These are shown to users via ConsoleLogger in the report page.
2026-04-01 17:46:39 +08:00
ghostubborn e79569ab4f feat(i18n): replace all user-visible Chinese in report_agent.py
Covers ReportLogger message fields and logger messages shown via ConsoleLogger.
2026-04-01 17:44:52 +08:00
ghostubborn 1d358fc492 feat(i18n): replace expand/collapse Chinese text in Step4Report.vue 2026-04-01 17:44:45 +08:00
666ghj e3350a919d fix(graph): enforce PascalCase for entity names and SCREAMING_SNAKE_CASE for edge names in ontology validation 2026-04-01 17:42:27 +08:00
ghostubborn 380e456d41 fix(i18n): replace hardcoded Chinese stage names in simulation prepare SSE 2026-04-01 17:31:00 +08:00
ghostubborn 3a8451c119 feat(i18n): replace remaining hardcoded Chinese in frontend addLog calls 2026-04-01 17:21:55 +08:00
ghostubborn 0e55e4cf6b feat(i18n): replace remaining Chinese in config generator and profile generator
Also update simulation prompts to be locale-neutral for timezone/schedule.
2026-04-01 17:19:12 +08:00
ghostubborn 7c07237544 fix(i18n): pass locale to background threads via thread-local storage
Background threads (graph building, simulation prep, report generation,
profile generation) now inherit the requesting user's locale preference.
Previously these fell back to 'zh' because Flask request context was
unavailable in spawned threads.
2026-04-01 16:55:51 +08:00
ghostubborn 592ee52f59 feat(i18n): replace remaining hardcoded Chinese in progress callbacks 2026-04-01 16:53:29 +08:00
ghostubborn da2490ec31 fix(i18n): protect JSON field values from language instruction in config generator
Ensure poster_type stays PascalCase English and stance stays English enum
values regardless of language setting. Only natural language fields follow
the user's language preference.
2026-04-01 16:41:22 +08:00
ghostubborn 97aa58384e fix(i18n): ensure ontology names stay PascalCase regardless of language setting
The language instruction was causing LLM to change entity/relation naming
conventions. Now explicitly enforce PascalCase/UPPER_SNAKE_CASE for technical
identifiers while only applying language preference to description fields.
2026-04-01 16:40:17 +08:00
ghostubborn e1db8bacc2 feat(i18n): replace hardcoded Chinese in frontend addLog() messages 2026-04-01 16:35:35 +08:00
ghostubborn 9d43b77511 feat(i18n): replace hardcoded Chinese in backend SSE progress messages 2026-04-01 16:32:10 +08:00
ghostubborn ffe6369c52 fix(i18n): fix curly quotes in Home.vue and remove unused dark theme from LanguageSwitcher 2026-04-01 16:23:52 +08:00
ghostubborn f75c6487b3 fix(i18n): replace remaining hardcoded language directives in LLM prompts
- oasis_profile_generator: replace hardcoded "使用中文" with dynamic get_language_instruction()
- ontology_generator: remove hardcoded "(中文)" from schema annotation
- report_agent: replace Chinese-specific language consistency rules with language-neutral ones
- zep_tools: dynamically select quote style based on locale
2026-04-01 15:55:04 +08:00
ghostubborn fbaa3dbbeb fix(i18n): fix curly quotes and missing @ alias in vite config 2026-04-01 15:45:43 +08:00
ghostubborn fc47ae81b5 feat(i18n): replace hardcoded Chinese in frontend components with i18n calls
Replace all user-visible hardcoded Chinese strings in 7 component files
with $t() / t() calls using vue-i18n:

- Step1GraphBuild: ontology generation, graph build, status badges
- Step2EnvSetup: simulation setup, agent personas, platform config,
  time config, initial activation, modal profile details
- Step3Simulation: report generation button
- Step4Report: section loading text, interaction button
- Step5Interaction: chat interface, survey UI, tool descriptions,
  error messages, agent selection
- GraphPanel: graph status hints, loading states, tooltips
- HistoryDatabase: history cards, modal, replay buttons

Added missing translation keys to both zh.json and en.json locale files.
Added useI18n imports to components that need script-level translations.
2026-04-01 15:43:11 +08:00
ghostubborn 70833821a2 feat(i18n): replace hardcoded Chinese in frontend views with i18n calls 2026-04-01 15:36:29 +08:00
ghostubborn 74f673a238 feat(i18n): replace hardcoded Chinese in backend API responses with t() calls 2026-04-01 15:32:24 +08:00
ghostubborn 3d5e5d024d feat(i18n): add language switcher component to navigation 2026-04-01 15:24:58 +08:00