Skip to content

Support MSAgent 2.1 ACD Features - #113

Merged
azayrahmad merged 27 commits into
mainfrom
feat/acd-v2-support-12940085162625515228
Apr 13, 2026
Merged

azayrahmad merged 27 commits into
mainfrom
feat/acd-v2-support-12940085162625515228

Conversation

@azayrahmad

Copy link
Copy Markdown
Owner

This PR enhances the CharacterParser and associated data structures to support the full Microsoft Agent 2.1 specification, as used by newer agents like "Genie".

Key changes:

  • Extended Metadata: Added support for TTS engine/mode IDs, gender, age, and style properties in the Character definition.
  • Lip-Syncing: Introduced MouthDefinition and parsing logic for DefineMouth blocks within animation frames.
  • Robust Parsing:
    • Expanded LCID_MAP to support a wider range of international locales found in modern ACDs.
    • Added support for style flag naming variations (e.g., AXS_BALLOON_SIZETOTEXT).
    • Implemented Windows-style path normalization (\ to /).
    • Fixed an issue where the parser would stop early if EndCharacter was not at the end of the file.
  • Improved Balloon Configuration: Added fontWeight and italic properties to the Balloon interface.

Verified with a new test suite tests/CharacterParserV2.test.ts covering all new properties and edge cases.


PR created automatically by Jules for task 12940085162625515228 started by @azayrahmad

- Update `Character` and `Balloon` types with extended metadata (TTS, icons, font styles)
- Implement `DefineMouth` parsing for lip-syncing support
- Expand LCID map with 20+ additional locales
- Handle `AXS_BALLOON_SIZETOTEXT` naming variation
- Normalize file paths to use forward slashes
- Ensure parser processes all sections regardless of block order

Co-authored-by: azayrahmad <10110227+azayrahmad@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

- Updated `Character`, `Balloon`, and `FrameDefinition` types to include all v2.1 metadata (TTS, mouth overlays, font styles).
- Enhanced `CharacterParser` to handle `DefineMouth` blocks, extended style flags, and more than 20 new LCID mappings.
- Improved path normalization for Windows-style ACD files.
- Updated `optimize-agent.ts` to include mouth bitmaps in texture atlas generation.
- Added comprehensive test suite for all new features.

Co-authored-by: azayrahmad <10110227+azayrahmad@users.noreply.github.com>
@azayrahmad
azayrahmad force-pushed the feat/acd-v2-support-12940085162625515228 branch from 772d558 to 55de0c7 Compare March 25, 2026 06:29
google-labs-jules Bot and others added 25 commits March 25, 2026 06:36
- Support extended character metadata (TTS, icons, font weight, italics)
- Implement `DefineMouth` parsing and optimization for lip-syncing
- Support 20+ additional locales in `LCID_MAP`
- Hardened `CharacterParser`: case-insensitive keywords/keys, BOM stripping, universal line endings
- Refined `Balloon` UI to apply character-defined font styles
- Updated `optimize-agent.ts` to handle mouth shape layers
- Added comprehensive regression tests for v2.1 features and parser robustness

Co-authored-by: azayrahmad <10110227+azayrahmad@users.noreply.github.com>
- Support extended character metadata (TTS, icons, font weight, italics)
- Implement `DefineMouth` parsing and optimization for lip-syncing
- Support 20+ additional locales in `LCID_MAP`
- Hardened `CharacterParser`: case-insensitive keywords/keys, BOM stripping, universal line endings
- Refined `Balloon` UI to apply character-defined font styles
- Updated `optimize-agent.ts` to handle mouth shape layers
- Added comprehensive regression tests for v2.1 features and parser robustness

Co-authored-by: azayrahmad <10110227+azayrahmad@users.noreply.github.com>
- Ensure 0-duration pause frames fallback to the last rendered frame's exitBranch when exiting.
- Fix issue where terminal null frames would reset the animation instead of following the visible frame's exit path.
- Remove premature auto-exit signal to maintain indefinite pause until explicitly stopped.
- Update tests to verify correct exit pathing from terminal null frames.

Co-Authored-By: azayrahmad <10110227+azayrahmad@users.noreply.github.com>
…e-12964854498349124373

Pause animations on 0-duration frames with no branches
- Refactored AnimationManager to use a formal state machine (Idle, Playing, Exiting).
- Encapsulated playback logic and context within the machine.
- Exposed `playbackState` for external monitoring.
- Updated the Demo's debug panel to display the current animation playback state.
- Ensured all existing animation tests pass with the new implementation.

Co-authored-by: azayrahmad <10110227+azayrahmad@users.noreply.github.com>
…loops

- Implemented a formal state machine (Idle, Playing, Exiting) in AnimationManager.
- Encapsulated animation playback logic and context within the machine.
- Added 'exitHistory' tracking to detect and break infinite loops in cyclic exit branches (fixing DoMagic2).
- Updated the Demo debug panel to display the current 'Anim State'.
- Added regression tests for infinite exit loop prevention.

