Skip to content

Commit 7668ef2

Browse files
committed
refactor(memory): share workspace key normalization
1 parent 8e4213b commit 7668ef2

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

‎extensions/memory-core/src/dreaming-phases.ts‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
DREAMING_SESSION_INGESTION_FILES_NAMESPACE,
3535
DREAMING_SESSION_INGESTION_SEEN_NAMESPACE,
3636
SESSION_SEEN_HASHES_PER_CHUNK,
37+
normalizeMemoryCoreWorkspaceKey,
3738
readMemoryCoreWorkspaceEntries,
3839
writeMemoryCoreWorkspaceEntries,
3940
} from "./dreaming-state.js";
@@ -542,11 +543,6 @@ type SessionIngestionCollectionResult = {
542543
changed: boolean;
543544
};
544545

545-
function normalizeWorkspaceKey(workspaceDir: string): string {
546-
const resolved = path.resolve(workspaceDir).replace(/\\/g, "/");
547-
return process.platform === "win32" ? resolved.toLowerCase() : resolved;
548-
}
549-
550546
export function normalizeSessionIngestionState(raw: unknown): SessionIngestionState {
551547
const record = asRecord(raw);
552548
const filesRaw = asRecord(record?.files);
@@ -749,15 +745,17 @@ function resolveSessionAgentsForWorkspace(params: {
749745
if (!cfg) {
750746
return [];
751747
}
752-
const target = normalizeWorkspaceKey(workspaceDir);
748+
const target = normalizeMemoryCoreWorkspaceKey(workspaceDir);
753749
const workspaces = resolveMemoryDreamingWorkspaces(
754750
cfg as Parameters<typeof resolveMemoryDreamingWorkspaces>[0],
755751
{
756752
primaryWorkspaceDir,
757753
primaryAgentId: "main",
758754
},
759755
);
760-
const match = workspaces.find((entry) => normalizeWorkspaceKey(entry.workspaceDir) === target);
756+
const match = workspaces.find(
757+
(entry) => normalizeMemoryCoreWorkspaceKey(entry.workspaceDir) === target,
758+
);
761759
if (!match) {
762760
return [];
763761
}

0 commit comments

Comments
 (0)