MCPcopy Create free account
hub / github.com/anomalyco/opencode / migrateLegacySessionStateKeys

Function migrateLegacySessionStateKeys

packages/app/src/utils/server-scope.ts:62–73  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

60}
61
62export function migrateLegacySessionStateKeys(value: unknown) {
63 if (!value || typeof value !== "object" || Array.isArray(value)) return value
64 const entries = Object.entries(value)
65 if (entries.every(([key]) => key.includes(separator))) return value
66 const scoped = Object.fromEntries(entries.filter(([key]) => key.includes(separator)))
67 for (const [key, item] of entries) {
68 if (key.includes(separator)) continue
69 const next = SessionStateKey.from(ServerScope.local, SessionRouteKey.fromLegacy(key))
70 if (!(next in scoped)) scoped[next] = item
71 }
72 return scoped
73}

Callers 2

migrateFunction · 0.90

Calls 1

fromMethod · 0.45

Tested by

no test coverage detected