Co-authored-by: azayrahmad <10110227+azayrahmad@users.noreply.github.com>
…ne-18154006291709009044

Implement AnimationManager State Machine and Debug Visibility
Modified `tests/Agent.test.ts` to ensure `AnimationManager` is in a valid 'Playing' state before asserting on `isExitingFlag`.

- Replaced shallow mocks of `isAnimating` with real state transitions using `setAnimation`.
- Updated `playAnimation` mock in `startTalkingAnimation` test to properly transition the internal machine to 'Playing' and 'Speaking' states.
- Added missing `drawFrame` method to `SpriteManager` mock to prevent unhandled errors during animation updates.

These changes ensure the tests correctly exercise the `AnimationManager` state machine logic rather than relying on inconsistent manual mocks.

Co-authored-by: azayrahmad <10110227+azayrahmad@users.noreply.github.com>
- Introduced `VisemeManager` for text-to-phoneme mapping and viseme scheduling.
- Updated `SpriteManager` and `AnimationManager` to support mouth shape overlays.
- Enhanced `Balloon` to emit word-level speak events with timing information.
- Coordinated lip-sync logic in `AgentCore` for real-time mouth animation during speech.
- Supported both system TTS and character-by-character typing synchronization.
- Ensured mouth animations continue during logic frames (duration 0).

Co-authored-by: azayrahmad <10110227+azayrahmad@users.noreply.github.com>
- Introduced `VisemeManager` for text-to-phoneme mapping and viseme scheduling.
- Updated `SpriteManager` and `AnimationManager` to support mouth shape overlays.
- Enhanced `Balloon` to emit word-level speak events with timing information.
- Coordinated lip-sync logic in `AgentCore` for real-time mouth animation during speech.
- Supported both system TTS and character-by-character typing synchronization.
- Ensured mouth animations continue during logic frames (duration 0).
- Verified with Playwright demonstration using the Genie character.

Co-authored-by: azayrahmad <10110227+azayrahmad@users.noreply.github.com>
…62314039679324

Implement Phoneme-based Viseme Lip-Sync
…h-6348959888700850081

Fix state mismatch in Agent tests
Updates `ActionManager.moveTo` to properly handle characters like Genie
that use movement states or alternative animation naming conventions.

Key changes:
- Implemented agent perspective (toAgentPerspective) for all 4-way movement.
- Added priority lookup for movement: `Moving{Direction}` state -> `Moving{Direction}` animation -> `Move{Direction}` animation -> `Look{Direction}` fallback.
- Movement animations now play with `loop: true` to persist during travel.
- Implemented proper cleanup: setting `isExitingFlag = true` and calling `handleAnimationCompleted` upon arrival or cancellation to ensure a smooth transition back to neutral/idle.
- Updated `ActionManager.test.ts` and `Agent.test.ts` to verify perspective swaps and lifecycle management.
- Improved test isolation by deep-cloning mock definitions in tests.

Co-Authored-By: azayrahmad <10110227+azayrahmad@users.noreply.github.com>
…4475535555671884637

Fix Genie movement animations playing Look instead of Moving
The `vite-plugin-static-copy` plugin expects the `rename` property to be a string or a function. Using an object like `{ stripBase: 2 }` caused a `TypeError: rename is not a function` during builds and tests.

This change replaces the object with a function that correctly maintains the intent of stripping the `public/agents/` prefix from the destination path.

Additionally, confirmed that the 'Failed to load agent assets' message in test output is expected behavior from `tests/AgentLoader.test.ts` when verifying error handling.

Co-authored-by: azayrahmad <10110227+azayrahmad@users.noreply.github.com>
- Modified AnimationManager to emit 'animationStarted' and added speech support helpers.
- Implemented AgentCore.waitForMouthFrames to wait for mouth-moving frames.
- Updated Agent.speak and DialogManager.ask to await mouth frames before showing balloon or starting TTS.
- Added unit and integration tests for speech synchronization.

Co-authored-by: azayrahmad <10110227+azayrahmad@users.noreply.github.com>
…2248440455248

Synchronize speech start with mouth animations
…4867632472685703441

Fix Vite config TypeError and explain test asset loading message
Remove transitionType 1 specific checks from AnimationManager.
All animations now support:
1. Pausing on terminal 0-duration (logic) frames during sequential playback.
2. Auto-interrupting when reaching a 0-duration frame with an exitBranch.

Updated tests/AnimationManager.test.ts to reflect these universal behaviors and fixed timing expectations in several test cases.

Co-authored-by: azayrahmad <10110227+azayrahmad@users.noreply.github.com>
…havior-12474140223475405348

Unify animation transition behavior across all types
@azayrahmad
azayrahmad merged commit a4717e1 into main Apr 13, 2026
1 check passed
@azayrahmad
azayrahmad deleted the feat/acd-v2-support-12940085162625515228 branch April 13, 2026 07:18
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