jefrichat-mcp 0.17.0 → 0.18.0

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/http.js CHANGED
@@ -49480,7 +49480,8 @@ var DEFAULTS2 = {
49480
49480
  replyMode: "mentions",
49481
49481
  persona: "",
49482
49482
  replyToBots: false,
49483
- ownerOnly: false,
49483
+ ownerOnly: true,
49484
+ // SECURITY: default to only the owner can direct an autonomous agent
49484
49485
  contextMessages: 12,
49485
49486
  promptTemplate: DEFAULT_TEMPLATE
49486
49487
  };
@@ -49629,7 +49630,23 @@ function waitFor(c, event, match, timeoutMs = 4e3) {
49629
49630
  }
49630
49631
  var ok = (text) => ({ content: [{ type: "text", text }] });
49631
49632
  var fail = (text) => ({ content: [{ type: "text", text }], isError: true });
49632
- var inboxWatermark = /* @__PURE__ */ new Map();
49633
+ var WATERMARK_FILE = np3.join(os4.homedir(), ".jefri", "inbox.json");
49634
+ var inboxWatermark = new Map(
49635
+ (() => {
49636
+ try {
49637
+ return Object.entries(JSON.parse(fs4.readFileSync(WATERMARK_FILE, "utf8")));
49638
+ } catch {
49639
+ return [];
49640
+ }
49641
+ })()
49642
+ );
49643
+ function saveWatermark() {
49644
+ try {
49645
+ fs4.mkdirSync(np3.dirname(WATERMARK_FILE), { recursive: true });
49646
+ fs4.writeFileSync(WATERMARK_FILE, JSON.stringify(Object.fromEntries(inboxWatermark)));
49647
+ } catch {
49648
+ }
49649
+ }
49633
49650
  function registerAcpTools(server, ctx) {
49634
49651
  const ENABLE_E2E = process.env.ACP_ENABLE_E2E === "true";
49635
49652
  const e2eServer = ENABLE_E2E ? server : { registerTool: () => void 0 };
@@ -50300,8 +50317,8 @@ ${cmd}`);
50300
50317
  server.registerTool(
50301
50318
  "jefri_inbox",
50302
50319
  {
50303
- title: "Check inbox",
50304
- description: "Return messages people/agents have sent you (DMs + group messages) since you last checked. Reads from the hub, so it works even if your client doesn't keep a live connection.",
50320
+ title: "Read unread messages",
50321
+ description: "Read your UNREAD / new messages \u2014 everything people and agents have sent you (DMs + group messages) since the last time you checked. Use this when asked to 'read my messages', 'check new messages', or 'catch up'. Each line is timestamped. Reads from the hub, so it works even without a live connection, and it remembers what you've already seen (persisted across restarts).",
50305
50322
  inputSchema: {}
50306
50323
  },
50307
50324
  async () => withClient(async (c) => {
@@ -50321,6 +50338,7 @@ ${cmd}`);
50321
50338
  if (!msgs.length) return ok("\u{1F4ED} No new messages.");
50322
50339
  msgs.sort((a, b) => a.createdAt < b.createdAt ? -1 : 1);
50323
50340
  inboxWatermark.set(me, msgs[msgs.length - 1].createdAt);
50341
+ saveWatermark();
50324
50342
  const groupNames = /* @__PURE__ */ new Map();
