slashvibe-mcp 0.9.19 → 0.9.20

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
@@ -212,15 +212,22 @@ npx slashvibe-mcp operate # the agents you are named on · renew @sol
212
212
 
213
213
  ## Who can reach you
214
214
 
215
- Only people you know reach you while you work: someone you have written to, or someone you
216
- opened a line with. Anyone else waits where `vibe start` lists what is waiting.
215
+ Only people you know reach you while you work: someone you have written to, someone you
216
+ opened a line with, or someone who joined /vibe with your invitation. Anyone else waits where
217
+ `vibe start` lists what is waiting.
218
+
219
+ Your invite line carries a code made on your account (`setup --from @you --invite VIBE-…`).
220
+ When the person you give it to signs in with it, /vibe records that they used your
221
+ invitation and tells you, and only you. Their first message then reaches you while you work,
222
+ marked "you invited them". A code works once. Whoever uses it is treated as someone you
223
+ invited, so give the line to the person you mean. `mute @them` undoes it.
217
224
 
218
225
  You are still told when that happens. When a session opens, one line says how many people
219
226
  you have not written to are waiting, and how to ask: `what's waiting on /vibe`. It says
220
227
  nothing about who they are or what they wrote, to you or to your agent, until you ask.
221
228
  If one of them first wrote after you were given your invite line (`setup --from @you`), it
222
- says it may be someone you invited: that is from timing on your machine alone, since /vibe
223
- does not yet tell you who accepted an invite.
229
+ says it may be someone you invited: that is from timing on your machine alone, for an
230
+ invite line given without a code (an older line, or one made while /vibe could not be reached).
224
231
 
