Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

This change improves data transfer efficiency between Kotlin and WASM by using Base64 instead of HexString. It includes a custom Base64 polyfill for the JS environment and updates both synchronous and asynchronous decoders to use java.util.Base64.


PR created automatically by Jules for task 1521046610204401856 started by @keiji

Replaces the inefficient HexString encoding (2 chars per byte) with Base64 encoding (4 chars per 3 bytes) for transferring data between the Kotlin application layer and the JavaScript/WASM environment.

Changes:
- Replaced `SCRIPT_BYTES_HEX_CONVERTER` with `SCRIPT_BYTES_BASE64_CONVERTER` in `Constants.kt`.
- Implemented `bytesToBase64` and `base64ToBytes` in JavaScript (as `btoa`/`atob` are unavailable in the sandbox).
- Updated `SCRIPT_DEFINE_DECODE_J2K` to use the new Base64 functions.
- Updated `Jp2kDecoder.kt` and `Jp2kDecoderAsync.kt` to use `java.util.Base64` for encoding inputs and decoding outputs.
- Updated WASM module loading to inject the binary as a Base64 string.
@google-labs-jules
Copy link
Contributor Author

👋 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.

@keiji
Copy link
Owner

keiji commented Jan 3, 2026

design docに反映して。

@google-labs-jules
Copy link
Contributor Author

design docに反映して。

Replied to comment 3707076407.

Updates the architecture and data flow diagrams in `docs/design.md` to reflect the transition from Hex String to Base64 String for data exchange between the Kotlin layer and the WASM environment. This ensures the documentation matches the recent implementation changes.
@keiji keiji marked this pull request as ready for review January 3, 2026 14:54
@keiji keiji merged commit c49e6cf into main Jan 3, 2026
2 checks passed
@keiji keiji deleted the feature/base64-exchange-1521046610204401856 branch January 3, 2026 14:54
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.

2 participants