Json schemas#43
Merged
Merged
Conversation
Attach `jsonSchema` fragments to the custom enum and offset fields so
toJsonSchema() emits proper `enum` / object types instead of `{}`.
Also promote `emote` from optional-with-"" to required, and check in
the generated draft-07 schemas under src/aolib/schemas/.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`MS.client` / `MS.server` was ambiguous — could read as either "sent by" or "received by". Match the schema constants instead. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`aolib.MSPacket` becomes `aolib.MSBroadcast` (the type), `aolib.ARUPPacket` becomes `aolib.ARUP`, etc. Asymmetric bidirectional packets keep the Request/Broadcast qualifier so the c2s vs s2c direction stays legible. Drops the now-unused XInput / XBroadcastInput aliases entirely. The schema-constant values are no longer re-exported from the aolib barrel — only as types — so the value and type can share a name without colliding at the index.ts re-export level. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The leading slot was modeled as a `lit(0)` (treating it as a legacy
ignored marker), but servers validate it as the player_id assigned in
the ID packet — and reject mismatches. Surface it as a required field
so callers echo back the value they stored from `on.ID`.
The trailing slot was likewise a `lit("")`; expose it as an optional
char_password (default "") so locked-slot servers can be satisfied.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Some servers reject CC with an empty char_password. Send a non-empty sentinel so the character pick lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The class extended EventEmitter only to forward WebSocket events into its own on*/emit indirection — no external listeners. Wire the socket events straight to onOpen/onClose/onMessage/onError and drop the base class. Reconnect was leaking: the old socket's listeners stayed live after cleanup(), and the 5s connect watchdog captured `this` so a pending timer from a prior attempt could close the new socket. Per-attempt AbortController binds both listeners and the watchdog, and connect() aborts the previous attempt before opening a new socket. Also rename the muddy `this.serv: any` to `this.socket: WebSocket | undefined`. Strict typing exposed onError's incorrect ErrorEvent parameter — WebSocket fires plain Event on error — fixed. Identity sent in ID handshake now reads from client.software / client.version instead of hardcoded "webAO" + version import. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Request/Broadcast convention used elsewhere doesn't read naturally for the ID handshake — both sides ARE the identification. Name them by the identifier instead: IDServer is "server identifies itself", IDClient is "client identifies itself". Wire header stays "ID". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
c2s: askchaa, CH, RC, RD, RM s2c: decryptor, SI, DONE, CHECK Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Covers every entry in c2sSchemas and s2cSchemas not already on disk.
ARUP's update_type / update_data come through as permissive `{}` —
the field-walker can't express the discriminated-array shape and we
chose not to introduce packet-level oneOf hints for it. Callers are
expected to handle ARUP's update_data heterogeneity at runtime.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
update_type now exports as integer enum [0,1,2,3], update_data as array of (integer | string). The cross-field discriminated-union constraint (type 0 -> numbers, types 1-3 -> strings) is left for the caller to enforce at runtime. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Was VSJoinRequest/Broadcast etc.; the underscore-less camelCase made the type names diverge from the wire headers (VS_JOIN, VS_LEAVE, VS_SPEAK). Use VS_JOINRequest / VS_JOINBroadcast so every typed packet name has the header as a literal prefix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
No description provided.