utils/query/query_helpers
library
Functions
-
buildSideQuestionFallbackParams({required List<Map<String, dynamic>> tools, required List<Map<String, dynamic>> commands, required List<Map<String, dynamic>> mcpClients, required List<Map<String, dynamic>> messages, required FileStateCache readFileState, required Map<String, dynamic> getAppState(), required void setAppState(void (Map<String, dynamic>)), String? customSystemPrompt, String? appendSystemPrompt, Map<String, dynamic>? thinkingConfig, required List<Map<String, dynamic>> agents, required GetSystemPromptFn getSystemPrompt, required GetUserContextFn getUserContext, required GetSystemContextFn getSystemContext})
→ Future<CacheSafeParams>
-
Build CacheSafeParams for a side question fallback.
-
createFileStateCacheWithSizeLimit(int maxSize)
→ FileStateCache
-
Create a file state cache with size limit.
-
endQueryProfile()
→ void
-
End the current query profiling session.
-
Extract the top-level CLI tools used in BashTool calls from messages.
-
Extract read files from messages to populate the file state cache.
-
fetchSystemPromptParts({required GetSystemPromptFn getSystemPrompt, required GetUserContextFn getUserContext, required GetSystemContextFn getSystemContext, String? customSystemPrompt})
→ Future<({List<String> defaultSystemPrompt, Map<String, String> systemContext, Map<String, String> userContext})>
-
Fetch the three context pieces for the API cache-key prefix.
-
getQueryProfileReport()
→ String
-
Get the full profiling report.
-
handleOrphanedPermission({required Map<String, dynamic> permissionResult, required Map<String, dynamic> assistantMessage, required List<Map<String, dynamic>> tools, required List<Map<String, dynamic>> mutableMessages, required String sessionId, required bool persistSession, Future<void> recordTranscript(List<Map<String, dynamic>>)?, Stream<Map<String, dynamic>> runToolUse(Map<String, dynamic>)?})
→ Stream<Map<String, dynamic>>
-
Handle an orphaned permission by executing the tool.
-
isResultSuccessful(Map<String, dynamic>? message, {String? stopReason})
→ bool
-
Checks if the result should be considered successful based on the last
message.
-
logQueryProfileReport()
→ void
-
Log the query profile report to debug output.
-
normalizeMessage(Map<String, dynamic> message, {required String sessionId})
→ Iterable<Map<String, dynamic>>
-
Normalize a single message for SDK output.
-
queryCheckpoint(String name)
→ void
-
Record a checkpoint with the given name.
-
readCapped(RandomAccessFile handle)
→ Future<String?>
-
Read a capped portion of a file. Returns null if the file exceeds
maxScanBytes.
-
readEditContext(String path, String needle, {int contextLines = 3})
→ Future<EditContext?>
-
Read the edit context around a needle in a file.
Returns
null on ENOENT. Returns truncated context if needle not found.
-
startQueryProfile()
→ void
-
Start profiling a new query session.