@frostbridge/imdl 0.1.8 → 0.1.9
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/index.js +33 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3619,6 +3619,8 @@ var CursorAdapter = class _CursorAdapter {
|
|
|
3619
3619
|
const newLines = lines.slice(lastOffset);
|
|
3620
3620
|
newOffsets[jsonlPath] = lines.length;
|
|
3621
3621
|
const projectPath = "/" + proj.replace(/-/g, "/").replace(/^\//, "");
|
|
3622
|
+
const sid = `cursor-${sessionDir.slice(0, 8)}`;
|
|
3623
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3622
3624
|
for (const line of newLines) {
|
|
3623
3625
|
let entry;
|
|
3624
3626
|
try {
|
|
@@ -3626,24 +3628,39 @@ var CursorAdapter = class _CursorAdapter {
|
|
|
3626
3628
|
} catch {
|
|
3627
3629
|
continue;
|
|
3628
3630
|
}
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
if (
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3631
|
+
const content2 = entry.message?.content;
|
|
3632
|
+
if (!Array.isArray(content2)) continue;
|
|
3633
|
+
if (entry.role === "user") {
|
|
3634
|
+
let text = "";
|
|
3635
|
+
for (const block of content2) {
|
|
3636
|
+
if (block?.type === "text" && block.text) {
|
|
3637
|
+
text += block.text.replace(/<user_query>\n?/g, "").replace(/\n?<\/user_query>/g, "").trim();
|
|
3638
|
+
}
|
|
3639
|
+
}
|
|
3640
|
+
if (!text || this.isNoisePrompt(text)) continue;
|
|
3641
|
+
events.push({
|
|
3642
|
+
sessionId: sid,
|
|
3643
|
+
type: "user_prompt",
|
|
3644
|
+
prompt: text.slice(0, 1e4),
|
|
3645
|
+
timestamp: now,
|
|
3646
|
+
cwd: projectPath,
|
|
3647
|
+
agentType: "cursor"
|
|
3648
|
+
});
|
|
3649
|
+
} else if (entry.role === "assistant") {
|
|
3650
|
+
for (const block of content2) {
|
|
3651
|
+
if (block?.type === "tool_use" && block.name) {
|
|
3652
|
+
events.push({
|
|
3653
|
+
sessionId: sid,
|
|
3654
|
+
type: "pre_tool_use",
|
|
3655
|
+
toolName: block.name,
|
|
3656
|
+
toolInput: block.input || void 0,
|
|
3657
|
+
timestamp: now,
|
|
3658
|
+
cwd: projectPath,
|
|
3659
|
+
agentType: "cursor"
|
|
3660
|
+
});
|
|
3661
|
+
}
|
|
3636
3662
|
}
|
|
3637
3663
|
}
|
|
3638
|
-
if (!text || this.isNoisePrompt(text)) continue;
|
|
3639
|
-
events.push({
|
|
3640
|
-
sessionId: `cursor-${sessionDir.slice(0, 8)}`,
|
|
3641
|
-
type: "user_prompt",
|
|
3642
|
-
prompt: text.slice(0, 1e4),
|
|
3643
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3644
|
-
cwd: projectPath,
|
|
3645
|
-
agentType: "cursor"
|
|
3646
|
-
});
|
|
3647
3664
|
}
|
|
3648
3665
|
} catch {
|
|
3649
3666
|
}
|