MCPcopy Create free account
hub / github.com/Noumena-Network/code / dispatchReplStartupMemory

Function dispatchReplStartupMemory

src/session/replStartupMemoryDispatch.ts:18–54  ·  view source on GitHub ↗
(
  {
    reverify,
    getMemoryFiles,
    logDebug,
    cacheReadFileState,
  }: ReplStartupMemoryDispatchDeps,
)

Source from the content-addressed store, hash-verified

16}
17
18export async function dispatchReplStartupMemory(
19 {
20 reverify,
21 getMemoryFiles,
22 logDebug,
23 cacheReadFileState,
24 }: ReplStartupMemoryDispatchDeps,
25): Promise<void> {
26 void reverify()
27
28 const memoryFiles = await getMemoryFiles()
29 if (memoryFiles.length > 0) {
30 const fileList = memoryFiles
31 .map(
32 file =>
33 ` [${file.type}] ${file.path} (${file.content.length} chars)${
34 file.parent ? ` (included by ${file.parent})` : ''
35 }`,
36 )
37 .join('\n')
38 logDebug(`Loaded ${memoryFiles.length} NCODE.md/rules files:\n${fileList}`)
39 } else {
40 logDebug('No NCODE.md/rules files found')
41 }
42
43 for (const file of memoryFiles) {
44 cacheReadFileState(file.path, {
45 content: file.contentDiffersFromDisk
46 ? file.rawContent ?? file.content
47 : file.content,
48 timestamp: Date.now(),
49 offset: undefined,
50 limit: undefined,
51 isPartialView: !!file.contentDiffersFromDisk,
52 })
53 }
54}

Callers 2

onInitFunction · 0.85

Calls 1

logDebugFunction · 0.50

Tested by

no test coverage detected