225
232
  ```bash
226
233
  npx slashvibe-mcp quiet # nothing surfaces until: unquiet
package/arrival.js CHANGED
@@ -151,7 +151,7 @@ function render(item) {
151
151
  ];
152
152
  } else {
153
153
  lines = [
154
- `/vibe — ${who} just wrote to the person you are working with.`,
154
+ `/vibe — ${who} just wrote to the person you are working with.${item.invited ? ` They joined /vibe with the person's invitation, so this is someone they invited; it is their first message to reach them.` : ''}`,
155
155
  '',
156
156
  'What to do, in this order:',
157
157
  '1. Tell them now, in one line: who wrote, and quote what they said.',
@@ -177,7 +177,8 @@ function render(item) {
177
177
  // carry their own mark; anything else is simply something they wrote.
178
178
  const verb = lineOpen && line.isAgentAnswer(item.text) ? "'s agent answered"
179
179
  : (lineOpen && line.isAgentAsk(item.text) ? "'s agent asked over your open line" : ' wrote you');
180
- return { context, line: `/vibe · @${from}${verb}: "${inertField(text, 140)}"` };
180
+ const invited = item.invited && !lineOpen ? ' (you invited them)' : '';
181
+ return { context, line: `/vibe · @${from}${invited}${verb}: "${inertField(text, 140)}"` };
181
182
  }
182
183
 
183
184
  // ── the spool ───────────────────────────────────────────────────────────────
@@ -235,6 +236,9 @@ function record(threads, me, { since = 0, roster = [], bindingFor = null, env =
235
236
  at: Date.now(),
236
237
  // An open line with this person changes what the agent may do (line.js).
237
238
  line: line.isOpen(t.lastFrom, env),
239
+ // The platform said they redeemed this person's invitation, and that is
240
+ // what made them known just now (presence.js knownByInvite): said once.
241
+ invited: t.introducedByInvite === true,
238
242
  };
239
243
  if (item.line && line.isAgentAnswer(item.text)) {
240
244
  // What this side asked, so the answer is read beside its question.
package/invite.js CHANGED
@@ -118,20 +118,77 @@ async function accept(typed, me, opts = {}) {
118
118
  };
119
119
  }
120
120
 
121
+ // ── the invitation code ─────────────────────────────────────────────────────
122
+ // The line a person gives out carries an invitation code minted on THEIR
123
+ // account. The newcomer's sign-in redeems it (the platform records who created
124
+ // it and who used it, under its own lock), and from then on the inviter's
125
+ // inbox serves `invited_by_you` for that one person, so their first message
126
+ // reaches the inviter while they work instead of waiting as a stranger's.
127
+ // The code is only a key to the platform's own record: this machine never
128
+ // decides who invited whom, and a code the newcomer types cannot make them
129
+ // known to anyone the platform did not record.
130
+ const validCode = (c) => typeof c === 'string' && /^VIBE-[A-Z0-9]{2,16}(?:-[A-Z0-9]{1,16}){0,3}$/.test(c);
131
+
132
+ /** `--invite CODE` / `--invite=CODE` out of an argv. null when absent or malformed. */
133
+ function inviteArg(argv = process.argv) {
134
+ for (let i = 0; i < argv.length; i++) {
135
+ const a = String(argv[i]);
136
+ const v = a === '--invite' ? argv[i + 1] : (a.startsWith('--invite=') ? a.slice(9) : null);
137
+ if (v == null) continue;
138
+ const c = String(v).trim().toUpperCase();
139
+ return validCode(c) ? c : null;
140
+ }
141
+ return null;
142
+ }
143
+
144
+ const DAY_MS = 24 * 60 * 60 * 1000;
145
+
146
+ /**
147
+ * A code for this person's invite line: one of their own live, plain codes
148
+ * (not named for anyone, carrying no note or thought) with at least a day
149
+ * left, else a new one. At most one auto-made code is live at a time, so the
150
+ * three-code allowance is not spent by showing the line again. null on any
151
+ * failure: the line then goes out without a code, exactly as before.
152
+ */
153
+ async function codeFor(me, { store = require('./store'), now = Date.now() } = {}) {
154
+ try {
155
+ if (!validHandle(reach.norm(me))) return null;
156
+ if (!store || typeof store.listMyInvites !== 'function' || typeof store.createInvite !== 'function') return null;
157
+ const mine = await store.listMyInvites();
158
+ if (!mine || mine.success === false) return null;
159
+ const plain = (Array.isArray(mine.codes) ? mine.codes : []).find((c) => c && c.status === 'available' &&
160
+ !c.named_for && !c.for_email_hash && !c.carries_thought && validCode(String(c.code || '')) &&
161
+ Date.parse(c.expires_at) - now > DAY_MS);
162
+ if (plain) return String(plain.code);
163
+ if (mine.can_generate === false) return null;
164
+ const made = await store.createInvite({});
165
+ const code = made && made.success !== false ? String(made.code || '') : '';
166
+ return validCode(code) ? code : null;
167
+ } catch {
168
+ return null;
169
+ }
170
+ }
171
+
121
172
  /** What a person sends to whoever they build with. */
122
- function line(me) {
173
+ function line(me, code = null) {
123
174
  const h = reach.norm(me);
124
175
  if (!validHandle(h)) return null;
125
- return { command: `npx slashvibe-mcp setup --from @${h}`, link: `https://www.slashvibe.dev/join?from=${h}` };
176
+ const c = validCode(code) ? code : null;
177
+ return {
178
+ command: `npx slashvibe-mcp setup --from @${h}${c ? ` --invite ${c}` : ''}`,
179
+ link: `https://www.slashvibe.dev/join?from=${h}${c ? `&invite=${c}` : ''}`,
180
+ };
126
181
  }
127
182
 
128
183
  // ── the inviter's side ──────────────────────────────────────────────────────