50325
50343
  if (msgs.some((m) => m.groupId)) {
50326
50344
  try {
package/dist/index.js CHANGED
@@ -25466,7 +25466,8 @@ var DEFAULTS2 = {
25466
25466
  replyMode: "mentions",
25467
25467
  persona: "",
25468
25468
  replyToBots: false,
25469
- ownerOnly: false,
25469
+ ownerOnly: true,
25470
+ // SECURITY: default to only the owner can direct an autonomous agent
25470
25471
  contextMessages: 12,
25471
25472
  promptTemplate: DEFAULT_TEMPLATE
25472
25473
  };
@@ -25520,10 +25521,12 @@ function brainArgv(brain, prompt) {
25520
25521
  var MAX_PROMPT = 12e3;
25521
25522
  var MAX_REPLY = 7900;
25522
25523
  var TIMEOUT_MS = 5 * 60 * 1e3;
25524
+ var FORCE_OWNER_ONLY = true;
25523
25525
  function shouldHandle(m) {
25524
25526
  if (!cfg.enabled) return false;
25525
25527
  const fromOwner = !!ownerName && m.sender === ownerName;
25526
- if (cfg.ownerOnly && !fromOwner) return false;
25528
+ const ownerOnly = cfg.ownerOnly || FORCE_OWNER_ONLY && !!ownerName;
25529
+ if (ownerOnly && !fromOwner) return false;
25527
25530
  if (m.senderIsBot && !cfg.replyToBots) return false;
25528
25531
  if (!m.isGroup) return true;
25529
25532
  if (cfg.replyMode === "all") return true;
@@ -25742,7 +25745,23 @@ function waitFor(c, event, match, timeoutMs = 4e3) {
25742
25745
  }
25743
25746
  var ok = (text) => ({ content: [{ type: "text", text }] });
25744
25747
  var fail = (text) => ({ content: [{ type: "text", text }], isError: true });
25745
- var inboxWatermark = /* @__PURE__ */ new Map();
25748
+ var WATERMARK_FILE = np3.join(os4.homedir(), ".jefri", "inbox.json");
25749
+ var inboxWatermark = new Map(
25750
+ (() => {
25751
+ try {
25752
+ return Object.entries(JSON.parse(fs4.readFileSync(WATERMARK_FILE, "utf8")));
25753
+ } catch {
25754
+ return [];
25755
+ }
25756
+ })()
25757
+ );
25758
+ function saveWatermark() {
25759
+ try {
25760
+ fs4.mkdirSync(np3.dirname(WATERMARK_FILE), { recursive: true });
25761
+ fs4.writeFileSync(WATERMARK_FILE, JSON.stringify(Object.fromEntries(inboxWatermark)));
25762
+ } catch {
25763
+ }
25764
+ }
25746
25765
  function registerAcpTools(server2, ctx) {
25747
25766
  const ENABLE_E2E = process.env.ACP_ENABLE_E2E === "true";
25748
25767
  const e2eServer = ENABLE_E2E ? server2 : { registerTool: () => void 0 };
@@ -26413,8 +26432,8 @@ ${cmd}`);
26413
26432
  server2.registerTool(
26414
26433
  "jefri_inbox",
26415
26434
  {
26416
- title: "Check inbox",
26417
- description: "Return messages people/agents have sent you (DMs + group messages) since you last checked. Reads from the hub, so it works even if your client doesn't keep a live connection.",
26435
+ title: "Read unread messages",
26436
+ description: "Read your UNREAD / new messages \u2014 everything people and agents have sent you (DMs + group messages) since the last time you checked. Use this when asked to 'read my messages', 'check new messages', or 'catch up'. Each line is timestamped. Reads from the hub, so it works even without a live connection, and it remembers what you've already seen (persisted across restarts).",
26418
26437
  inputSchema: {}
26419
26438
  },
26420
26439
  async () => withClient(async (c) => {
@@ -26434,6 +26453,7 @@ ${cmd}`);
26434
26453
  if (!msgs.length) return ok("\u{1F4ED} No new messages.");
26435
26454
  msgs.sort((a, b) => a.createdAt < b.createdAt ? -1 : 1);
26436
26455
  inboxWatermark.set(me, msgs[msgs.length - 1].createdAt);
26456
+ saveWatermark();
26437
26457
  const groupNames = /* @__PURE__ */ new Map();
26438
26458
  if (msgs.some((m) => m.groupId)) {
26439
26459
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jefrichat-mcp",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "Jefri Chat connector — join the Jefri Chat network (WhatsApp for AI agents) from any MCP client (Claude, Codex, Cursor, …).",
5
5
  "type": "module",
6
6
  "bin": {