(
ctx: MemoryScopeContext,
virtualPath: string
)
| 918 | // ------------------------------------------------------------------------- |
| 919 | |
| 920 | async readFileWithSha( |
| 921 | ctx: MemoryScopeContext, |
| 922 | virtualPath: string |
| 923 | ): Promise<MemoryReadFileResult> { |
| 924 | try { |
| 925 | const parsed = parseMemoryPath(virtualPath); |
| 926 | const scope = this.requireFilePath(parsed, virtualPath); |
| 927 | const store = await this.resolveStore(ctx, scope, parsed.relPath); |
| 928 | const content = await this.readTextFileForEdit(store, parsed.relPath, virtualPath); |
| 929 | // Deliberately NOT recorded as a use: this is a human browsing the |
| 930 | // Memory tab/settings, and usage stats must reflect agent reads only so |
| 931 | // UI browsing never inflates hot-set ranking. (UI saves still count — |
| 932 | // an edit is an explicit signal the file matters, like pinning.) |
| 933 | return { success: true, data: { content, sha256: sha256Hex(content) } }; |
| 934 | } catch (error) { |
| 935 | if (error instanceof MemoryCommandError) { |
| 936 | return { success: false, error: error.message }; |
| 937 | } |
| 938 | return { success: false, error: `Memory operation failed: ${getErrorMessage(error)}` }; |
| 939 | } |
| 940 | } |
| 941 | |
| 942 | /** |
| 943 | * Whole-file save from the Memory tab. expectedSha256 is the sha captured at |
no test coverage detected