129
- // `setup --from @sam` marks Sam as known on the NEWCOMER's machine only. The
130
- // platform is told nothing, so Sam's machine cannot know who accepted, and the
131
- // newcomer's first message reaches Sam as one from "a person you have not
132
- // written to" (lab 2026-11-20, p08 and p13). Until the platform can say who
133
- // accepted an invite of yours, the one true thing this machine knows is WHEN
134
- // it gave the person their invite line to pass on. The session-start line uses
184
+ // `setup --from @sam` marks Sam as known on the NEWCOMER's machine only. A line
185
+ // that also carries a code (`--invite`, codeFor above) lets the platform tell
186
+ // Sam who accepted (`invited_by_you`, presence.js). A line WITHOUT a code (an
187
+ // older line, or one made offline) tells the platform nothing, so Sam's
188
+ // machine cannot know who accepted, and the newcomer's first message reaches
189
+ // Sam as one from "a person you have not written to" (lab 2026-11-20, p08 and
190
+ // p13). For those, the one true thing this machine knows is WHEN it gave the
191
+ // person their invite line to pass on. The session-start line uses
135
192
  // that, and only that: someone you have not written to who first wrote after
136
193
  // that moment "may be someone you invited". It names nobody and quotes nothing.
137
194
  const GIVEN_TTL_MS = 30 * 24 * 60 * 60 * 1000;
@@ -161,4 +218,4 @@ function noteGiven(env = process.env, now = Date.now()) {
161
218
  } catch {}
162
219
  }
163
220
 
