asdf
Squash the current repository state back into one baseline commit while preserving the README reframing and repository contents. Constraint: User explicitly requested a single squashed commit with subject "asdf" Confidence: high Scope-risk: broad Reversibility: clean Directive: This commit intentionally rewrites published history; coordinate before future force-pushes Tested: git status clean; local history rewritten to one commit; force-pushed main to origin and instructkr Not-tested: Fresh clone verification after push
This commit is contained in:
commit
d2542c9a62
32
src/utils/controlMessageCompat.ts
Normal file
32
src/utils/controlMessageCompat.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Normalize camelCase `requestId` → snake_case `request_id` on incoming
|
||||
* control messages (control_request, control_response).
|
||||
*
|
||||
* Older iOS app builds send `requestId` due to a missing Swift CodingKeys
|
||||
* mapping. Without this shim, `isSDKControlRequest` in replBridge.ts rejects
|
||||
* the message (it checks `'request_id' in value`), and structuredIO.ts reads
|
||||
* `message.response.request_id` as undefined — both silently drop the message.
|
||||
*
|
||||
* If both `request_id` and `requestId` are present, snake_case wins.
|
||||
* Mutates the object in place.
|
||||
*/
|
||||
export function normalizeControlMessageKeys(obj: unknown): unknown {
|
||||
if (obj === null || typeof obj !== 'object') return obj
|
||||
const record = obj as Record<string, unknown>
|
||||
if ('requestId' in record && !('request_id' in record)) {
|
||||
record.request_id = record.requestId
|
||||
delete record.requestId
|
||||
}
|
||||
if (
|
||||
'response' in record &&
|
||||
record.response !== null &&
|
||||
typeof record.response === 'object'
|
||||
) {
|
||||
const response = record.response as Record<string, unknown>
|
||||
if ('requestId' in response && !('request_id' in response)) {
|
||||
response.request_id = response.requestId
|
||||
delete response.requestId
|
||||
}
|
||||
}
|
||||
return obj
|
||||
}
|
||||
Reference in New Issue
Block a user