CCTranscript Swift package: swift-bridge bindings for the session-activity oracle - #3
Merged
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Add a pyo3-free typed model (types.rs: Entry/EntryMeta/ContentBlock/ UserContent/PrintResult) and parse layer (parse.rs: Value -> typed, with KeyError/ValueError-mapped ParseError). stream_parse now builds typed entries in the rayon workers, off the GIL; event.rs shrinks to a pure typed -> Python materializer with byte-identical output. ToolUseBlock keeps the verbatim input Value plus typed run_in_background / subagent_type reads, and Entry grows meta/session_id/blocks/tool_uses/ tool_results accessors for the upcoming analysis stages.
mining.rs now consumes typed Entry values instead of raw sonic_rs reads: the private tool_use_id map is replaced by the shared tool_use_index join, sidechain/provenance classification reads typed meta, and the typed model gains the ToolUseBlock file_path/questions input reads mining needs.
session_activity_probe crosses the pyo3 boundary: it reads a transcript, parses it through the typed layer (whole-file stream_parse semantics), and returns the oracle verdict as a dict. cc_transcript.activity_probe is the dual-backend accessor with a Python reference twin, gated on CC_TRANSCRIPT_DISABLE_RUST like mining and sentiment. Parity tests cover every oracle case plus a captain-hook is_waiting reference port asserted against the real corpus.
…atic lib default = [python] keeps wheel builds identical; --no-default-features --features swift compiles only the typed core (types, parse, protocol, value, activity) into a staticlib with pyo3, udpipe-rs, tree-sitter, rayon, and crossbeam absent. The pyo3 module moves to python.rs, parse_bytes moves into parse.rs with a keep-predicate instead of a CompiledSpec so the drop-spec engine stays python-only, and the unused direct serde dependency is dropped.
cc_transcript_swift is a staticlib-only workspace member that depends on the parser core with --no-default-features --features swift, keeping swift-bridge build deps out of maturin wheel builds. It bridges session_activity(path, waiting_tools, human_facing_tools) where empty tool lists mean ActivityOpts::default(). SessionActivity and PendingItem cross as opaque Rust types with accessor methods rather than the preferred shared transparent structs: swift-bridge 0.1.59 generates Swift for Vec<transparent struct> fields without the required Vectorizable conformance, rejects opaque types inside shared structs, and emits a broken throwing closure for &str args on Result-returning functions (hence path: String). All three swift-bridge crates are pinned to the exact same pre-1.0 version.
The swift staticlib now comes from the dedicated cc_transcript_swift bridge crate, so the parser core no longer needs to emit one on every build. Wheel builds (cdylib) and rust-swift (rlib) are unaffected.
scripts/build-swift-package.sh regenerates swift/ end to end: release staticlib for aarch64-apple-darwin, swift-bridge-cli create-package (pinned 0.1.59, binaryTarget name RustXcframework), a scripted Package.swift patch (tools-version 5.9, platforms macOS 14), a sessionActivity(path:waitingTools:humanFacingTools:) convenience wrapper over the RustString/RustVec plumbing, and a swift build smoke check. The generated package is committed, XCFramework included — deliberate committed-binary distribution so consumers can depend on swift/ by path or git without a Rust toolchain. Rerun the script and commit the diff after touching rust-swift/.
…cript Five synthesized JSONL fixtures mirroring tests/test_activity_parity.py cases drive an XCTest target (CCTranscriptTests, Bundle.module resources) asserting exact verdicts, pending kinds, and last_event_epoch, plus a RustString error-path test. Examples/probe is a runnable consumer built by the regen script, which now stages create-package output so the committed Tests/, Examples/, and README.md survive regeneration.
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.
Exposes the Rust session-activity oracle to Swift via swift-bridge (pinned 0.1.59), shipping a committed SPM package at swift/ (library CCTranscript, macOS 14+, macos-arm64 xcframework).