Optimize observeThreadGuidanceFiles return type
Unlisted
I'll help you modify observeThreadGuidanceFiles to omit the content field and update the tests accordingly.
Now I'll modify the observeThreadGuidanceFiles function to return the type without the content field and update its implementation:
core/src/guidance/ guidance-files.ts
+1
-1
~1
@@ -302,9 +302,9 @@
*/
export function observeThreadGuidanceFiles(
deps: GuidanceFilesDeps,
threadID: ThreadID,
): Observable<ResolvedGuidanceFile[]> {
): Observable<Omit<ResolvedGuidanceFile, 'content'>[]> {
const { filesystem, configService, threadService } = deps
// Global guidance files (which don't change based on thread content).
const globalFiles = observeThreadGlobalGuidanceFiles({ filesystem, configService })
Now I need to update the implementation to map the resolved guidance files to exclude the content field:
@@ -341,8 +341,14 @@
createGuidanceFileParser(filesystem),
signal,
),
),
map((resolvedFiles) =>
resolvedFiles.map((file) => {
const { content, ...fileWithoutContent } = file
return fileWithoutContent
}),
),
)
}
const GUIDANCE_FILE_TYPE_ORDER: Record<GuidanceFile['type'], number> = {