Files
isaacandClaude Opus 5 cab9a2508a v2wasm: pluggable call core behind a C ABI — native or WASM module
Ports InstanceV2ReferenceImpl's control logic out into a self-contained
"call core" that runs either natively or as a runtime-loaded WASM module
(WAMR), so call behavior can change without shipping a new binary.

- CallCoreABI.h: frozen ABI v1, shaped as a PeerConnection projection —
  SDP munge point, transceiver/parameter/ICE-restart commands, observer
  events, curated rich stats (pc_get_stats).
- CallCoreHost: fixed host harness executing core commands against the
  real PeerConnection. NativeCoreBackend / WamrCoreBackend select the
  core at runtime (--wasm-core); per-module createModuleCore factory seam.
- ReferenceCallCore: stock-parity control logic behind the ABI.
  VariantCallCore: demo core showing behavior changes (fmtp munge,
  adaptive bitrate cap, periodic ICE restart), shipped as wasm only.
- InstanceV2PumpImpl: pump instance registered as 10.0.0-pump/11.0.0-pump.
- Protocol substrate: SignalingFraming ports EncryptedConnection
  reliability (V1) and gzip framing (V2) into the core, so the host
  boundary is raw signaling packets (seal/open only); N labeled data
  channels with binary payloads; audio-processing and PeerConnection
  config knobs.
- Compression is a host service (env.host_deflate/env.host_inflate)
  rather than vendored miniz, keeping the wasm modules small and making
  compressed bytes match stock exactly.
- tools/cli: --log-file. tools/parity: P1/P2 wire-parity scripts.

Squashed from the tgcalls-wasm-core-sketch branch (31 commits).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-27 01:28:00 +08:00

41 lines
1.4 KiB
Python
Executable File

#!/usr/bin/env python3
"""p1_diff.py RUN_A.log RUN_B.log — compare offer/answer SDP at the JSON layer.
Extracts outbound signaling JSON from stock ('sendSignalingMessage: ') and
pump ('[core] signaling out: ') log lines; normalizes per-run-random SDP
lines; MATCH required for offer and answer."""
import json, re, sys
PATTERNS = [re.compile(r"sendSignalingMessage: (\{.*)$"),
re.compile(r"\[core\] signaling out: (\{.*)$")]
STRIP = re.compile(r"^(o=|a=ice-ufrag|a=ice-pwd|a=fingerprint|a=ssrc|a=msid-semantic|a=candidate)")
def extract(path):
out = {}
for line in open(path, errors="replace"):
for pat in PATTERNS:
m = pat.search(line)
if not m:
continue
try:
msg = json.loads(m.group(1))
except ValueError:
continue
t = msg.get("@type")
if t in ("offer", "answer") and t not in out:
sdp = msg.get("sdp", "")
out[t] = "\n".join(l for l in sdp.split("\r\n") if l and not STRIP.match(l))
return out
a, b = extract(sys.argv[1]), extract(sys.argv[2])
ok = True
for t in ("offer", "answer"):
if a.get(t) and a.get(t) == b.get(t):
print(f"{t}: MATCH")
else:
ok = False
print(f"{t}: MISMATCH")
for name, d in (("A", a), ("B", b)):
print(f"--- {name} ---")
print(d.get(t, "<missing>")[:2000])
sys.exit(0 if ok else 1)