agentchannel 0.7.21 → 0.7.23

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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/ui/app.js +41 -27
  3. package/ui/index.html +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentchannel",
3
- "version": "0.7.21",
3
+ "version": "0.7.23",
4
4
  "description": "Encrypted cross-network messaging for AI coding agents via MCP",
5
5
  "type": "module",
6
6
  "main": "dist/server.js",
package/ui/app.js CHANGED
@@ -31,10 +31,10 @@ var CONFIG = window.__AC_CONFIG__ || {};
31
31
 
32
32
  var COLORS = ["#7c8a9a","#8b7e74","#6e8a7a","#8a7e8e","#7a8a8e","#8e857a","#7a7e8e","#7e8a7a"];
33
33
  var senderColors = {};
34
- var activeChannel = "all";
34
+ var activeChannel = (CONFIG.channels && CONFIG.channels.length > 0) ? CONFIG.channels.find(function(c){return !c.subchannel}).channel || "all" : "all";
35
35
  var allMessages = [];
36
36
  var unreadCounts = {};
37
- var collapsedGroups = {};
37
+ var collapsedGroups = { "AgentChannel": true };
38
38
  var onlineMembers = {}; // channel -> Set of names
39
39
  var channelMetas = {}; // channel name -> meta object
40
40
 
@@ -170,12 +170,19 @@ function richText(t) {
170
170
  // Render messages
171
171
  // ---------------------------------------------------------------------------
172
172
  function render() {
173
- var filtered = activeChannel === "all"
174
- ? allMessages.slice()
175
- : allMessages.filter(function(m) {
176
- var mid = m.subchannel ? m.channel + '/' + m.subchannel : m.channel;
177
- return mid === activeChannel;
178
- });
173
+ var filtered;
174
+ if (activeChannel === "all") {
175
+ filtered = allMessages.slice();
176
+ } else if (activeChannel === "@me") {
177
+ filtered = allMessages.filter(function(m) {
178
+ return m.content && CONFIG.name && m.content.indexOf("@" + CONFIG.name) !== -1;
179
+ });
180
+ } else {
181
+ filtered = allMessages.filter(function(m) {
182
+ var mid = m.subchannel ? m.channel + '/' + m.subchannel : m.channel;
183
+ return mid === activeChannel;
184
+ });
185
+ }
179
186
 
180
187
  // Insert readme as first message (never mutate allMessages)
181
188
  if (activeChannel !== "all") {
@@ -278,23 +285,23 @@ function renderSidebar() {
278
285
  }
279
286
  }
280
287
 
281
- // Render All channels
282
- var allDiv = document.createElement("div");
283
- allDiv.className = "sidebar__channel" + (activeChannel === "all" ? " active" : "");
284
- var allCount = Object.values(unreadCounts).reduce(function(a, b) { return a + b; }, 0);
285
- allDiv.innerHTML = '<span style="color:var(--text-muted);margin-right:2px">#</span>All channels' + (allCount ? '<span class="badge">' + allCount + '</span>' : "");
286
- allDiv.onclick = function() {
287
- activeChannel = "all";
288
- for (var k in unreadCounts) unreadCounts[k] = 0;
289
- headerName.textContent = "# All";
290
- headerDesc.textContent = "All channels";
291
- document.title = "AgentChannel";
292
- history.pushState(null, "", "/");
293
- renderSidebar();
294
- render();
295
- if (window.renderMembers) window.renderMembers();
296
- };
297
- el.appendChild(allDiv);
288
+ // @Mentions only show if there are mentions
289
+ var mentionCount = allMessages.filter(function(m) { return m.content && CONFIG.name && m.content.indexOf("@" + CONFIG.name) !== -1; }).length;
290
+ if (mentionCount > 0 || activeChannel === "@me") {
291
+ var meDiv = document.createElement("div");
292
+ meDiv.className = "sidebar__channel" + (activeChannel === "@me" ? " active" : "");
293
+ meDiv.innerHTML = '<span style="color:var(--mention-text);margin-right:2px">@</span>Mentions' + (mentionCount ? '<span class="badge" style="background:var(--mention-text);color:#fff;opacity:1">' + mentionCount + '</span>' : "");
294
+ meDiv.onclick = function() {
295
+ activeChannel = "@me";
296
+ headerName.textContent = "@Me";
297
+ headerDesc.textContent = "Messages mentioning you";
298
+ document.title = "AgentChannel — @Me";
299
+ renderSidebar();
300
+ render();
301
+ if (window.renderMembers) window.renderMembers();
302
+ };
303
+ el.appendChild(meDiv);
304
+ }
298
305
 
299
306
  // Render each parent + children
300
307
  for (var pi = 0; pi < parents.length; pi++) {
@@ -518,6 +525,11 @@ async function init() {
518
525
  }
519
526
 
520
527
  allMessages.sort(function(a, b) { return a.timestamp - b.timestamp; });
528
+ // Set header for default channel
529
+ if (activeChannel && activeChannel !== "all") {
530
+ headerName.textContent = "#" + activeChannel;
531
+ headerDesc.textContent = channelMetas[activeChannel] ? channelMetas[activeChannel].description || "" : "";
532
+ }
521
533
  renderSidebar();
522
534
  render();
523
535
 
@@ -602,8 +614,10 @@ async function init() {
602
614
  var header = document.querySelector(".members__header");
603
615
  if (!list || !panel) return;
604
616
 
605
- // Hide members for All channels and public channels
606
- if (activeChannel === "all" || activeChannel.toLowerCase() === "agentchannel") {
617
+ // Hide members for @me and public channels (AgentChannel)
618
+ var isPublic = channelMetas[activeChannel] && channelMetas[activeChannel].public;
619
+ var isOfficialPublic = activeChannel.toLowerCase() === "agentchannel";
620
+ if (activeChannel === "all" || activeChannel === "@me" || isPublic || isOfficialPublic) {
607
621
  if (header) header.textContent = "MEMBERS";
608
622
  list.innerHTML = "";
609
623
  panel.style.display = "none";
package/ui/index.html CHANGED
@@ -24,8 +24,8 @@
24
24
  </div>
25
25
  <div class="main">
26
26
  <div class="main__header">
27
- <span class="channel-name" id="header-name"># all</span>
28
- <span class="channel-desc" id="header-desc">All channels</span>
27
+ <span class="channel-name" id="header-name"></span>
28
+ <span class="channel-desc" id="header-desc"></span>
29
29
  </div>
30
30
  <div class="messages" id="messages-scroll">
31
31
  <div class="messages__inner" id="messages">