From 7f9b5f63ed10168cdbe6a365cd06fe728f4cdc88 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 19 Aug 2026 05:30:30 +0200 Subject: [PATCH] Preserve declared Eve control payloads --- packages/eve-browser-lowering/dist/index.js | 9 ++++++--- packages/eve-browser-lowering/src/index.ts | 9 ++++++--- .../test/browser-lowering.test.mjs | 18 ++++++++++++++++++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/packages/eve-browser-lowering/dist/index.js b/packages/eve-browser-lowering/dist/index.js index cdd4e5c..72df2ac 100644 --- a/packages/eve-browser-lowering/dist/index.js +++ b/packages/eve-browser-lowering/dist/index.js @@ -1178,8 +1178,8 @@ export function createInventoryDropIntent(source, target, destinationX, destinat const targetIndex = numberProp(target.targetIndex, -1); const targetKind = firstString(target.targetKind, ""); const payload = {}; - copyInventoryPayloadProps(source, payload); - copyInventoryPayloadProps(target, payload); + copyPayloadProps(source, payload); + copyPayloadProps(target, payload); Object.assign(payload, { sourceKind, originEntityKey: firstString(source.sourceEntityKey, source.entityKey, ""), @@ -1252,7 +1252,7 @@ function parseInventoryCells(value) { return Number.isInteger(x) && Number.isInteger(y) ? [{ x, y }] : []; }); } -function copyInventoryPayloadProps(source, payload) { +function copyPayloadProps(source, payload) { for (const [key, value] of Object.entries(source)) { if (key.startsWith("payload.") && key.length > "payload.".length) payload[key.slice("payload.".length)] = value; @@ -1590,6 +1590,8 @@ export function createEveCommandIntent(commandId, props = {}, options = {}) { const worldInteraction = resolveAdvertisedWorldInteraction(options, surfaceId); const commandBoundary = firstString(worldInteraction.commandBoundary, props.commandBoundary, action.commandBoundary, action.target); const receiptSchema = firstString(worldInteraction.receiptSchema, props.receiptSchema, action.receiptSchema); + const declaredPayload = {}; + copyPayloadProps(props, declaredPayload); const intent = { type: "surface-command", schema: "gamecult.eve.command_invocation.v1", @@ -1597,6 +1599,7 @@ export function createEveCommandIntent(commandId, props = {}, options = {}) { surfaceId, command: commandId || stringProp(action.type, "invoke"), payload: { + ...declaredPayload, ...action, transport: props.transport ?? null, }, diff --git a/packages/eve-browser-lowering/src/index.ts b/packages/eve-browser-lowering/src/index.ts index 7234da2..6d5896a 100644 --- a/packages/eve-browser-lowering/src/index.ts +++ b/packages/eve-browser-lowering/src/index.ts @@ -1400,8 +1400,8 @@ export function createInventoryDropIntent( const targetIndex = numberProp(target.targetIndex, -1); const targetKind = firstString(target.targetKind, ""); const payload: Record = {}; - copyInventoryPayloadProps(source, payload); - copyInventoryPayloadProps(target, payload); + copyPayloadProps(source, payload); + copyPayloadProps(target, payload); Object.assign(payload, { sourceKind, originEntityKey: firstString(source.sourceEntityKey, source.entityKey, ""), @@ -1490,7 +1490,7 @@ function parseInventoryCells(value: unknown): InventoryPlacementCell[] { }); } -function copyInventoryPayloadProps(source: Record, payload: Record): void { +function copyPayloadProps(source: Record, payload: Record): void { for (const [key, value] of Object.entries(source)) { if (key.startsWith("payload.") && key.length > "payload.".length) payload[key.slice("payload.".length)] = value; @@ -1870,6 +1870,8 @@ export function createEveCommandIntent( const worldInteraction = resolveAdvertisedWorldInteraction(options, surfaceId); const commandBoundary = firstString(worldInteraction.commandBoundary, props.commandBoundary, action.commandBoundary, action.target); const receiptSchema = firstString(worldInteraction.receiptSchema, props.receiptSchema, action.receiptSchema); + const declaredPayload: Record = {}; + copyPayloadProps(props, declaredPayload); const intent: EveCommandIntent = { type: "surface-command", schema: "gamecult.eve.command_invocation.v1", @@ -1877,6 +1879,7 @@ export function createEveCommandIntent( surfaceId, command: commandId || stringProp(action.type, "invoke"), payload: { + ...declaredPayload, ...action, transport: props.transport ?? null, }, diff --git a/packages/eve-browser-lowering/test/browser-lowering.test.mjs b/packages/eve-browser-lowering/test/browser-lowering.test.mjs index b4cbb2d..d910192 100644 --- a/packages/eve-browser-lowering/test/browser-lowering.test.mjs +++ b/packages/eve-browser-lowering/test/browser-lowering.test.mjs @@ -56,6 +56,24 @@ test("world interactions emit provider-routed command intents without local auth assert.equal(intent.payload.directionX, 1); }); +test("ordinary controls preserve provider-declared payload fields", () => { + const intent = createEveCommandIntent("aetheria.hangar.launch", { + label: "LAUNCH", + command: "aetheria.hangar.launch", + "payload.expectedProgressionVerseId": "gamecult.aetheria", + "payload.expectedProgressionSourceRevision": "7", + }, { + activeSurfaceId: "aetheria.hangar", + clientId: "browser.hangar-test", + provider: { providerId: "aetheria", surfaces: [{ surfaceId: "aetheria.hangar" }] }, + }); + + assert.equal(intent.payload.expectedProgressionVerseId, "gamecult.aetheria"); + assert.equal(intent.payload.expectedProgressionSourceRevision, "7"); + assert.equal(intent.payload.label, undefined); + assert.equal(intent.payload.command, undefined); +}); + test("inventory drops select the provider-advertised operation and preserve spatial identity", () => { const intent = createInventoryDropIntent({ sourceKind: "cargo",