slashvibe-mcp 0.9.0 → 0.9.2

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/README.md CHANGED
@@ -14,7 +14,11 @@ npx slashvibe-mcp
14
14
 
15
15
  It configures your coding agent, opens GitHub to sign you in (your GitHub username becomes
16
16
  your @handle), and installs the hooks that let messages reach you in Claude Code. Then
17
- restart your coding session.
17
+ restart your coding session and say `what's waiting on /vibe`.
18
+
19
+ Run it in your own terminal. If your coding agent is running it for you, have it run
20
+ `npx slashvibe-mcp setup` instead: without a terminal the bare command starts the server
21
+ and installs nothing.
18
22
 
19
23
  ## What it is like
20
24
 
@@ -68,9 +72,22 @@ Your agent is told to give information about the work only, and to hand anything
68
72
  you. That part is an instruction to a model, not a guarantee: open a line only with
69
73
  someone you would let read over your shoulder.
70
74
 
75
+ ## Who can reach you
76
+
77
+ Only people you know reach you while you work: someone you have written to, or someone you
78
+ opened a line with. Anyone else waits where `vibe start` lists what is waiting.
79
+
80
+ ```bash
81
+ npx slashvibe-mcp quiet # nothing surfaces until: unquiet
82
+ npx slashvibe-mcp mute @handle # one person stops surfacing: unmute @handle
83
+ ```
84
+
85
+ The line that says what you are working on is yours. Tell your agent ("say I'm working on
86
+ the scheduler lease") and it sets it; nothing is taken from your repository.
87
+
71
88
  ## The whole surface
72
89
 
73
- Eight tools, for the agent:
90
+ Eight tools, for the agent (plus `vibe_init` and `vibe_token`, which only handle sign-in):
74
91
 
75
92
  | tool | what it does |
76
93
  |---|---|
package/auth-store.js CHANGED
@@ -126,10 +126,10 @@ function hydrate() {
126
126
 
127
127
  _hydrated = true;
128
128
 
129
- if (_token) {
130
- console.error('[auth-store] Hydrated: @' + _handle);
131
- } else {
132
- console.error('[auth-store] Hydrated: no token');
129
+ // Diagnostic only. Unconditional, this was the first line a newcomer read
130
+ // when they ran the install command.
131
+ if (process.env.VIBE_DEBUG) {
132
+ console.error(_token ? '[auth-store] Hydrated: @' + _handle : '[auth-store] Hydrated: no token');
133
133
  }
134
134
  } catch (e) {
135
135
  console.error('[auth-store] Hydration failed:', e.message);
package/cli.js CHANGED
@@ -14,7 +14,31 @@
14
14
 
15
15
  const args = process.argv.slice(2);
16
16
 
17
- if (args[0] === 'hook') {
17
+ const COMMANDS = ['setup', 'hook', 'trust', 'untrust', 'lines', 'quiet', 'unquiet', 'mute', 'unmute'];
18
+ const USAGE = `slashvibe-mcp: telepathic messaging, inside your coding agent
19
+
20
+ npx slashvibe-mcp setup install: configure your coding agent and sign in with GitHub
21
+ npx slashvibe-mcp hook status are the Claude Code hooks installed (also: install, uninstall)
22
+ npx slashvibe-mcp trust @handle open a line with someone you trust (close: untrust @handle)
23
+ npx slashvibe-mcp lines who you have an open line with
24
+ npx slashvibe-mcp quiet nothing reaches you while you work (undo: unquiet)
25
+ npx slashvibe-mcp mute @handle one person stops surfacing (undo: unmute @handle)
26
+
27
+ With no command it sets up on first run in a terminal; a coding agent starts it as an MCP server.
28
+ https://github.com/VibeCodingInc/vibe-mcp#readme`;
29
+
30
+ if (['help', '--help', '-h'].includes(args[0])) {
31
+ process.stdout.write(`${USAGE}\n`);
32
+ } else if (['--version', '-v', 'version'].includes(args[0])) {
33
+ process.stdout.write(`${require('./package.json').version}\n`);
34
+ } else if (args[0] && process.stdin.isTTY && !COMMANDS.includes(args[0]) && !args.includes('setup')) {
35
+ // A person typed something we do not know. This used to fall through to the
36
+ // full setup: "--help" wrote agent configs and opened GitHub in a browser.
37
+ // Only on a terminal: a host that launches the server with arguments of its
38
+ // own must still get the server.
39
+ process.stderr.write(`Unknown command: ${args[0]}\n\n${USAGE}\n`);
40
+ process.exitCode = 1;
41
+ } else if (args[0] === 'hook') {
18
42
  require('./hook-cli')
19
43
  .run(args.slice(1))
20
44
  .catch((error) => {
@@ -31,7 +55,11 @@ if (args[0] === 'hook') {
31
55
  const line = require('./line');
32
56
  const say = (t) => process.stdout.write(`${t}\n`);
33
57
  try {
34
- if (args[0] === 'trust' && args[1]) {
58
+ if (['trust', 'untrust'].includes(args[0]) && args.length > 2) {
59
+ // One handle, exactly as typed. "trust @sam and @ada" must not quietly
60
+ // open a line with whoever the first word happens to name.
61
+ throw new Error(`One handle at a time: npx slashvibe-mcp ${args[0]} @handle`);
62
+ } else if (args[0] === 'trust' && args[1]) {
35
63
  const h = line.open(args[1]);
36
64
  say(`Open line with @${h}.`);
37
65
  say(`Your agent may now ask @${h}'s agent a question from your work, and answer theirs from yours, without stopping you. It is told to give information about the work only; the code caps it at ${line.MAX_PER_HOUR} messages an hour, refuses anything shaped like a credential, and marks each message as your agent's, unread by you. You are told what was said. It works both ways only if @${h} opens one with you.`);
@@ -47,6 +75,20 @@ if (args[0] === 'hook') {
47
75
  process.stderr.write(`${error?.message || error}\n`);
48
76
  process.exitCode = 1;
49
77
  }
78
+ } else if (['quiet', 'unquiet', 'mute', 'unmute'].includes(args[0])) {
79
+ // Who may reach you while you work (reach.js). Local, and yours to type.
80
+ const reach = require('./reach');
81
+ const say = (t) => process.stdout.write(`${t}\n`);
82
+ try {
83
+ if (args[0] === 'quiet') { reach.setQuiet(true); say('Quiet. Nothing will reach you while you work; messages wait until you ask what is waiting. Turn it off: npx slashvibe-mcp unquiet'); }
84
+ else if (args[0] === 'unquiet') { reach.setQuiet(false); say('Quiet is off. Messages from people you know reach you while you work again.'); }
85
+ else if (args[0] === 'mute' && args[1]) { const h = reach.mute(args[1]); say(`Muted @${h}. Their messages will not surface in your sessions; they stay in the conversation. Undo: npx slashvibe-mcp unmute @${h}`); }
86
+ else if (args[0] === 'unmute' && args[1]) { say(reach.unmute(args[1]) ? `Unmuted @${reach.norm(args[1])}.` : `@${reach.norm(args[1])} was not muted.`); }
87
+ else { const m = reach.muted(); say(`${reach.isQuiet() ? 'Quiet is on.' : 'Quiet is off.'} ${m.length ? `Muted: ${m.map((h) => `@${h}`).join(', ')}` : 'Nobody is muted.'}`); say('npx slashvibe-mcp quiet | unquiet | mute @handle | unmute @handle'); }
88
+ } catch (error) {
89
+ process.stderr.write(`${error?.message || error}\n`);
90
+ process.exitCode = 1;
91
+ }
50
92
  } else if (args.includes('setup')) {
51
93
  require('./setup.js');
52
94
  } else if (process.stdin.isTTY) {
@@ -88,10 +130,21 @@ if (args[0] === 'hook') {
88
130
  console.log('Commands:');
89
131
  console.log(' npx slashvibe-mcp setup — re-run setup wizard');
90
132
  console.log('');
91
- console.log('In Claude Code, just say "who\'s vibing?" to get started.');
133
+ console.log('In your coding agent, say "what\'s waiting on /vibe" to get started.');
92
134
  process.exit(0);
93
135
  }
94
136
  } else {
95
- // Running as MCP server (stdin is a pipe from Claude Code)
137
+ // Running as MCP server (stdin is a pipe from Claude Code).
138
+ //
139
+ // The same shape is an agent running the install line for its person from a
140
+ // shell tool: no terminal, so no setup, and until now no word of why. Say it
141
+ // once on stderr (a host ignores it; an agent's shell shows it). Only before
142
+ // first sign-in, so a working install stays silent.
143
+ try {
144
+ const config = require('./config');
145
+ if (!config.isInitialized() && !config.getAuthToken()) {
146
+ process.stderr.write('slashvibe-mcp: no terminal here, so this started as an MCP server and is waiting for a coding agent. To install /vibe, run: npx slashvibe-mcp setup\n');
147
+ }
148
+ } catch {}
96
149
  require('./index.js');
97
150
  }
@@ -15,4 +15,6 @@ The person wants to reach someone on /vibe from the work in this session. They s
15
15
  - **Edit** → ask what to change, call `vibe_prepare` again with the `id` and the new `message`, show the new preview, offer the choices again.
16
16
  - **Cancel** → `vibe_discard`. Nothing is sent.
17
17
 
18
+ If the person has no line saying what they are working on (`vibe_start` says so), offer once to set one from this session's work, in their words, and set it only if they agree.
19
+
18
20
  If they dictate exact words ("message @sam: ship it"), that is not this flow: send their words as they said them with `vibe_send` (`handle` + `message`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slashvibe-mcp",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "mcpName": "io.github.vibecodinginc/vibe",
5
5
  "description": "Telepathic messaging between people, from inside their coding agent sessions (Claude Code, Codex, Cursor)",
6
6
  "main": "index.js",
@@ -63,6 +63,7 @@
63
63
  "oauth-callback.js",
64
64
  "presence.js",
65
65
  "protocol/handle.js",
66
+ "reach.js",
66
67
  "session-start-hook-settings.js",
67
68
  "session-start-hook.cjs",
68
69
  "setup.js",
@@ -70,7 +71,6 @@
70
71
  "store/index.js",
71
72
  "store/local.js",
72
73
  "tools/_shared.js",
73
- "tools/_work-context.js",
74
74
  "tools/deliver.js",
75
75
  "tools/drafts.js",
76
76
  "tools/init.js",
package/presence.js CHANGED
@@ -13,6 +13,8 @@ const config = require('./config');
13
13
  const authStore = require('./auth-store');
14
14
  const store = require('./store');
15
15
  const arrival = require('./arrival');
16
+ const reach = require('./reach');
17
+ const line = require('./line');
16
18
 
17
19
  let heartbeatInterval = null;
18
20
  let pollTimer = null;
@@ -109,6 +111,22 @@ async function poll() {
109
111
  * VERIFIED session: an arrival names a sender to a person, and that is not
110
112
  * something to do on the strength of an unverified credential.
111
113
  */
114
+ /**
115
+ * Known = an open line, a send recorded on this machine, or (checked once and
116
+ * then remembered) any message of yours in the conversation, so someone you
117
+ * wrote to from another device still reaches you here. Reading the
118
+ * conversation does not mark it read. A failed read is "not known yet".
119
+ */
120
+ async function knows(me, them) {
121
+ if (line.isOpen(them) || reach.isKnown(them)) return true;
122
+ try {
123
+ const thread = await store.getThread(me, them);
124
+ const mine = String(me).toLowerCase();
125
+ if ((thread || []).some((m) => String(m.from || '').toLowerCase() === mine)) { reach.know(them); return true; }
126
+ } catch {}
127
+ return false;
128
+ }
129
+
112
130
  const startedAt = Date.now();
113
131
  let lastPruneAt = 0;
114
132
  let waitingAtStart = null;
@@ -116,6 +134,13 @@ async function noteArrivals(handle, threads) {
116
134
  if (!authStore.isVerified?.()) return;
117
135
  if (['0', 'off', 'false'].includes(String(process.env.VIBE_ARRIVALS || '').toLowerCase())) return;
118
136
  if (Date.now() - lastPruneAt > 60 * 60 * 1000) { lastPruneAt = Date.now(); arrival.prune(handle); }
137
+ // Quiet: nothing surfaces. What comes in meanwhile is remembered as waiting,
138
+ // so turning quiet off does not release a burst of old arrivals.
139
+ if (reach.isQuiet()) {
140
+ if (waitingAtStart === null) waitingAtStart = new Set();
141
+ for (const t of threads) if (t.unread > 0 && t.lastMessageId) waitingAtStart.add(t.lastMessageId);
142
+ return;
143
+ }
119
144
  // What was already unread on the FIRST look is "waiting" (shown when the
120
145
  // session opens), not an arrival. It is remembered by message id, so after
121
146
  // that first look a new id is an arrival whatever the two clocks say; only
@@ -126,10 +151,20 @@ async function noteArrivals(handle, threads) {
126
151
  waitingAtStart = new Set(threads.filter((t) => t.unread > 0 && t.lastMessageId && !early.has(t.lastMessageId))
127
152
  .map((t) => t.lastMessageId));
128
153
  }
129
- const live = threads.filter((t) => !waitingAtStart.has(t.lastMessageId));
130
- const candidates = arrival.pickArrivals(live, handle)
154
+ const fresh = threads.filter((t) => !waitingAtStart.has(t.lastMessageId));
155
+ const wanted = arrival.pickArrivals(fresh, handle)
131
156
  .filter((t) => !arrival.isClaimed(t.lastMessageId) && !arrival.isSpooled(t.lastMessageId));
157
+ // Only someone you know reaches you mid-work (reach.js). A muted person, or
158
+ // someone you have never written to, stays waiting: remembered here so the
159
+ // question is asked once per message, not once per poll.
160
+ const candidates = [];
161
+ for (const t of wanted) {
162
+ if (!reach.isMuted(t.lastFrom) && await knows(handle, t.lastFrom)) candidates.push(t);
163
+ else waitingAtStart.add(t.lastMessageId);
164
+ }
132
165
  if (candidates.length === 0) return;
166
+ const allowed = new Set(candidates.map((t) => t.lastMessageId));
167
+ const live = fresh.filter((t) => allowed.has(t.lastMessageId));
133
168
  const roster = await store.getActiveUsers().catch(() => []);
134
169
  let bindingFor = null;
135
170
  try { bindingFor = require('./tools/drafts').getReturnBinding; } catch {}
package/reach.js ADDED
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Who may reach you while you work.
3
+ *
4
+ * Arrival (arrival.js) puts a message in front of you mid-task, with your
5
+ * agent offering to answer. That is a privilege, not a default: a stranger who
6
+ * can interrupt a working session, and get an agent drafting replies to them,
7
+ * has a spam channel and a place to try instructions. So:
8
+ *
9
+ * - only someone you KNOW arrives while you work: a person you have written
10
+ * to, or one you opened a line with. Anyone else waits, unread, where
11
+ * vibe_start lists what is waiting;
12
+ * - `mute @handle` stops one person surfacing at all;
13
+ * - `quiet` stops everyone until `unquiet`.
14
+ *
15
+ * All of it is local to this machine and changed only by commands the person
16
+ * types (cli.js) or by their own sends (deliver.js records who they wrote to).
17
+ * Nothing here marks anything read: a held message is simply still waiting.
18
+ */
19
+
20
+ 'use strict';
21
+
22
+ const fs = require('fs');
23
+ const path = require('path');
24
+ const { vibeHome } = require('./vibe-home');
25
+
26
+ const file = (env) => path.join(vibeHome(env), 'reach.json');
27
+ const norm = (h) => String(h || '').trim().replace(/^@+/, '').toLowerCase();
28
+ const validHandle = (h) => /^[a-z0-9][a-z0-9_-]{1,38}$/.test(h);
29
+
30
+ function read(env = process.env) {
31
+ let v = null;
32
+ try { v = JSON.parse(fs.readFileSync(file(env), 'utf8')); } catch {}
33
+ const o = v && typeof v === 'object' && !Array.isArray(v) ? v : {};
34
+ return {
35
+ quiet: o.quiet === true,
36
+ muted: o.muted && typeof o.muted === 'object' ? o.muted : {},
37
+ known: o.known && typeof o.known === 'object' ? o.known : {},
38
+ };
39
+ }
40
+ function update(fn, env = process.env) {
41
+ const state = read(env);
42
+ const out = fn(state);
43
+ const target = file(env);
44
+ fs.mkdirSync(path.dirname(target), { recursive: true, mode: 0o700 });
45
+ const tmp = `${target}.${process.pid}.${Date.now()}.tmp`;
46
+ fs.writeFileSync(tmp, JSON.stringify(state, null, 2), { mode: 0o600 });
47
+ fs.renameSync(tmp, target);
48
+ return out;
49
+ }
50
+ function handle(h) {
51
+ const n = norm(h);
52
+ if (!validHandle(n)) throw new Error(`"${h}" is not a handle`);
53
+ return n;
54
+ }
55
+
56
+ const isQuiet = (env = process.env) => read(env).quiet;
57
+ const setQuiet = (on, env = process.env) => update((s) => { s.quiet = Boolean(on); }, env);
58
+
59
+ const isMuted = (h, env = process.env) => Boolean(read(env).muted[norm(h)]);
60
+ const mute = (h, env = process.env) => { const n = handle(h); update((s) => { s.muted[n] = Date.now(); }, env); return n; };
61
+ const unmute = (h, env = process.env) => update((s) => { const n = norm(h); const had = Boolean(s.muted[n]); delete s.muted[n]; return had; }, env);
62
+ const muted = (env = process.env) => Object.keys(read(env).muted).sort();
63
+
64
+ /** You have written to this person from this machine, or it was confirmed from the conversation. */
65
+ const isKnown = (h, env = process.env) => Boolean(read(env).known[norm(h)]);
66
+ function know(h, env = process.env) {
67
+ const n = norm(h);
68
+ if (!validHandle(n) || isKnown(n, env)) return;
69
+ try { update((s) => { s.known[n] = Date.now(); }, env); } catch {}
70
+ }
71
+
72
+ module.exports = { isQuiet, setQuiet, isMuted, mute, unmute, muted, isKnown, know, norm };
@@ -115,7 +115,29 @@ async function fetchLive() {
115
115
  if (!verified?.valid || !verified?.handle) return [];
116
116
  authStore.markVerified(verified.handle);
117
117
 
118
- return normalizeMessages(await store.getRawInbox(verified.handle));
118
+ // The same rule as arrival (reach.js): only people you know are put in
119
+ // front of you. Quiet shows nothing; a muted or unknown sender's message
120
+ // stays waiting where vibe_start counts it.
121
+ const reach = require('./reach');
122
+ const line = require('./line');
123
+ if (reach.isQuiet()) return [];
124
+ const me = String(verified.handle).toLowerCase();
125
+ const rows = (await store.getRawInbox(verified.handle)).slice(0, 8);
126
+ const kept = [];
127
+ for (const row of rows) {
128
+ const from = row && row.from;
129
+ if (!from || reach.isMuted(from)) continue;
130
+ let known = line.isOpen(from) || reach.isKnown(from);
131
+ if (!known) {
132
+ try {
133
+ const thread = await store.getThread(verified.handle, from);
134
+ known = (thread || []).some((m) => String(m.from || '').toLowerCase() === me);
135
+ if (known) reach.know(from);
136
+ } catch {}
137
+ }
138
+ if (known) kept.push(row);
139
+ }
140
+ return normalizeMessages(kept);
119
141
  }
120
142
 
121
143
  async function main() {
package/setup.js CHANGED
@@ -40,7 +40,7 @@ const API_BASE = 'https://www.slashvibe.dev';
40
40
  function printBanner() {
41
41
  console.log(`
42
42
  ${colors.green} █░█ █ █▄▄ █▀▀${colors.reset}
43
- ${colors.green} ▀▄▀ █ █▄█ ██▄${colors.reset} ${colors.dim}ask here · answer there${colors.reset}
43
+ ${colors.green} ▀▄▀ █ █▄█ ██▄${colors.reset} ${colors.dim}telepathic messaging, inside your coding agent${colors.reset}
44
44
  ──────────────────────────────────────────────────
45
45
  `);
46
46
  }
@@ -523,8 +523,6 @@ async function setup() {
523
523
  console.log(`${colors.dim} 1. Check your internet connection${colors.reset}`);
524
524
  console.log(`${colors.dim} 2. Try: ${colors.cyan}curl -s https://www.slashvibe.dev/api/health${colors.reset}`);
525
525
  console.log(`${colors.dim} 3. If that works, try setup again${colors.reset}`);
526
- console.log('');
527
- console.log(`${colors.dim} Status page: ${colors.cyan}slashvibe.dev/status${colors.reset}`);
528
526
  process.exit(1);
529
527
  }
530
528
 
@@ -545,6 +543,10 @@ async function setup() {
545
543
  oauth = await beginOAuth({ actorAware: true });
546
544
  openBrowser(oauth.loginUrl);
547
545
  console.log(`${colors.dim} → Waiting for authentication...${colors.reset}`);
546
+ // Always say where to go. The browser may have opened on a screen nobody is
547
+ // looking at (SSH), or not at all, and "waiting" with no link is a dead end.
548
+ console.log(`${colors.dim} → If no browser opened, open this to sign in:${colors.reset}`);
549
+ console.log(` ${colors.cyan}${oauth.loginUrl}${colors.reset}`);
548
550
 
549
551
  const authResult = await oauth.waitForCallback();
550
552
 
@@ -580,7 +582,8 @@ async function setup() {
580
582
 
581
583
  console.log(`${colors.bold} Quick start:${colors.reset}`);
582
584
  console.log(`${colors.dim} 1. Restart your coding agent${detected.length > 1 ? `s (${detected.join(', ')})` : ''}${colors.reset}`);
583
- console.log(`${colors.dim} 2. Say: "message @their-handle — ..." to someone you already know${colors.reset}`);
585
+ console.log(`${colors.dim} 2. Say: "what's waiting on /vibe" to see who has written to you${colors.reset}`);
586
+ console.log(`${colors.dim} or: "message @their-handle: ..." to someone you already know${colors.reset}`);
584
587
  // Receiving is the product: a reply has to reach you while you work, not
585
588
  // when you remember to ask. So the hooks are installed here, by default,
586
589
  // for Claude Code — stated plainly, with the one command that removes them.
@@ -644,7 +647,7 @@ async function setup() {
644
647
  }
645
648
  if (oauth && err.message !== 'AUTH_TIMEOUT') await oauth.cancel();
646
649
  console.log('');
647
- console.log(`${colors.dim} Need help? slashvibe.dev/help${colors.reset}`);
650
+ console.log(`${colors.dim} Need help? https://github.com/VibeCodingInc/vibe-mcp/issues${colors.reset}`);
648
651
  // On timeout the shared listener remains live during its grace window so a
649
652
  // late browser callback gets the explanatory page instead of a refusal.
650
653
  process.exitCode = 1;
package/store/api.js CHANGED
@@ -515,9 +515,9 @@ async function sendMessage(from, to, body, type = 'dm', payload = null, options
515
515
  }
516
516
  }
517
517
 
518
- console.error('[vibe] Sending request to endpoint:', endpoint, 'with data:', JSON.stringify(data).substring(0, 200));
518
+ // Never log the request or the response here: both carry the message text,
519
+ // and a host keeps an MCP server's stderr in its log files.
519
520
  const result = await request('POST', endpoint, data);
520
- console.error('[vibe] Got result:', JSON.stringify(result).substring(0, 300));
521
521
 
522
522
  // Handle auth errors
523
523
  if (!result.success && result.error?.includes('Authentication')) {
package/tools/deliver.js CHANGED
@@ -89,6 +89,9 @@ async function deliver(m) {
89
89
  }
90
90
  } catch (e) {}
91
91
 
92
+ // Writing to someone is what lets their answer reach you mid-work (reach.js).
93
+ require('../reach').know(them);
94
+
92
95
  return { display, data: { sent: true, message_id: result.id || null } };
93
96
  }
94
97
 
package/tools/init.js CHANGED
@@ -60,9 +60,9 @@ function formatPresenceLabel({ humans = 0, agents = 0 } = {}) {
60
60
  */
61
61
  function generatePreAuthBanner(presence) {
62
62
  const label = formatPresenceLabel(presence);
63
- const onlineText = label ? `🟢 ${label}` : '🟢 join the crew';
63
+ const onlineText = label ? `🟢 ${label}` : 'not signed in yet';
64
64
  return `
65
- █░█ █ █▄▄ █▀▀ ask here · answer there
65
+ █░█ █ █▄▄ █▀▀ telepathic messaging
66
66
  ▀▄▀ █ █▄█ ██▄ ${onlineText}
67
67
  ──────────────────────────────────────────────────
68
68
  `;
package/tools/line.js CHANGED
@@ -32,6 +32,7 @@ function commonRefusal(to, text, what) {
32
32
  if (!line.isOpen(to)) {
33
33
  return refuse(`No open line with @${to}, so nothing was sent. Prepare the ${what} with vibe_prepare and let the person decide. (A line is opened only by the person, from a terminal: npx slashvibe-mcp trust @${to})`);
34
34
  }
35
+ if (require('../reach').isMuted(to)) return refuse(`Nothing sent. @${to} is muted on this machine.`);
35
36
  if (!text) return refuse(`Nothing sent. The ${what} is empty.`);
36
37
  if (text.length > line.MAX_CHARS) return refuse(`Nothing sent. An unattended ${what} is at most ${line.MAX_CHARS} characters; this is ${text.length}. Shorten it, or prepare it with vibe_prepare for the person to review.`);
37
38
  if (line.looksSecret(text)) return refuse(`Nothing sent. The ${what} contains something shaped like a credential, and nobody is reviewing this message. Say it without that, or prepare it with vibe_prepare.`);
package/tools/people.js CHANGED
@@ -15,6 +15,7 @@ const store = require('../store');
15
15
  const { requireInit, normalizeHandle, isHereNow } = require('./_shared');
16
16
  const { inertField } = require('../incoming');
17
17
  const line = require('../line');
18
+ const reach = require('../reach');
18
19
 
19
20
  const DAY = 24 * 60 * 60 * 1000;
20
21
 
@@ -77,6 +78,7 @@ async function handler() {
77
78
  if (t.unread > 0) bits.push(`${t.unread} unread`);
78
79
  if (hereSet.has(normalizeHandle(t.handle))) bits.push('here now');
79
80
  if (line.isOpen(t.handle)) bits.push('open line');
81
+ if (reach.isMuted(t.handle)) bits.push('muted');
80
82
  lines.push(`@${inertField(t.handle, 39)} · ${bits.filter(Boolean).join(' · ')}`);
81
83
  }
82
84
  }
package/tools/start.js CHANGED
@@ -4,7 +4,8 @@
4
4
  * One screen: who you are, how many people are in a session, what is unread,
5
5
  * and which conversations ended on their words. Handles, counts, ages and
6
6
  * ids only. The words themselves stay in the thread until it is opened, and
7
- * nobody is suggested: who to talk to is the person's decision.
7
+ * nobody is suggested: who to talk to is the person's decision. It is also
8
+ * where the person's own line ("what I am working on") is set.
8
9
  */
9
10
 
10
11
  'use strict';
@@ -14,7 +15,7 @@ const { inertField } = require('../incoming');
14
15
  const store = require('../store');
15
16
  const { isHereNow, normalizeHandle } = require('./_shared');
16
17
  const init = require('./init');
17
- const { gatherWithTimeout } = require('./_work-context');
18
+ const reach = require('../reach');
18
19
  const { wroteLastPeople } = require('../arrival');
19
20
  const { isQaHandle } = require('./drafts');
20
21
  const line = require('../line');
@@ -26,7 +27,7 @@ const definition = {
26
27
  type: 'object',
27
28
  properties: {
28
29
  handle: { type: 'string', description: 'Only when signing in for the first time' },
29
- building: { type: 'string', description: 'One line on what you are working on. Only when signing in for the first time.' },
30
+ building: { type: 'string', description: 'One line, in the person\'s words, on what they are working on. Other people\'s agents read it to decide whether a question is for them, so set it only with words the person gave or agreed to. No file paths, secrets, or client names they have not said aloud.' },
30
31
  },
31
32
  },
32
33
  };
@@ -49,16 +50,20 @@ async function handler(args = {}) {
49
50
  const myHandle = config.getHandle();
50
51
  const me = normalizeHandle(myHandle || '');
51
52
 
52
- // What other people's agents will be told you are working on: a short note
53
- // derived from the repo you are in (redacted and capped in _work-context).
54
- // Opt out with `autoContext: false` in config.
55
- if (config.get('autoContext', true)) {
56
- gatherWithTimeout(2000).then((work) => {
57
- if (work?.suggestions?.brief) {
58
- return store.heartbeat(myHandle, config.getOneLiner(), { note: work.suggestions.brief, branch: null });
59
- }
60
- }).catch(() => {});
53
+ // The one line other people's agents read to decide whether a question is
54
+ // for you. It is yours: set only from words you gave or agreed to, never
55
+ // derived from your repository. (0.9.0 and earlier broadcast the latest
56
+ // commit message as a presence note; that is gone.)
57
+ let lineSet = null;
58
+ const wanted = typeof args.building === 'string' ? args.building.trim() : '';
59
+ if (wanted) {
60
+ lineSet = wanted.slice(0, 120);
61
+ const cfg = config.load(); cfg.one_liner = lineSet; config.save(cfg);
62
+ config.setSessionIdentity(myHandle, lineSet);
63
+ try { require('../auth-store').setOneLiner(lineSet); } catch {}
64
+ await store.heartbeat(myHandle, lineSet).catch(() => {});
61
65
  }
66
+ const myLine = lineSet || config.getOneLiner() || '';
62
67
 
63
68
  // A read that FAILED is not an empty room and not an empty inbox: both
64
69
  // outcomes are kept, and an unknown is shown as unknown, never as zero.
@@ -126,6 +131,12 @@ async function handler(args = {}) {
126
131
  display += '\n\nmessages will not reach you while you work yet. turn that on once: npx slashvibe-mcp hook install';
127
132
  }
128
133
 
134
+ // What others see about you, and whether anything can reach you right now.
135
+ display += myLine
136
+ ? `\n\nyou say you are working on: "${cell(myLine, 88)}"`
137
+ : '\n\nyou have not said what you are working on.\nother people\'s agents read that line to decide whether a question is for you.\noffer to set one: vibe_start with building.';
138
+ if (reach.isQuiet()) display += '\nquiet is on: nothing reaches you while you work. off: npx slashvibe-mcp unquiet';
139
+
129
140
  display += '\n\nopen a conversation: vibe thread @handle · see who is reachable: vibe people';
130
141
 
131
142
  // The payload says exactly what the screen says: a body withheld from the
@@ -136,6 +147,8 @@ async function handler(args = {}) {
136
147
  here: presenceRead ? hereCount : null,
137
148
  waiting: unreadSenders.slice(0, 5).map((t) => ({ handle: t.handle, unread: t.unread, lastMessageId: t.lastMessageId || null })),
138
149
  wroteLast: lastWord,
150
+ line: myLine || null,
151
+ quiet: reach.isQuiet(),
139
152
  lineReceipts: spoken.map((r) => ({ kind: r.kind, with: r.with, at: r.at })),
140
153
  };
141
154
  }
@@ -1,338 +0,0 @@
1
- /**
2
- * Shared work context gathering — used by start.js and work-summary.js
3
- *
4
- * SECURITY: Uses execFileSync (not execSync) to prevent shell injection.
5
- * A malicious branch name like "; rm -rf /" would be harmless with this approach.
6
- *
7
- * This module provides:
8
- * - Git state (branch, recent commits, changed files, uncommitted status)
9
- * - Project detection (package.json, Cargo.toml, pyproject.toml, or directory name)
10
- * - Auto-generated suggestions for presence and messages
11
- */
12
-
13
- const { execFileSync } = require('child_process');
14
- const fs = require('fs');
15
- const path = require('path');
16
-
17
- // ═══════════════════════════════════════════════════════════════════════════
18
- // SECURITY: Sanitization and limits
19
- // ═══════════════════════════════════════════════════════════════════════════
20
-
21
- // Strip ANSI escape sequences and control characters (prevent terminal injection)
22
- function sanitize(text) {
23
- if (!text) return text;
24
- return text
25
- .replace(/\x1B\[[0-9;]*[a-zA-Z]/g, '') // ANSI escape sequences
26
- .replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g, '') // Control chars (keep \t \n \r)
27
- .trim();
28
- }
29
-
30
- // Character limits (DoS prevention)
31
- const LIMITS = {
32
- branch: 100,
33
- commitMessage: 80,
34
- fileName: 50,
35
- totalFiles: 10,
36
- totalSummary: 200,
37
- };
38
-
39
- function cap(text, limit) {
40
- if (!text || text.length <= limit) return text;
41
- return text.slice(0, limit - 1) + '…';
42
- }
43
-
44
- // Redaction patterns (prevent accidental secret exposure)
45
- const REDACT_PATTERNS = [
46
- /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g, // emails
47
- /[a-fA-F0-9]{32,}/g, // long hex (tokens, hashes)
48
- /sk-[a-zA-Z0-9]{20,}/g, // OpenAI API keys
49
- /ghp_[a-zA-Z0-9]{36}/g, // GitHub tokens
50
- /\b(password|secret|token|api_key|apikey)\b/gi, // sensitive words in context
51
- ];
52
-
53
- function redact(text) {
54
- if (!text) return text;
55
- let result = text;
56
- for (const pattern of REDACT_PATTERNS) {
57
- result = result.replace(pattern, '[REDACTED]');
58
- }
59
- return result;
60
- }
61
-
62
- // ═══════════════════════════════════════════════════════════════════════════
63
- // GIT INFO GATHERING (Safe execution)
64
- // ═══════════════════════════════════════════════════════════════════════════
65
-
66
- /**
67
- * Execute git command safely (no shell, with timeout and output limits)
68
- * @param {string[]} args - Git command arguments (e.g., ['branch', '--show-current'])
69
- * @returns {string|null} - Command output or null on failure
70
- */
71
- function safeGitExec(args) {
72
- try {
73
- return execFileSync('git', args, {
74
- encoding: 'utf8',
75
- timeout: 2000, // 2s timeout
76
- maxBuffer: 100 * 1024, // 100KB max output
77
- shell: false, // CRITICAL: no shell = no injection
78
- stdio: ['pipe', 'pipe', 'pipe'] // Capture stderr too
79
- }).trim();
80
- } catch (e) {
81
- return null;
82
- }
83
- }
84
-
85
- /**
86
- * Get comprehensive git information for the current directory
87
- */
88
- function getGitInfo() {
89
- // Check if we're in a git repo first
90
- const branch = sanitize(safeGitExec(['branch', '--show-current']));
91
- if (!branch) {
92
- // Not a git repo or detached HEAD - try to get commit hash
93
- const headHash = sanitize(safeGitExec(['rev-parse', '--short', 'HEAD']));
94
- if (headHash) {
95
- return {
96
- branch: `detached:${cap(headHash, 10)}`,
97
- recentCommits: [],
98
- changedFiles: [],
99
- hasUncommitted: false,
100
- isDetached: true
101
- };
102
- }
103
- return null; // Not a git repo at all
104
- }
105
-
106
- // Get recent commits (--no-pager prevents interactive mode)
107
- const logOutput = sanitize(safeGitExec(['--no-pager', 'log', '--oneline', '-3'])) || '';
108
- const recentCommits = logOutput.split('\n').filter(Boolean).slice(0, 3).map(line => {
109
- const [hash, ...msg] = line.split(' ');
110
- return {
111
- hash: cap(hash, 7),
112
- message: redact(cap(msg.join(' '), LIMITS.commitMessage))
113
- };
114
- });
115
-
116
- // Get changed files (--no-ext-diff --no-textconv prevent custom diff handlers)
117
- const diffOutput = sanitize(safeGitExec([
118
- '--no-pager', 'diff', '--no-ext-diff', '--no-textconv',
119
- '--name-only', 'HEAD~1'
120
- ])) || '';
121
- const changedFiles = diffOutput.split('\n')
122
- .filter(Boolean)
123
- .slice(0, LIMITS.totalFiles)
124
- .map(f => cap(path.basename(f), LIMITS.fileName)); // Only basename, not full path
125
-
126
- // Check for uncommitted changes (porcelain = machine-readable, safe)
127
- const statusOutput = safeGitExec(['status', '--porcelain']);
128
-
129
- return {
130
- branch: cap(branch, LIMITS.branch),
131
- recentCommits,
132
- changedFiles,
133
- hasUncommitted: !!statusOutput,
134
- isDetached: false
135
- };
136
- }
137
-
138
- // ═══════════════════════════════════════════════════════════════════════════
139
- // PROJECT INFO GATHERING
140
- // ═══════════════════════════════════════════════════════════════════════════
141
-
142
- /**
143
- * Detect project type and name from manifest files
144
- */
145
- function getProjectInfo() {
146
- const cwd = process.cwd();
147
- const dirName = path.basename(cwd);
148
-
149
- let name = dirName;
150
- let type = 'unknown';
151
-
152
- // Try package.json (Node.js projects)
153
- try {
154
- const pkgPath = path.join(cwd, 'package.json');
155
- const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
156
- name = pkg.name || dirName;
157
-
158
- // Detect more specific type
159
- if (pkg.dependencies?.next || pkg.devDependencies?.next) {
160
- type = 'nextjs';
161
- } else if (pkg.dependencies?.react || pkg.devDependencies?.react) {
162
- type = 'react';
163
- } else if (pkg.devDependencies?.typescript || pkg.dependencies?.typescript) {
164
- type = 'typescript';
165
- } else {
166
- type = 'node';
167
- }
168
- } catch (e) {}
169
-
170
- // Try Cargo.toml (Rust projects)
171
- try {
172
- const cargoPath = path.join(cwd, 'Cargo.toml');
173
- fs.accessSync(cargoPath);
174
- type = 'rust';
175
-
176
- // Try to extract crate name
177
- const cargoContent = fs.readFileSync(cargoPath, 'utf8');
178
- const nameMatch = cargoContent.match(/name\s*=\s*"([^"]+)"/);
179
- if (nameMatch) name = nameMatch[1];
180
- } catch (e) {}
181
-
182
- // Try pyproject.toml (Python projects)
183
- try {
184
- const pyPath = path.join(cwd, 'pyproject.toml');
185
- fs.accessSync(pyPath);
186
- type = 'python';
187
-
188
- // Try to extract project name
189
- const pyContent = fs.readFileSync(pyPath, 'utf8');
190
- const nameMatch = pyContent.match(/name\s*=\s*"([^"]+)"/);
191
- if (nameMatch) name = nameMatch[1];
192
- } catch (e) {}
193
-
194
- // Try go.mod (Go projects)
195
- try {
196
- const goPath = path.join(cwd, 'go.mod');
197
- const goContent = fs.readFileSync(goPath, 'utf8');
198
- type = 'go';
199
-
200
- const moduleMatch = goContent.match(/module\s+(\S+)/);
201
- if (moduleMatch) {
202
- // Use last part of module path as name
203
- const parts = moduleMatch[1].split('/');
204
- name = parts[parts.length - 1];
205
- }
206
- } catch (e) {}
207
-
208
- return {
209
- name: cap(name, 50),
210
- type,
211
- directory: cwd
212
- };
213
- }
214
-
215
- // ═══════════════════════════════════════════════════════════════════════════
216
- // SUGGESTION GENERATION
217
- // ═══════════════════════════════════════════════════════════════════════════
218
-
219
- /**
220
- * Generate human-readable summaries of current work
221
- * @param {object} git - Git info from getGitInfo()
222
- * @param {object} project - Project info from getProjectInfo()
223
- * @returns {object} - { brief, detailed }
224
- */
225
- function generateSuggestions(git, project) {
226
- const suggestions = {};
227
-
228
- if (git?.branch && !git.isDetached) {
229
- // We have git context - build meaningful summary
230
- const branchDesc = ['main', 'master', 'develop'].includes(git.branch) ? '' : ` on ${git.branch}`;
231
-
232
- if (git.recentCommits.length > 0) {
233
- // Use most recent commit message as the summary
234
- suggestions.brief = `${git.recentCommits[0].message} — ${project.name}`;
235
- } else {
236
- suggestions.brief = `Working on ${project.name}${branchDesc}`;
237
- }
238
-
239
- // Detailed version includes more context
240
- const parts = [];
241
- if (git.recentCommits.length > 0) {
242
- parts.push(`Just pushed: "${git.recentCommits[0].message}"`);
243
- }
244
- if (branchDesc) {
245
- parts.push(branchDesc.trim());
246
- }
247
- if (git.changedFiles.length > 0) {
248
- // Group by directory for context
249
- const dirs = [...new Set(git.changedFiles.map(f => {
250
- const dir = f.split('/')[0];
251
- return dir === f ? '.' : dir;
252
- }))];
253
- const dirsStr = dirs.slice(0, 2).join(', ');
254
- parts.push(`${git.changedFiles.length} files in ${dirsStr}`);
255
- }
256
- if (git.hasUncommitted) {
257
- parts.push('uncommitted changes');
258
- }
259
-
260
- suggestions.detailed = parts.join('. ') || suggestions.brief;
261
- } else if (git?.isDetached) {
262
- // Detached HEAD state
263
- suggestions.brief = `Working on ${project.name} (${git.branch})`;
264
- suggestions.detailed = suggestions.brief;
265
- } else {
266
- // No git - just use project info
267
- suggestions.brief = `Working on ${project.name}`;
268
- suggestions.detailed = suggestions.brief;
269
- }
270
-
271
- // Apply final length cap
272
- suggestions.brief = cap(suggestions.brief, LIMITS.totalSummary);
273
- suggestions.detailed = cap(suggestions.detailed, LIMITS.totalSummary * 2);
274
-
275
- return suggestions;
276
- }
277
-
278
- // ═══════════════════════════════════════════════════════════════════════════
279
- // MAIN EXPORT
280
- // ═══════════════════════════════════════════════════════════════════════════
281
-
282
- /**
283
- * Gather complete work context - the main entry point
284
- * Safe, non-blocking, with graceful degradation
285
- */
286
- function gatherWorkContext() {
287
- const git = getGitInfo();
288
- const project = getProjectInfo();
289
- const suggestions = generateSuggestions(git, project);
290
-
291
- return {
292
- git,
293
- project,
294
- suggestions
295
- };
296
- }
297
-
298
- /**
299
- * Gather with timeout - for use in start.js where we can't block
300
- * @param {number} timeoutMs - Maximum time to wait (default 2000ms)
301
- */
302
- async function gatherWithTimeout(timeoutMs = 2000) {
303
- return new Promise((resolve) => {
304
- // Set a timeout that resolves with minimal fallback
305
- const timer = setTimeout(() => {
306
- resolve({
307
- git: null,
308
- project: { name: path.basename(process.cwd()), type: 'unknown', directory: process.cwd() },
309
- suggestions: { brief: 'Working locally', detailed: 'Working locally' }
310
- });
311
- }, timeoutMs);
312
-
313
- // Try to gather context
314
- try {
315
- const context = gatherWorkContext();
316
- clearTimeout(timer);
317
- resolve(context);
318
- } catch (e) {
319
- clearTimeout(timer);
320
- resolve({
321
- git: null,
322
- project: { name: path.basename(process.cwd()), type: 'unknown', directory: process.cwd() },
323
- suggestions: { brief: 'Working locally', detailed: 'Working locally' }
324
- });
325
- }
326
- });
327
- }
328
-
329
- module.exports = {
330
- gatherWorkContext,
331
- gatherWithTimeout,
332
- getGitInfo,
333
- getProjectInfo,
334
- // Exported for testing
335
- sanitize,
336
- redact,
337
- cap
338
- };