cc437b9e9a
Bring the Rune interpreter closer to JS semantics so ordinary defensive code
stops crashing where real JS would quietly yield undefined or succeed:
- Unknown property reads on strings, numbers, and arrays now yield undefined
instead of throwing (including under optional chaining, which only guards
null/undefined receivers). MCP results are frequently JSON strings, so
`result?.field ?? result` reads the field when present and falls back to the
raw string otherwise. The method allowlist still errors (e.g. arr.splice keeps
its rewrite hint).
- `typeof undeclaredIdentifier` is now "undefined" rather than a reference
error, so `typeof x !== "undefined"` feature-detection guards are safe.
- Object spread of null/undefined is a no-op, so `{ ...maybeOpts, override }`
merges work when the operand is absent.
- Builtin coercions (Boolean/String/Number) are accepted as array callbacks, so
filter(Boolean) / map(String) / map(Number) work.
Adds rune-parity.test.ts covering each fix plus its guardrails, and documents
the parity behavior in rune.md.