164
- module.exports = { fromArg, accept, line, lookup, resolveRecipient, noteGiven, givenAt, GIVEN_TTL_MS };
221
+ module.exports = { fromArg, inviteArg, codeFor, validCode, accept, line, lookup, resolveRecipient, noteGiven, givenAt, GIVEN_TTL_MS };
package/oauth-callback.js CHANGED
@@ -194,6 +194,7 @@ function listen(server, port) {
194
194
  async function beginOAuth({
195
195
  requestedHandle,
196
196
  actorAware = false,
197
+ inviteCode = null,
197
198
  timeoutMs = DEFAULT_TIMEOUT_MS,
198
199
  graceMs = DEFAULT_GRACE_MS,
199
200
  } = {}) {
@@ -365,6 +366,10 @@ async function beginOAuth({
365
366
  loginUrl.searchParams.set('state', state);
366
367
  if (requestedHandle) loginUrl.searchParams.set('handle', requestedHandle);
367
368
  if (actorAware) loginUrl.searchParams.set('actor_aware', 'true');
369
+ // An invitation code from the line someone gave this person (setup --invite).
370
+ // The platform redeems it only for a newly created account, and only once;
371
+ // an older platform ignores it and sign-in is unchanged.
372
+ if (inviteCode && require('./invite').validCode(inviteCode)) loginUrl.searchParams.set('invite_code', inviteCode);
368
373
 
369
374
  timeoutTimer = setTimeout(() => {
370
375
  if (phase !== 'waiting' && phase !== 'waitingActor') return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slashvibe-mcp",
3
- "version": "0.9.19",
3
+ "version": "0.9.20",
4
4
  "mcpName": "io.github.vibecodinginc/vibe",
5
5
  "description": "Telepathic messaging between people, from inside Claude Code",
6
6
  "main": "index.js",
package/presence.js CHANGED
@@ -179,6 +179,23 @@ let waitingAtStart = null;
179
179
  const parked = new Map(); // sender (lowercase) -> { ids: Set, row }
180
180
  const lower = (h) => String(h || '').toLowerCase();
181
181
 
182
+ /**
183
+ * The platform says this person redeemed an invitation the person here gave
184
+ * out (`invited_by_you`, served for the caller only; absent on an older
185
+ * platform). That makes them someone the person knows, the same way writing to
186
+ * them does: marked in reach.json (so `mute` undoes it) and returned true.
187
+ * Only for a row that is theirs: the conversation's other person is the sender.
188
+ * Returns whether this call is what made them known, so the arrival can say
189
+ * "you invited them" once, the first time, and not on every message after.
190
+ */
191
+ function knownByInvite(t) {
192
+ if (!t || t.invitedByYou !== true || !t.lastFrom || lower(t.handle) !== lower(t.lastFrom)) return false;
193
+ if (reach.isMuted(t.lastFrom)) return false;
194
+ if (line.isOpen(t.lastFrom) || reach.isKnown(t.lastFrom)) return false;
195
+ reach.know(t.lastFrom);
196
+ return reach.isKnown(t.lastFrom);
197
+ }
198
+
182
199
  function park(t) {
183
200
  const h = lower(t.lastFrom);
184
201
  const e = parked.get(h) || { ids: new Set(), row: null };
@@ -204,7 +221,9 @@ const isParked = (id) => { for (const e of parked.values()) if (e.ids.has(id)) r
204
221
  function releaseParked(me, threads) {
205
222
  const extra = [];
206
223
  for (const [h, e] of parked) {
207
- if (!(line.isOpen(h) || reach.isKnown(h))) continue;
224
+ // Parked before the platform said they redeemed this person's invitation
225
+ // (a cached inbox, an older platform until now): that releases it too.
226
+ if (!(line.isOpen(h) || reach.isKnown(h)) && !knownByInvite(threads.find((t) => t && lower(t.handle) === h))) continue;
208
227
  const id = e.row.lastMessageId;
209
228
  if (reach.isMuted(h)) { for (const x of e.ids) waitingAtStart.add(x); parked.delete(h); continue; }
210
229
  const row = threads.find((t) => t && lower(t.handle) === h);
@@ -250,6 +269,9 @@ async function noteArrivals(handle, threads) {
250
269
  const unknown = arrival.pickArrivals(threads.filter((t) => waitingAtStart.has(t.lastMessageId) &&
251
270
  !reach.isMuted(t.lastFrom) && !line.isOpen(t.lastFrom) && !reach.isKnown(t.lastFrom)), handle);
252
271
  for (const t of unknown) {
272
+ // Someone they invited is known now; what they wrote stays waiting (the
273
+ // session-start line shows it), it is not parked.
274
+ if (knownByInvite(t)) continue;
253
275
  if (await knows(handle, t.lastFrom) === false) { waitingAtStart.delete(t.lastMessageId); park(t); }
254
276
  }
255
277
  }
@@ -267,6 +289,7 @@ async function noteArrivals(handle, threads) {
267
289
  const candidates = [];
268
290
  for (const t of wanted) {
269
291
  if (reach.isMuted(t.lastFrom)) { waitingAtStart.add(t.lastMessageId); continue; }
292
+ if (knownByInvite(t)) { t.introducedByInvite = true; candidates.push(t); continue; }
270
293
  const known = await knows(handle, t.lastFrom);
271
294
  if (known === true) candidates.push(t);
272
295
  else if (known === false) park(t);
@@ -305,6 +305,10 @@ async function fetchLive() {
305
305
  for (const row of rows) {
306
306
  const from = row && row.from;
307
307
  if (!from || reach.isMuted(from)) continue;
308
+ // The platform says they redeemed an invitation this person gave out
309
+ // (served for this person only; absent on an older platform): known, as
310
+ // if written to, and remembered so `mute` undoes it.
311
+ if (row.invitedByYou === true && !line.isOpen(from) && !reach.isKnown(from)) reach.know(from);
308
312
  let known = line.isOpen(from) || reach.isKnown(from);
309
313
  // "Never written to" is a claim about the conversation, so it is made only
310
314
  // when the conversation was actually read. A read that failed comes back
package/setup.js CHANGED
@@ -458,7 +458,7 @@ async function setup() {
458
458
  try {
459
459
  // The callback listener is bound before beginOAuth returns, so the browser
460
460
  // cannot race a listener that does not exist yet.
461
- oauth = await beginOAuth({ actorAware: true });
461
+ oauth = await beginOAuth({ actorAware: true, inviteCode: require('./invite').inviteArg() });
462
462
  openBrowser(oauth.loginUrl);
463
463
  console.log(`${colors.dim} → Waiting for authentication...${colors.reset}`);
464
464
  // Always say where to go. The browser may have opened on a screen nobody is
@@ -518,7 +518,9 @@ async function setup() {
518
518
  for (const l of got.lines) console.log(`${colors.dim} ${l}${colors.reset}`);
519
519
  if (got.lines.length) console.log('');
520
520
  }
521
- const bring = invite.line(authResult.handle);
521
+ // The line carries a code minted on this account, so whoever installs from
522
+ // it is someone this person knows once they sign in (invite.codeFor).
523
+ const bring = invite.line(authResult.handle, await invite.codeFor(authResult.handle));
522
524
  if (bring) {
523
525
  invite.noteGiven();
524
526
  console.log(`${colors.bold} /vibe takes two. Send this to the person you build with:${colors.reset}`);
package/store/api.js CHANGED
@@ -659,6 +659,9 @@ async function getInboxInner(handle) {
659
659
  // Drafting tools use it so an agent is never suggested as a person.
660
660
  lastActorKind: t.last_message?.actor?.kind || null,
661
661
  muted: t.preferences?.muted || false,
662
+ // Served for the caller only: this person redeemed an invitation the
663
+ // caller gave out. Absent on older platforms, which reads as false.
664
+ invitedByYou: t.invited_by_you === true,
662
665
  lastTimestamp: t.last_message?.created_at ? new Date(t.last_message.created_at).getTime() : null
663
666
  }));
664
667
  }
@@ -705,6 +708,7 @@ async function getInboxV1(handle) {
705
708
  // Actor metadata of the newest message, as served (#272: server-owned).
706
709
  // Drafting tools use it so an agent is never suggested as a person.
707
710
  lastActorKind: t.last_message?.actor?.kind || null,
711
+ invitedByYou: t.invited_by_you === true,
708
712
  lastTimestamp: t.last_message?.created_at ? new Date(t.last_message.created_at).getTime() : null
709
713
  }));
710
714
  }
@@ -789,6 +793,8 @@ async function getRawInbox(handle) {
789
793
  read: false, // If it's in unread threads, it's unread
790
794
  thread_id: thread.id,
791
795
  unread_count: thread.unread,
796
+ // The caller invited this person (served for the caller only; absent = false).
797
+ invitedByYou: thread.invited_by_you === true,
792
798
  });
793
799
  });
794
800
 
@@ -927,6 +933,11 @@ async function createInvite(body) {
927
933
  return request('POST', '/api/invites', body, { maxRetries: 0 });
928
934
  }
929
935
 
936
+ /** GET /api/invites/my — the person's own invitation codes (their credential only). */
937
+ async function listMyInvites() {
938
+ return request('GET', '/api/invites/my', null, { maxRetries: 0 });
939
+ }
940
+
930
941
  // ============ AUTH ============
931
942
 
932
943
  /**
@@ -1043,6 +1054,7 @@ module.exports = {
1043
1054
 
1044
1055
  // Invites (a held message for someone not on /vibe yet)
1045
1056
  createInvite,
1057
+ listMyInvites,
1046
1058
 
1047
1059
  // Hermetic request-count tests for the named-thread fast path.
1048
1060
  _testing: { getThreadWithRequest, markThreadReadWithRequest },
package/tools/start.js CHANGED
@@ -107,7 +107,7 @@ async function handler(args = {}) {
107
107
  // the message sent next reaches the friend while they work instead of
108
108
  // waiting as "1 person you have not written to". Without a usable handle
109
109
  // the bare install still works; it just cannot name anyone.
110
- const bring = invite.line(myHandle);
110
+ const bring = invite.line(myHandle, await invite.codeFor(myHandle));
111
111
  if (bring) invite.noteGiven();
112
112
  display += `\n\nno conversations yet. /vibe takes two: send the person you work with this, then message them.\n ${bring ? bring.command : 'npx slashvibe-mcp setup'}`;
113
113
  }