sessioner 0.1.3 → 0.1.4
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/README.md +0 -2
- package/lib/actions/merge.js +1 -5
- package/lib/actions/prune.js +6 -14
- package/lib/ui/search.js +1 -9
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/actions/merge.js
CHANGED
|
@@ -88,11 +88,7 @@ const copySubagents = async (sourceSessions, targetDir) => {
|
|
|
88
88
|
};
|
|
89
89
|
export const merge = async (sessions, title) => {
|
|
90
90
|
const sorted = [...sessions].sort((first, second) => first.date.localeCompare(second.date));
|
|
91
|
-
const contents =
|
|
92
|
-
for (const session of sorted) {
|
|
93
|
-
const raw = await readFile(session.file, 'utf-8');
|
|
94
|
-
contents.push(raw);
|
|
95
|
-
}
|
|
91
|
+
const contents = await Promise.all(sorted.map((session) => readFile(session.file, 'utf-8')));
|
|
96
92
|
const first = sorted[0];
|
|
97
93
|
if (!first)
|
|
98
94
|
return { id: '', date: '', message: title, file: '' };
|
package/lib/actions/prune.js
CHANGED
|
@@ -17,20 +17,12 @@ const stripTagsFromText = (text) => {
|
|
|
17
17
|
}
|
|
18
18
|
return result;
|
|
19
19
|
};
|
|
20
|
-
const stripSystemTags = (blocks) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
const stripped = stripTagsFromText(block.text).trim();
|
|
28
|
-
if (!stripped)
|
|
29
|
-
continue;
|
|
30
|
-
result.push({ ...block, text: stripped });
|
|
31
|
-
}
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
20
|
+
const stripSystemTags = (blocks) => blocks.flatMap((block) => {
|
|
21
|
+
if (block.type !== 'text' || !block.text)
|
|
22
|
+
return [block];
|
|
23
|
+
const stripped = stripTagsFromText(block.text).trim();
|
|
24
|
+
return stripped ? [{ ...block, text: stripped }] : [];
|
|
25
|
+
});
|
|
34
26
|
const filterContent = (content, options) => {
|
|
35
27
|
let filtered = content;
|
|
36
28
|
if (options.toolBlocks) {
|
package/lib/ui/search.js
CHANGED
|
@@ -38,15 +38,7 @@ const highlightMatch = (value, query) => {
|
|
|
38
38
|
const pattern = new RegExp(escapeRegExp(query), 'gi');
|
|
39
39
|
return value.replace(pattern, (match) => colorize(match, MATCH_COLOR));
|
|
40
40
|
};
|
|
41
|
-
const flattenMatches = (results) => {
|
|
42
|
-
const entries = [];
|
|
43
|
-
for (const result of results) {
|
|
44
|
-
for (const line of result.entries) {
|
|
45
|
-
entries.push({ session: result.session, text: line });
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return entries;
|
|
49
|
-
};
|
|
41
|
+
const flattenMatches = (results) => results.flatMap((result) => result.entries.map((text) => ({ session: result.session, text })));
|
|
50
42
|
export const selectSearchResult = async (results, query, fields) => {
|
|
51
43
|
const entries = flattenMatches(results);
|
|
52
44
|
let page = 0;
|