This commit is contained in:
2026-04-24 12:21:33 +08:00
parent 3528980645
commit 70b5a7cf73
515 changed files with 14971 additions and 6831 deletions

View File

@@ -45,6 +45,7 @@ test('custom world agent ui state reads from query first and persists to session
{
activeSessionId: 'session-1',
activeOperationId: 'operation-1',
ownerUserId: 'user-1',
},
env,
);
@@ -56,6 +57,13 @@ test('custom world agent ui state reads from query first and persists to session
activeOperationId: 'operation-1',
});
currentUrl = '/play';
expect(readCustomWorldAgentUiState(env)).toEqual({
activeSessionId: 'session-1',
activeOperationId: 'operation-1',
ownerUserId: 'user-1',
});
clearCustomWorldAgentUiState(env);
expect(readCustomWorldAgentUiState(env)).toEqual({});
});

View File

@@ -80,6 +80,7 @@ export function readCustomWorldAgentUiState(
return {
activeSessionId: normalizeValue(parsed.activeSessionId),
activeOperationId: normalizeValue(parsed.activeOperationId),
ownerUserId: normalizeValue(parsed.ownerUserId),
};
} catch {
resolved.sessionStorage?.removeItem(CUSTOM_WORLD_AGENT_UI_STATE_STORAGE_KEY);
@@ -94,9 +95,11 @@ export function writeCustomWorldAgentUiState(
const resolved = resolveEnvironment(env);
const activeSessionId = normalizeValue(state.activeSessionId);
const activeOperationId = normalizeValue(state.activeOperationId);
const ownerUserId = normalizeValue(state.ownerUserId);
const nextState: CustomWorldAgentUiState = {
activeSessionId,
activeOperationId,
ownerUserId,
};
if (resolved.location && resolved.history?.replaceState) {