@threadbase-sh/scanner 0.14.7 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +16 -9
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +27 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +26 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -320,6 +320,7 @@ declare class CodexCliProvider implements ScannerProvider<CodexAccumulator> {
|
|
|
320
320
|
reduceEntry(acc: CodexAccumulator, entry: Record<string, unknown>, tier: ContentTier): void;
|
|
321
321
|
finalize(acc: CodexAccumulator, filePath: string, account: string, tier: ContentTier): ConversationMeta | null;
|
|
322
322
|
}
|
|
323
|
+
declare function parseCodexJsonlLine(line: string): ConversationMessage | null;
|
|
323
324
|
|
|
324
325
|
interface ReducerState {
|
|
325
326
|
sessionId: string;
|
|
@@ -445,4 +446,4 @@ declare function scan(options?: ScanOptions, scanner?: ConversationScanner): Pro
|
|
|
445
446
|
declare function search(query: string, options?: SearchOptions, scanner?: ConversationScanner): Promise<SearchResult[]>;
|
|
446
447
|
declare function getConversation(id: string, options?: GetConversationOptions, scanner?: ConversationScanner): Promise<Conversation | null>;
|
|
447
448
|
|
|
448
|
-
export { type AttachmentSidecar, CodexCliProvider, type ContentTier, type Conversation, type ConversationMessage, type ConversationMeta, type ConversationPage, ConversationScanner, type ConversationScannerOptions, DEFAULT_TIERS, type DeferredToolsDeltaAttachment, type DiscoveredConversationFile, type FileStatEntry, type GetConversationOptions, type GetConversationPageOptions, type GroupedConversations, type Include, type ConvReducerState as JsonlParseState, type MessageMetadata, type MessageSender, type MessageSnapshot, type PersistentConfig, type Profile, type ProviderName, type ScanOptions, type ScanResult, type ScannerChangeEvent, type ScannerProvider, type ScannerProviderName, type SearchHighlight, SearchIndexer, type SearchMatch, type SearchOptions, type SearchResult, type Sidecar, type SingleFilePage, type SortOrder, type TeamInfo, ThreadbaseProvider, type ToolResultBlock, type ToolUseBlock, type TreeConversation, type TurnDuration, VALID_SORT_ORDERS, type View, type WatchOptions, applyAccountFilter, applyIncludeFilter, applyPagination, applyProjectFilter, applySinceFilter, applySort, cleanSystemTags, initialConvState as createJsonlParseState, createLogger, detectDefaultProfile, getConversation, getLogger, getProjectsDir, loadProfiles, parseJsonlLine, readGitBranch, readSidecar, resetDefaultScanner, resolveConfigDir, resolveTier, saveProfiles, scan, search, setLogger, sidecarPath };
|
|
449
|
+
export { type AttachmentSidecar, CodexCliProvider, type ContentTier, type Conversation, type ConversationMessage, type ConversationMeta, type ConversationPage, ConversationScanner, type ConversationScannerOptions, DEFAULT_TIERS, type DeferredToolsDeltaAttachment, type DiscoveredConversationFile, type FileStatEntry, type GetConversationOptions, type GetConversationPageOptions, type GroupedConversations, type Include, type ConvReducerState as JsonlParseState, type MessageMetadata, type MessageSender, type MessageSnapshot, type PersistentConfig, type Profile, type ProviderName, type ScanOptions, type ScanResult, type ScannerChangeEvent, type ScannerProvider, type ScannerProviderName, type SearchHighlight, SearchIndexer, type SearchMatch, type SearchOptions, type SearchResult, type Sidecar, type SingleFilePage, type SortOrder, type TeamInfo, ThreadbaseProvider, type ToolResultBlock, type ToolUseBlock, type TreeConversation, type TurnDuration, VALID_SORT_ORDERS, type View, type WatchOptions, applyAccountFilter, applyIncludeFilter, applyPagination, applyProjectFilter, applySinceFilter, applySort, cleanSystemTags, initialConvState as createJsonlParseState, createLogger, detectDefaultProfile, getConversation, getLogger, getProjectsDir, loadProfiles, parseCodexJsonlLine, parseJsonlLine, readGitBranch, readSidecar, resetDefaultScanner, resolveConfigDir, resolveTier, saveProfiles, scan, search, setLogger, sidecarPath };
|
package/dist/index.d.ts
CHANGED
|
@@ -320,6 +320,7 @@ declare class CodexCliProvider implements ScannerProvider<CodexAccumulator> {
|
|
|
320
320
|
reduceEntry(acc: CodexAccumulator, entry: Record<string, unknown>, tier: ContentTier): void;
|
|
321
321
|
finalize(acc: CodexAccumulator, filePath: string, account: string, tier: ContentTier): ConversationMeta | null;
|
|
322
322
|
}
|
|
323
|
+
declare function parseCodexJsonlLine(line: string): ConversationMessage | null;
|
|
323
324
|
|
|
324
325
|
interface ReducerState {
|
|
325
326
|
sessionId: string;
|
|
@@ -445,4 +446,4 @@ declare function scan(options?: ScanOptions, scanner?: ConversationScanner): Pro
|
|
|
445
446
|
declare function search(query: string, options?: SearchOptions, scanner?: ConversationScanner): Promise<SearchResult[]>;
|
|
446
447
|
declare function getConversation(id: string, options?: GetConversationOptions, scanner?: ConversationScanner): Promise<Conversation | null>;
|
|
447
448
|
|
|
448
|
-
export { type AttachmentSidecar, CodexCliProvider, type ContentTier, type Conversation, type ConversationMessage, type ConversationMeta, type ConversationPage, ConversationScanner, type ConversationScannerOptions, DEFAULT_TIERS, type DeferredToolsDeltaAttachment, type DiscoveredConversationFile, type FileStatEntry, type GetConversationOptions, type GetConversationPageOptions, type GroupedConversations, type Include, type ConvReducerState as JsonlParseState, type MessageMetadata, type MessageSender, type MessageSnapshot, type PersistentConfig, type Profile, type ProviderName, type ScanOptions, type ScanResult, type ScannerChangeEvent, type ScannerProvider, type ScannerProviderName, type SearchHighlight, SearchIndexer, type SearchMatch, type SearchOptions, type SearchResult, type Sidecar, type SingleFilePage, type SortOrder, type TeamInfo, ThreadbaseProvider, type ToolResultBlock, type ToolUseBlock, type TreeConversation, type TurnDuration, VALID_SORT_ORDERS, type View, type WatchOptions, applyAccountFilter, applyIncludeFilter, applyPagination, applyProjectFilter, applySinceFilter, applySort, cleanSystemTags, initialConvState as createJsonlParseState, createLogger, detectDefaultProfile, getConversation, getLogger, getProjectsDir, loadProfiles, parseJsonlLine, readGitBranch, readSidecar, resetDefaultScanner, resolveConfigDir, resolveTier, saveProfiles, scan, search, setLogger, sidecarPath };
|
|
449
|
+
export { type AttachmentSidecar, CodexCliProvider, type ContentTier, type Conversation, type ConversationMessage, type ConversationMeta, type ConversationPage, ConversationScanner, type ConversationScannerOptions, DEFAULT_TIERS, type DeferredToolsDeltaAttachment, type DiscoveredConversationFile, type FileStatEntry, type GetConversationOptions, type GetConversationPageOptions, type GroupedConversations, type Include, type ConvReducerState as JsonlParseState, type MessageMetadata, type MessageSender, type MessageSnapshot, type PersistentConfig, type Profile, type ProviderName, type ScanOptions, type ScanResult, type ScannerChangeEvent, type ScannerProvider, type ScannerProviderName, type SearchHighlight, SearchIndexer, type SearchMatch, type SearchOptions, type SearchResult, type Sidecar, type SingleFilePage, type SortOrder, type TeamInfo, ThreadbaseProvider, type ToolResultBlock, type ToolUseBlock, type TreeConversation, type TurnDuration, VALID_SORT_ORDERS, type View, type WatchOptions, applyAccountFilter, applyIncludeFilter, applyPagination, applyProjectFilter, applySinceFilter, applySort, cleanSystemTags, initialConvState as createJsonlParseState, createLogger, detectDefaultProfile, getConversation, getLogger, getProjectsDir, loadProfiles, parseCodexJsonlLine, parseJsonlLine, readGitBranch, readSidecar, resetDefaultScanner, resolveConfigDir, resolveTier, saveProfiles, scan, search, setLogger, sidecarPath };
|
package/dist/index.js
CHANGED
|
@@ -991,6 +991,26 @@ function extractCodexText(content) {
|
|
|
991
991
|
return "";
|
|
992
992
|
}).filter(Boolean).map(cleanSystemTags).join(" ");
|
|
993
993
|
}
|
|
994
|
+
function parseCodexJsonlLine(line) {
|
|
995
|
+
if (!line.trim()) return null;
|
|
996
|
+
let entry;
|
|
997
|
+
try {
|
|
998
|
+
entry = JSON.parse(line);
|
|
999
|
+
} catch {
|
|
1000
|
+
return null;
|
|
1001
|
+
}
|
|
1002
|
+
return codexEntryToMessage(entry);
|
|
1003
|
+
}
|
|
1004
|
+
function codexEntryToMessage(entry) {
|
|
1005
|
+
const payload = entry.payload;
|
|
1006
|
+
if (!payload || typeof payload !== "object") return null;
|
|
1007
|
+
if (entry.type !== "response_item" || payload.type !== "message") return null;
|
|
1008
|
+
const role = payload.role;
|
|
1009
|
+
if (role !== "user" && role !== "assistant") return null;
|
|
1010
|
+
const text = extractCodexText(payload.content);
|
|
1011
|
+
if (!text) return null;
|
|
1012
|
+
return { role, text, timestamp: asString(entry.timestamp) };
|
|
1013
|
+
}
|
|
994
1014
|
function reduceCodexEntry(acc, entry, tier) {
|
|
995
1015
|
const ts = asString(entry.timestamp);
|
|
996
1016
|
if (ts && (!acc.latestTimestamp || ts > acc.latestTimestamp)) acc.latestTimestamp = ts;
|
|
@@ -1101,14 +1121,11 @@ async function parseCodexConversation(filePath, account) {
|
|
|
1101
1121
|
if (!cwd) cwd = asString(payload.cwd);
|
|
1102
1122
|
continue;
|
|
1103
1123
|
}
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
if (
|
|
1109
|
-
messages.push({ role, text, timestamp: ts });
|
|
1110
|
-
textParts.push(text);
|
|
1111
|
-
if (role === "user") lastUserText = text;
|
|
1124
|
+
const message = codexEntryToMessage(entry);
|
|
1125
|
+
if (!message) continue;
|
|
1126
|
+
messages.push(message);
|
|
1127
|
+
textParts.push(message.text);
|
|
1128
|
+
if (message.role === "user") lastUserText = message.text;
|
|
1112
1129
|
}
|
|
1113
1130
|
} catch (err) {
|
|
1114
1131
|
log.warn({ filePath, err }, "parseCodexConversation: read failed");
|
|
@@ -3911,6 +3928,7 @@ export {
|
|
|
3911
3928
|
getLogger,
|
|
3912
3929
|
getProjectsDir,
|
|
3913
3930
|
loadProfiles,
|
|
3931
|
+
parseCodexJsonlLine,
|
|
3914
3932
|
parseJsonlLine,
|
|
3915
3933
|
readGitBranch,
|
|
3916
3934
|
readSidecar,
|