agentchannel 0.7.8 → 0.7.9
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/web.js +47 -19
- package/dist/web.js.map +1 -1
- package/package.json +1 -1
package/dist/web.js
CHANGED
|
@@ -107,7 +107,7 @@ body { font-family: var(--font); background: var(--bg); color: var(--text); heig
|
|
|
107
107
|
.conversation__text--grouped { }
|
|
108
108
|
|
|
109
109
|
.mention { background: var(--mention-bg); color: var(--mention-text); padding: 1px 4px; border-radius: 4px; font-weight: 500; font-size: 0.875rem; }
|
|
110
|
-
.channel-tag { background: rgba(77,186,135,0.1); color: #4dba87; padding: 1px 4px; border-radius: 4px; font-weight: 500; font-size:
|
|
110
|
+
.channel-tag { background: rgba(77,186,135,0.1); color: #4dba87; padding: 1px 4px; border-radius: 4px; font-weight: 500; font-size: inherit; cursor: pointer; }
|
|
111
111
|
|
|
112
112
|
.system-msg { text-align: center; font-size: 0.75rem; color: var(--text-muted); padding: 8px 0; }
|
|
113
113
|
|
|
@@ -244,15 +244,28 @@ function chId(ch) { return ch.subchannel ? ch.channel+'/'+ch.subchannel : ch.cha
|
|
|
244
244
|
function chLabel(ch) { return ch.subchannel ? '##'+ch.subchannel : '#'+ch.channel; }
|
|
245
245
|
function chFullLabel(ch) { return ch.subchannel ? '#'+ch.channel+' ##'+ch.subchannel : '#'+ch.channel; }
|
|
246
246
|
|
|
247
|
+
const INLINE_TAG_COLORS={bug:'239,68,68',p0:'239,68,68',p1:'245,158,11',p2:'107,114,128',feature:'59,130,246',release:'34,197,94',security:'168,85,247',design:'236,72,153',docs:'99,102,241',protocol:'139,92,246',todo:'245,158,11',fix:'239,68,68'};
|
|
248
|
+
|
|
247
249
|
function richText(t) {
|
|
248
|
-
// Protect @mentions
|
|
249
|
-
|
|
250
|
-
s =
|
|
251
|
-
|
|
250
|
+
// Protect [tags] at start of line, @mentions, ##subchannels, #channels
|
|
251
|
+
// Only match [word] patterns (no spaces, no markdown links like [text](url))
|
|
252
|
+
let s = t.replace(/(?:^|\\n)((?:\\[[a-zA-Z0-9_-]+\\])+)/g, function(m,tags){
|
|
253
|
+
return tags.replace(/\\[([a-zA-Z0-9_-]+)\\]/g, function(m2,tag){return '%%TAG:'+tag+'%%'});
|
|
254
|
+
});
|
|
255
|
+
s = s.replace(/@(\\w+)/g,'%%MENTION:$1%%');
|
|
256
|
+
// Match only known channel/subchannel names
|
|
257
|
+
var knownChannels = CONFIG.channels.filter(function(c){return !c.subchannel}).map(function(c){return c.channel});
|
|
258
|
+
var knownSubs = CONFIG.channels.filter(function(c){return c.subchannel}).map(function(c){return c.subchannel});
|
|
259
|
+
for (var ki=0;ki<knownSubs.length;ki++){s=s.split('##'+knownSubs[ki]).join('%%SUBCHANNEL:'+knownSubs[ki]+'%%');}
|
|
260
|
+
for (var ki=0;ki<knownChannels.length;ki++){s=s.split('#'+knownChannels[ki]).join('%%CHANNEL:'+knownChannels[ki]+'%%');}
|
|
252
261
|
s = marked.parse(s, {breaks: true});
|
|
262
|
+
s = s.replace(/%%TAG:([^%]+)%%/g, function(m,tag){
|
|
263
|
+
const c=INLINE_TAG_COLORS[tag.toLowerCase()]||'107,114,128';
|
|
264
|
+
return '<span style="background:rgba('+c+',0.1);color:rgb('+c+');font-size:0.75rem;padding:1px 6px;border-radius:3px;font-weight:600">['+tag+']</span>';
|
|
265
|
+
});
|
|
253
266
|
s = s.replace(/%%MENTION:(\\w+)%%/g,'<span class="mention">@$1</span>');
|
|
254
|
-
s = s.replace(/%%SUBCHANNEL:(\\w+)%%/g,'<span class="channel-tag">##$1</span>');
|
|
255
|
-
s = s.replace(/%%CHANNEL:(\\w+)%%/g,'<span class="channel-tag">#$1</span>');
|
|
267
|
+
s = s.replace(/%%SUBCHANNEL:(\\w+)%%/g,'<span class="channel-tag" onclick="switchToSub("$1")">##$1</span>');
|
|
268
|
+
s = s.replace(/%%CHANNEL:(\\w+)%%/g,'<span class="channel-tag" onclick="switchToChannel("$1")">#$1</span>');
|
|
256
269
|
// Add copy button to code blocks
|
|
257
270
|
s = s.replace(/<pre>/g,'<pre><button class="copy-btn" onclick="copyCode(this)">copy</button>');
|
|
258
271
|
return s;
|
|
@@ -285,20 +298,13 @@ function render() {
|
|
|
285
298
|
html += '<div class="conversation">';
|
|
286
299
|
html += '<div class="conversation__label">';
|
|
287
300
|
const msgFp = msg.senderKey ? '('+msg.senderKey.slice(0,4)+')' : '';
|
|
288
|
-
|
|
289
|
-
const tagHtml = msg.tags && msg.tags.length ? msg.tags.map(function(t){const c=TAG_COLORS[t.toLowerCase()]||'107,114,128';return '<span style="background:rgba('+c+',0.1);color:rgb('+c+');font-size:0.55rem;padding:1px 5px;border-radius:3px;font-weight:600;margin-left:4px">'+esc(t)+'</span>'}).join('') : '';
|
|
290
|
-
html += '<span class="conversation__sender">'+esc(msg.sender)+'<span style="color:var(--text-muted);font-weight:400;font-size:0.65rem;margin-left:2px">'+msgFp+'</span>'+tagHtml+'</span>';
|
|
301
|
+
html += '<span class="conversation__sender">'+esc(msg.sender)+'<span style="color:var(--text-muted);font-weight:400;font-size:0.65rem;margin-left:2px">'+msgFp+'</span></span>';
|
|
291
302
|
if (activeChannel === "all") { const mlabel = msg.subchannel ? '#'+esc(msg.channel)+' ##'+esc(msg.subchannel) : '#'+esc(msg.channel); html += '<span class="conversation__channel">'+mlabel+'</span>'; }
|
|
292
303
|
html += '<span class="conversation__time">'+time+'</span>';
|
|
293
304
|
html += '</div>';
|
|
294
305
|
html += '<button class="msg-copy" onclick="copyMsg(this)" data-msg="'+esc(msg.content).replace(/"/g,'"')+'" title="Copy"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg></button>';
|
|
295
306
|
}
|
|
296
307
|
|
|
297
|
-
// Show tags on every message (not just first in group)
|
|
298
|
-
if (isGrouped && msg.tags && msg.tags.length) {
|
|
299
|
-
const TAG_COLORS2={bug:'239,68,68',p0:'239,68,68',p1:'245,158,11',p2:'107,114,128',feature:'59,130,246',release:'34,197,94',security:'168,85,247',design:'236,72,153',docs:'99,102,241',protocol:'139,92,246'};
|
|
300
|
-
html += '<div style="margin-top:4px">' + msg.tags.map(function(t){const c=TAG_COLORS2[t.toLowerCase()]||'107,114,128';return '<span style="background:rgba('+c+',0.1);color:rgb('+c+');font-size:0.55rem;padding:1px 5px;border-radius:3px;font-weight:600;margin-right:4px">'+esc(t)+'</span>'}).join('') + '</div>';
|
|
301
|
-
}
|
|
302
308
|
html += '<div class="conversation__text'+(isGrouped?' conversation__text--grouped':'')+'">' + richText(msg.content) + '</div>';
|
|
303
309
|
|
|
304
310
|
lastSender = msg.sender;
|
|
@@ -512,10 +518,8 @@ async function init() {
|
|
|
512
518
|
client.on("connect",()=>{statusEl.textContent="v"+(CONFIG.version||"?")+" connected";statusEl.className="sidebar__status connected";for(const ch of Object.values(channels)){client.subscribe("ac/1/"+ch.hash);client.subscribe("ac/1/"+ch.hash+"/p")}
|
|
513
519
|
// Check for updates
|
|
514
520
|
fetch("https://registry.npmjs.org/agentchannel/latest").then(function(r){return r.json()}).then(function(d){if(d.version&&d.version!==CONFIG.version){
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
bar.innerHTML='<span>v'+d.version+' available</span><span style="opacity:0.6;font-size:0.75rem">Run: npm install -g agentchannel && restart</span>';
|
|
518
|
-
document.body.appendChild(bar);
|
|
521
|
+
statusEl.innerHTML='<div style="display:flex;flex-direction:column;gap:4px"><span style="color:#f59e0b;font-size:0.7rem">v'+d.version+' available</span><span id="update-copy" style="font-size:0.65rem;color:var(--text-muted);cursor:pointer;opacity:0.8">click to copy update cmd</span></div>';
|
|
522
|
+
document.getElementById("update-copy").onclick=function(){navigator.clipboard.writeText("npm install -g agentchannel");this.textContent="copied!"};
|
|
519
523
|
}}).catch(function(){});
|
|
520
524
|
});
|
|
521
525
|
client.on("close",()=>{statusEl.textContent="disconnected";statusEl.className="sidebar__status"});
|
|
@@ -700,6 +704,30 @@ async function init() {
|
|
|
700
704
|
});
|
|
701
705
|
|
|
702
706
|
window.renderMembers = renderMembers;
|
|
707
|
+
|
|
708
|
+
window.switchToChannel = function(name) {
|
|
709
|
+
activeChannel = name;
|
|
710
|
+
unreadCounts[name] = 0;
|
|
711
|
+
headerName.textContent = "#" + name;
|
|
712
|
+
headerDesc.textContent = "";
|
|
713
|
+
document.title = "AgentChannel";
|
|
714
|
+
history.pushState(null, "", "/channel/" + encodeURIComponent(name));
|
|
715
|
+
renderSidebar(); render(); renderMembers();
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
window.switchToSub = function(subName) {
|
|
719
|
+
// Find parent channel for this subchannel
|
|
720
|
+
var parent = CONFIG.channels.find(function(c){ return c.subchannel === subName; });
|
|
721
|
+
if (!parent) return;
|
|
722
|
+
var cid = parent.channel + "/" + subName;
|
|
723
|
+
activeChannel = cid;
|
|
724
|
+
unreadCounts[cid] = 0;
|
|
725
|
+
headerName.textContent = "##" + subName;
|
|
726
|
+
headerDesc.textContent = "#" + parent.channel;
|
|
727
|
+
document.title = "AgentChannel";
|
|
728
|
+
history.pushState(null, "", "/channel/" + encodeURIComponent(parent.channel) + "/sub/" + encodeURIComponent(subName));
|
|
729
|
+
renderSidebar(); render(); renderMembers();
|
|
730
|
+
};
|
|
703
731
|
renderMembers();
|
|
704
732
|
loadCloudMembers();
|
|
705
733
|
}
|
package/dist/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAG3D,MAAM,WAAW,GAAG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