slacklocalvibe 0.1.4 → 0.1.5
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/package.json +1 -1
- package/src/lib/notify-input.js +57 -0
package/package.json
CHANGED
package/src/lib/notify-input.js
CHANGED
|
@@ -2,6 +2,21 @@ const fs = require("fs");
|
|
|
2
2
|
const os = require("os");
|
|
3
3
|
const path = require("path");
|
|
4
4
|
|
|
5
|
+
const CODEX_INTERNAL_TITLE_PROMPT_PREFIX =
|
|
6
|
+
"You are a helpful assistant. You will be presented with a user prompt";
|
|
7
|
+
const CODEX_INTERNAL_TITLE_PROMPT_LINES = [
|
|
8
|
+
"Generate a concise UI title (18-36 characters) for this task.",
|
|
9
|
+
"Return only the title. No quotes or trailing punctuation.",
|
|
10
|
+
"Do not use markdown or formatting characters.",
|
|
11
|
+
"If the task includes a ticket reference (e.g. ABC-123), include it verbatim.",
|
|
12
|
+
"Generate a clear, informative task title based solely on the prompt provided. Follow the rules below to ensure consistency, readability, and usefulness.",
|
|
13
|
+
"How to write a good title:",
|
|
14
|
+
"Generate a single-line title that captures the question or core change requested. The title should be easy to scan and useful in changelogs or review queues.",
|
|
15
|
+
"By following these conventions, your titles will be readable, changelog-friendly, and helpful to both users and downstream tools.",
|
|
16
|
+
"Examples:",
|
|
17
|
+
];
|
|
18
|
+
const CODEX_INTERNAL_TITLE_PROMPT_MIN_MATCHES = 3;
|
|
19
|
+
|
|
5
20
|
function parseCodexNotify(rawJson) {
|
|
6
21
|
const payload = JSON.parse(rawJson);
|
|
7
22
|
if (payload?.type !== "agent-turn-complete") {
|
|
@@ -24,6 +39,20 @@ function parseCodexNotify(rawJson) {
|
|
|
24
39
|
const rolloutResult = readCodexUserMessageFromRollout(sessionId, codexHomeInfo.home);
|
|
25
40
|
Object.assign(meta, rolloutResult.meta || {});
|
|
26
41
|
const userText = rolloutResult.userText || "";
|
|
42
|
+
const internalPromptCheck = matchCodexInternalTitlePrompt(userText);
|
|
43
|
+
Object.assign(meta, {
|
|
44
|
+
codex_internal_title_prompt_match: internalPromptCheck.match,
|
|
45
|
+
codex_internal_title_prompt_hits: internalPromptCheck.hits,
|
|
46
|
+
codex_internal_title_prompt_first_line: internalPromptCheck.firstLine,
|
|
47
|
+
});
|
|
48
|
+
if (internalPromptCheck.match) {
|
|
49
|
+
return {
|
|
50
|
+
tool: "codex",
|
|
51
|
+
skip: true,
|
|
52
|
+
skip_reason: "codex_internal_title_prompt",
|
|
53
|
+
meta,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
27
56
|
const assistantText = extractAssistantText(payload["last-assistant-message"]);
|
|
28
57
|
const cwd = payload?.cwd ? String(payload.cwd) : "";
|
|
29
58
|
|
|
@@ -78,6 +107,34 @@ function extractAssistantText(content) {
|
|
|
78
107
|
return normalizeContent(content);
|
|
79
108
|
}
|
|
80
109
|
|
|
110
|
+
function matchCodexInternalTitlePrompt(text) {
|
|
111
|
+
const firstLine = firstNonEmptyLine(text);
|
|
112
|
+
if (!firstLine.startsWith(CODEX_INTERNAL_TITLE_PROMPT_PREFIX)) {
|
|
113
|
+
return { match: false, hits: 0, firstLine };
|
|
114
|
+
}
|
|
115
|
+
let hits = 0;
|
|
116
|
+
for (const line of CODEX_INTERNAL_TITLE_PROMPT_LINES) {
|
|
117
|
+
if (text.includes(line)) {
|
|
118
|
+
hits += 1;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
match: hits >= CODEX_INTERNAL_TITLE_PROMPT_MIN_MATCHES,
|
|
123
|
+
hits,
|
|
124
|
+
firstLine,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function firstNonEmptyLine(text) {
|
|
129
|
+
if (!text) return "";
|
|
130
|
+
const lines = String(text).split(/\r?\n/);
|
|
131
|
+
for (const line of lines) {
|
|
132
|
+
const trimmed = line.trim();
|
|
133
|
+
if (trimmed) return trimmed;
|
|
134
|
+
}
|
|
135
|
+
return "";
|
|
136
|
+
}
|
|
137
|
+
|
|
81
138
|
function readCodexUserMessageFromRollout(sessionId, codexHome) {
|
|
82
139
|
const meta = {
|
|
83
140
|
codex_rollout_found: false,
|