Commit Graph

291 Commits

Author SHA1 Message Date
anadoris007 8382f1ed7a
Merge 484689735f into 96096ea0ff 2026-05-28 17:40:45 -04:00
BaiFu 96096ea0ff
Merge pull request #640 from lllopic/fix/add-type-hints-and-helper-method
refactor: add type hints and FileParser.is_supported() helper
2026-05-25 00:48:57 +08:00
666ghj 3f4d56116c fix(backend): constrain Python version to 3.11-3.12 2026-05-24 22:59:36 +08:00
BaiFu db1bc144ff
Merge pull request #641 from YunyueLi/docs/readme-polish
docs(readme): fix typo in Shanda logo alt text
2026-05-24 02:02:46 +08:00
YunyueLi faa151131c docs(readme): fix typo in Shanda logo alt text
The Shanda sponsor logo's alt text was `666ghj%2MiroFish | Shanda`,
missing the `F` from the URL-encoded `/`. Every other badge in both
READMEs uses the correct `666ghj%2FMiroFish`. Bring this one in line
with the rest.
2026-05-23 16:30:55 +08:00
lllopic daec4b6be4 refactor: add type hints and FileParser.is_supported() helper
- Add return type annotation (list[str]) to Config.validate()
- Add type annotations (msg: str, -> None) to logger convenience functions
- Add FileParser.is_supported() classmethod for checking file format support
2026-05-23 14:57:46 +08:00
anadoris007 484689735f feat(narrative): add GodModeView, WorldBuilderView, cinematic locations
- New Vue views: GodModeView (inject event, modify emotions with
  preloaded current values, kill character with typed-name
  confirmation) and WorldBuilderView (rules editor, locations with
  cinematic atmosphere field, event log viewer)
- Shared sim-nav strip across Story/GodMode/World views
- Location schema extended with optional atmosphere field — a short
  mood phrase that anchors the opening visual of every scene set there
- Translator's _format_world_locations surfaces atmosphere to the LLM
  prompt so the field actually influences generation
- Routes added for /godmode/:simId and /world/:simId

Tests: 39/39 passing (added test_location_atmosphere_surfaces_in_prompt).
Frontend builds clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-22 15:01:08 +05:30
anadoris007 e7eef9fa28 feat(narrative): add frontend API client for world + god mode 2026-04-22 14:57:06 +05:30
anadoris007 2eb98a00bd feat(narrative): add world + god mode API endpoints
Six new endpoints under /api/narrative/*:
- GET  /world/<sim_id>                       — full world state
- POST /world/<sim_id>/rules                 — replace rules list
- POST /world/<sim_id>/locations             — upsert location
- POST /godmode/<sim_id>/inject-event        — inject world event
- POST /godmode/<sim_id>/modify-emotion      — overwrite emotions
- POST /godmode/<sim_id>/kill                — kill character

Validation:
- 400 on missing required fields (description, character_id, rules)
- 400 on invalid round (must be non-negative int or null)
- 404 on character not found (from ValueError in handlers)

Smoke-tested via Flask test client — all 11 response codes correct.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-22 14:56:36 +05:30
anadoris007 aabe9b42a2 test(narrative): fix dead-filter e2e test — need living actor in round 2
When Marcus (the only round-2 actor) was killed, generate_prose
short-circuited on empty actions without calling the LLM, so
mock_llm.call_args_list only had one entry. Added Elena as a
second round-2 actor to exercise the filter with a live participant.
2026-04-22 14:55:28 +05:30
anadoris007 c223d77267 test(narrative): add e2e tests for event injection and kill 2026-04-22 14:55:03 +05:30
anadoris007 d3bec344c7 feat(narrative): extend translator with world context + dead filter
- PROSE_PROMPT_TEMPLATE extended with world_rules, world_events,
  world_locations, and event_enforcement substitution fields
- EVENT_ENFORCEMENT_STRENGTH set to "hard" — opening line MUST
  reference the most recent world event (aligns with existing
  punchy, cinematic voice)
- Character summaries now resolve location id → name for prompts
- translate_round loads world_state and filters dead characters
  from both the roster and the action list before prose generation
- User-supplied strings (rules, events, locations) brace-escaped
  before str.format() to prevent KeyError on stray { or }

Tests: 36/36 passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-22 14:54:22 +05:30
anadoris007 a569976d55 feat(narrative): add god_mode.kill_character with auto-death event 2026-04-20 22:25:24 +05:30
anadoris007 f25f68837c feat(narrative): add god_mode.modify_emotion with audit logging 2026-04-20 22:24:54 +05:30
anadoris007 f91dd00f37 feat(narrative): add god_mode.inject_event handler 2026-04-20 22:24:28 +05:30
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