Repository navigation
feat: add text processing with media payloads - #1
Open
gabewillen wants to merge 2 commits into
Open
gabewillen wants to merge 2 commits into
gabewillen wants to merge 2 commits into
Conversation
gabewillen
force-pushed
the
feat/process-text-with-media
branch
from
August 6, 2026 23:56
3e2c1f6 to
faf7e59
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new WASM binding entrypoint for processing canonical text while attaching an arbitrary binary “media” payload (bytes + MIME type), using the media-capable JSON C API to avoid string/base64 coercion.
Changes:
- Add
CortextWasm.processTextWithMedia(...)that marshalscortext_media+ options structs into WASM memory and calls_cortext_process_text_with_media_json_with_options. - Introduce and export a new TypeScript
Mediatype and update the Emscripten module typings for the new export. - Add unit coverage plus README/CHANGELOG documentation for the new API.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit.test.mjs | Extends the fake Emscripten module and adds unit tests asserting correct ABI marshalling and retention validation. |
| src/types.ts | Adds Media type and declares the new C export on CortextEmscriptenModule. |
| src/index.ts | Re-exports the new Media type from the package entrypoint. |
| src/cortext-wasm.ts | Implements processTextWithMedia and adds a helper to write uint32 fields into WASM memory. |
| README.md | Documents the new API and provides a usage example. |
| CHANGELOG.md | Notes the new API addition. |
Suppressed comments (1)
src/cortext-wasm.ts:272
- After introducing the
processWithMediaruntime check, call the validated local function reference so this continues to typecheck if_cortext_process_text_with_media_json_with_optionsis made optional on the module interface.
this.#readRawJson(
this.module._cortext_process_text_with_media_json_with_options(
handle,
textPtr,
sourcePtr,
mediaPtr,
optionsPtr
)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CortextWasm.processTextWithMediausing the media-capable JSON C APIcortext_mediaABI structMediatype, unit coverage, README and changelog documentationCompatibility
processTextpath is unchanged_cortext_process_text_with_media_json_with_optionsValidation
npm run typechecknpm run test:unit(18 passed)npm test(19 passed; smoke context skipped because vendored 1.2.0 asset lacks model)npm run pack:checknpm run check:wasmCore C API/export update is tracked in the companion core PR.