Repository navigation
feat: support caller media in text processing - #11
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-class support for caller-provided media payloads on text processing, extending the existing “media overrides stored payload” behavior to the text path and exposing it through both the C++ and C APIs.
Changes:
- Add
Cortext::ProcessText(..., const Media&, Retention)to allow storing an opaque caller payload (with MIME type) while keeping canonical text as the embedding input. - Add C API wrappers
cortext_process_text_with_media*(status + JSON) with media validation consistent with other*_with_mediaentry points. - Expand tests and docs to cover persistence semantics (default text payload vs supplied payload vs empty media payload).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/cortext.test.cpp | Adds coverage for text-with-media persistence behavior and C API entry points. |
| src/cortext.cpp | Implements the new text-with-media overload and updates payload surface validation rules for text + custom MIME payloads. |
| src/capi.cpp | Exposes the new text-with-media processing entry points in the C API (status + JSON). |
| README.md | Documents the storage vs embedding behavior for Media overloads (including empty media semantics). |
| include/cortext/cortext.hpp | Documents and declares the new C++ ProcessText overload taking Media. |
| include/cortext/capi.h | Documents and declares new C API functions for processing text with media payloads. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merged
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
Cortext::ProcessText(text, source, Media, retention)while preserving canonical text encoding/processing.cortext_process_text_with_media,cortext_process_text_with_media_json, andcortext_process_text_with_media_json_with_options.Exact API contract
ProcessText(text, source, Media, retention)usestextas the canonical embedding/processing input.Media, bytes are copied and stored withMedia.mimetype; custom MIME payloads are opaque binary and hydrate unchanged.Media{}/NULL/size == 0omits the stored payload for media overloads. Legacy calls withoutMediaretain canonical payload behavior.0/1/2for success/invalid parameters/internal errors. JSON wrappers return Context JSON and support retention/include-embedding options.Validation
cmake --build build-local-clang -j2passed.build-local-clang/tests/cortext_tests "[cortext][media][text]": 2 cases, 19 assertions passed.build-local-clang/tests/cortext_tests "[capi]": 4 cases, 128 assertions passed.build-local-clang/tests/cortext_tests "[media]": 5 cases, 57 assertions passed.ctest --test-dir build-local-clang --output-on-failure: 676 passed, 31 unrelated existing failures, 5 skipped (reported, not waived).EMSCRIPTEN=/opt/homebrew/Cellar/emscripten/4.0.18/libexec emcmake cmake ...configure succeeded in/tmp/cortext-wasm-proofand generatedCMakeFiles/cortext_wasm.dir/link.txtlinker flags include_cortext_process_text_with_media_jsonand_cortext_process_text_with_media_json_with_options.git diff --checkpassed.The feature commit contains only the six intended tracked files; the separate required Emscripten export commit adds the two linker-list entries documented above.
.claude/andscripts/metis/remain untracked and untouched. Do not merge this PR yet.