opencode-prompt-recorder 1.3.6 → 1.3.7
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 +16 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11,6 +11,18 @@ async function getVersion() {
|
|
|
11
11
|
return "unknown";
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
+
async function debugLog(directory, msg) {
|
|
15
|
+
const time = (/* @__PURE__ */ new Date()).toISOString();
|
|
16
|
+
const logLine = `[${time}] ${msg}
|
|
17
|
+
`;
|
|
18
|
+
try {
|
|
19
|
+
const logDir = join(directory, ".agent", "prompts-log");
|
|
20
|
+
await mkdir(logDir, { recursive: true });
|
|
21
|
+
await appendFile(join(logDir, "log.txt"), logLine);
|
|
22
|
+
} catch (e) {
|
|
23
|
+
console.error("debugLog failed:", e);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
14
26
|
function sanitizeFilename(str) {
|
|
15
27
|
return str.replace(/[<>:"/\\|?*\x00-\x1f]/g, "").substring(0, 50).trim();
|
|
16
28
|
}
|
|
@@ -81,7 +93,10 @@ var OpenCodePromptRecorder = async ({ directory, client }) => {
|
|
|
81
93
|
if (!role) {
|
|
82
94
|
role = event.properties.info?.message?.role;
|
|
83
95
|
}
|
|
84
|
-
if (role
|
|
96
|
+
if (!role) {
|
|
97
|
+
await debugLog(directory, `[prompt-recorder] WARNING: role not found, messageID=${messageID}, sessionID=${sessionID}, textPreview=${text2.substring(0, 30)}`);
|
|
98
|
+
} else if (role === "user" && text2 && sessionID) {
|
|
99
|
+
await debugLog(directory, `[prompt-recorder] event=${event.type}, role=${role}, sessionID=${sessionID}, textLength=${text2.length}, textPreview=${text2.substring(0, 50)}`);
|
|
85
100
|
const now2 = /* @__PURE__ */ new Date();
|
|
86
101
|
const { yyyy: yyyy2, MM: MM2, dd: dd2, HH: HH2, mm: mm2 } = formatDate(now2);
|
|
87
102
|
const topic2 = sanitizeFilename(text2);
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-prompt-recorder",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.7",
|
|
4
4
|
"description": "OpenCode plugin for recording user prompts. Automatically saves user messages to a local file system with organized directory structure.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-prompt-recorder",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.7",
|
|
4
4
|
"description": "OpenCode plugin for recording user prompts. Automatically saves user messages to a local file system with organized directory structure.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|