@faithfulalabi/agent-lens 0.15.0 → 0.15.1
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/src/db/read.js
CHANGED
|
@@ -192,7 +192,7 @@ const SPILL_SNIPPET = `snippet(spill_fts, 3, '<mark>', '</mark>', '…', 12)`;
|
|
|
192
192
|
function ftsPhrase(q) {
|
|
193
193
|
return `"${q.replaceAll('"', '""')}"`;
|
|
194
194
|
}
|
|
195
|
-
const SEARCHABLE = `e.kind <> 'unknown'`;
|
|
195
|
+
const SEARCHABLE = `(e.kind <> 'unknown' OR json_extract(e.attrs, '$.filename') IS NOT NULL)`;
|
|
196
196
|
function searchSql(scoped) {
|
|
197
197
|
const scope = scoped ? ' AND e.session_id = :session' : '';
|
|
198
198
|
const events = `SELECT e.session_id AS session_id, s.title AS session_title, s.project_path AS project_path,` +
|
package/dist/src/db/schema.js
CHANGED
|
@@ -273,7 +273,7 @@ CREATE TABLE events (
|
|
|
273
273
|
-- attributionAgent, effort, permissionMode,
|
|
274
274
|
-- compactMetadata, toolDenialKind, renderedRole,
|
|
275
275
|
-- permissionSource, permissionReasonType,
|
|
276
|
-
-- unknown_fields[]
|
|
276
|
+
-- filename, unknown_fields[]
|
|
277
277
|
);
|
|
278
278
|
CREATE UNIQUE INDEX idx_events_session_seq ON events(session_id, seq);
|
|
279
279
|
CREATE INDEX idx_events_turn ON events(turn_id, seq);
|
|
@@ -181,7 +181,7 @@ export function runPipeline(lines, ctx) {
|
|
|
181
181
|
const usage = usageAt.get(index);
|
|
182
182
|
const record = blocks.length === 0 ? attachmentRecord(line) : undefined;
|
|
183
183
|
const lineText = blocks.length === 0 ? (record?.text ?? apiErrorText(line)) : undefined;
|
|
184
|
-
const attrs =
|
|
184
|
+
const attrs = JSON.stringify({ renderedRole: record?.role, filename: record?.filename });
|
|
185
185
|
let stamped = false;
|
|
186
186
|
const emit = (block, blockIndex) => {
|
|
187
187
|
if (block?.kind === 'unknown_block')
|
|
@@ -6,12 +6,14 @@ function placeholder(subtype) {
|
|
|
6
6
|
export function attachmentRecord(line) {
|
|
7
7
|
if (line.kind !== 'attachment')
|
|
8
8
|
return undefined;
|
|
9
|
-
const
|
|
9
|
+
const payload = obj(line.raw.attachment, undefined);
|
|
10
|
+
const subtype = str(payload?.type, '');
|
|
10
11
|
const first = arr(line.raw.rendered, NO_ELEMENTS)[0];
|
|
11
12
|
const rendered = str(obj(first, undefined)?.content, undefined);
|
|
12
13
|
return {
|
|
13
14
|
subtype,
|
|
14
15
|
text: rendered ?? placeholder(subtype),
|
|
15
16
|
role: str(line.raw.renderedRole, undefined),
|
|
17
|
+
filename: str(payload?.filename, undefined),
|
|
16
18
|
};
|
|
17
19
|
}
|
|
@@ -73,7 +73,8 @@ export function classifyContent(content) {
|
|
|
73
73
|
export function resultText(children) {
|
|
74
74
|
const texts = children.flatMap((child) => (child.kind === 'text' ? [child.text] : []));
|
|
75
75
|
const images = children.flatMap((child) => (child.kind === 'image' ? [child.placeholder] : []));
|
|
76
|
-
|
|
76
|
+
const refs = children.flatMap((child) => child.kind === 'tool_reference' ? [`[tool_reference ${child.name}]`] : []);
|
|
77
|
+
return [...texts, ...images, ...refs].join('\n');
|
|
77
78
|
}
|
|
78
79
|
export function contentBlocks(line) {
|
|
79
80
|
return classifyContent(rawContent(line));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PROJECTOR_VERSION =
|
|
1
|
+
export const PROJECTOR_VERSION = 21;
|