slashvibe-mcp 0.9.11 → 0.9.12
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/hooks/arrival-hook.cjs +46 -3
- package/package.json +1 -1
package/hooks/arrival-hook.cjs
CHANGED
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
* reads the identity it was installed for.
|
|
16
16
|
*
|
|
17
17
|
* Presentation only: writes no receipt and no read state.
|
|
18
|
+
*
|
|
19
|
+
* One more thing it does on a prompt: when the person says they are stuck, it
|
|
20
|
+
* reminds the agent, once per session, that vibe_bump exists (see stuckNudge).
|
|
18
21
|
*/
|
|
19
22
|
'use strict';
|
|
20
23
|
|
|
@@ -53,16 +56,56 @@ function main() {
|
|
|
53
56
|
|
|
54
57
|
const dir = process.env.VIBE_ARRIVALS_DIR || path.join(__dirname, '..', 'arrivals');
|
|
55
58
|
const rows = take(dir, Date.now());
|
|
56
|
-
|
|
59
|
+
const nudge = event === 'UserPromptSubmit' ? stuckNudge(input, dir) : '';
|
|
60
|
+
if (rows.length === 0 && !nudge) return quiet();
|
|
57
61
|
|
|
62
|
+
const context = rows.map((r) => r.context);
|
|
63
|
+
if (nudge) context.push(nudge);
|
|
64
|
+
const shown = rows.map((r) => r.line).filter(Boolean).join('\n');
|
|
58
65
|
process.stdout.write(JSON.stringify({
|
|
59
66
|
suppressOutput: true,
|
|
60
|
-
systemMessage:
|
|
67
|
+
...(shown ? { systemMessage: shown } : {}),
|
|
61
68
|
hookSpecificOutput: {
|
|
62
69
|
hookEventName: event,
|
|
63
|
-
additionalContext:
|
|
70
|
+
additionalContext: context.join('\n\n'),
|
|
64
71
|
},
|
|
65
72
|
}));
|
|
66
73
|
}
|
|
67
74
|
|
|
75
|
+
// ── the bump, made dependable ───────────────────────────────────────────────
|
|
76
|
+
// vibe_bump exists for the moment a person is stuck, but whether the agent
|
|
77
|
+
// thinks of it was left to the agent, and measured it mostly did not: one
|
|
78
|
+
// session in four, and not at all on production. The person saying so in plain
|
|
79
|
+
// words is something this hook can see. When they do, the agent is reminded,
|
|
80
|
+
// once per session, that the tool exists. Nothing is shown to the person, no
|
|
81
|
+
// name is given here (the tool names only people they know), nothing leaves the
|
|
82
|
+
// machine, and quiet turns it off with everything else.
|
|
83
|
+
// First-person, plain wording only: "the stuck-detection code" must not count.
|
|
84
|
+
const STUCK = new RegExp([
|
|
85
|
+
"\\b(i'?m|i am|i'?ve been|i have been|we'?re|we are|we'?ve been|still|totally|completely|really|so|got|getting|been) stuck\\b",
|
|
86
|
+
"\\bstuck (on|with|for|all|here|again)\\b",
|
|
87
|
+
"\\b(keep )?going (a?round )?in circles\\b",
|
|
88
|
+
"\\b(i'?m|i am|we'?re|we are) blocked on\\b",
|
|
89
|
+
"\\bcan(no|')?t figure (this|it|that) out\\b",
|
|
90
|
+
"\\bbanging my head\\b",
|
|
91
|
+
"\\bat my wits'? end\\b",
|
|
92
|
+
].join('|'), 'i');
|
|
93
|
+
|
|
94
|
+
function stuckNudge(input, dir) {
|
|
95
|
+
try {
|
|
96
|
+
const said = typeof input.prompt === 'string' ? input.prompt : '';
|
|
97
|
+
if (!said || said.length > 4000 || !STUCK.test(said)) return '';
|
|
98
|
+
try { if (JSON.parse(fs.readFileSync(path.join(dir, '..', 'reach.json'), 'utf8')).quiet === true) return ''; } catch {}
|
|
99
|
+
const session = String(input.session_id || '').replace(/[^A-Za-z0-9_-]/g, '').slice(0, 80);
|
|
100
|
+
if (!session) return '';
|
|
101
|
+
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
102
|
+
// Once per session: the first prompt that says it claims the marker.
|
|
103
|
+
try { fs.closeSync(fs.openSync(path.join(dir, `stuck-${session}.shown`), 'wx', 0o600)); } catch { return ''; }
|
|
104
|
+
return [
|
|
105
|
+
'/vibe: the person has just said, in their own words, that they are stuck.',
|
|
106
|
+
'Help with the problem first. Then call vibe_bump once, with one line on what they are stuck on: it says whether someone they already know is in a session right now working on the same thing. If it names nobody who fits, say nothing about it.',
|
|
107
|
+
].join('\n');
|
|
108
|
+
} catch { return ''; }
|
|
109
|
+
}
|
|
110
|
+
|
|
68
111
|
try { main(); } catch { quiet(); }
|