Skip to content

feat: support caller media in text processing - #11

Merged
gabewillen merged 3 commits into
mainfrom
chore/remove-language-bindings
Aug 7, 2026
Merged

gabewillen merged 3 commits into
mainfrom
chore/remove-language-bindings

Conversation

@gabewillen

@gabewillen gabewillen commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add Cortext::ProcessText(text, source, Media, retention) while preserving canonical text encoding/processing.
  • Expose C status and JSON wrappers: cortext_process_text_with_media, cortext_process_text_with_media_json, and cortext_process_text_with_media_json_with_options.
  • Verify caller media persistence, opaque binary hydration, C error handling, and legacy behavior.

Exact API contract

  • ProcessText(text, source, Media, retention) uses text as the canonical embedding/processing input.
  • For non-empty Media, bytes are copied and stored with Media.mimetype; custom MIME payloads are opaque binary and hydrate unchanged.
  • Media{} / NULL / size == 0 omits the stored payload for media overloads. Legacy calls without Media retain canonical payload behavior.
  • C status wrapper returns 0/1/2 for success/invalid parameters/internal errors. JSON wrappers return Context JSON and support retention/include-embedding options.

Validation

  • cmake --build build-local-clang -j2 passed.
  • 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.
  • Full 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-proof and generated CMakeFiles/cortext_wasm.dir/link.txt linker flags include _cortext_process_text_with_media_json and _cortext_process_text_with_media_json_with_options.
  • git diff --check passed.

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/ and scripts/metis/ remain untracked and untouched. Do not merge this PR yet.

Copilot AI lite review requested due to automatic review settings August 6, 2026 23:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_media entry 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.

Comment thread tests/cortext.test.cpp
@gabewillen
gabewillen merged commit b670981 into main Aug 7, 2026
12 checks passed
@gabewillen
gabewillen deleted the chore/remove-language-bindings branch August 7, 2026 03:01
@gabewillen gabewillen mentioned this pull request Aug 7, 2026
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