@agentsignalnet/claude-plugin 0.2.59 → 0.2.60
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/.claude-plugin/plugin.json +1 -1
- package/package.json +1 -1
- package/scripts/chat-viewer.mjs +268 -38
package/package.json
CHANGED
package/scripts/chat-viewer.mjs
CHANGED
|
@@ -566,6 +566,37 @@ const PAGE = `<!doctype html>
|
|
|
566
566
|
/* The two names, stacked. min-width:0 is what lets the ellipsis inside
|
|
567
567
|
actually happen -- a flex child defaults to min-width:auto and refuses to
|
|
568
568
|
shrink below its content, so the row overflows instead of trimming. */
|
|
569
|
+
/* A CHANNEL AND ITS CONTENTS, which is what the nesting is for. The rule
|
|
570
|
+
that matters is the left border on the body: without a line, an indent
|
|
571
|
+
alone reads as ragged alignment rather than as containment. */
|
|
572
|
+
/* The company a group of channels belongs to. Quieter than the rail title
|
|
573
|
+
above it and louder than the channel rows beneath, so it reads as a
|
|
574
|
+
heading for them rather than as another thing to click. */
|
|
575
|
+
.company + .company { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
|
|
576
|
+
.company-name {
|
|
577
|
+
font-size: 12px; font-weight: 600; color: var(--fg);
|
|
578
|
+
margin: 0 0 6px; padding: 0 2px;
|
|
579
|
+
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
580
|
+
}
|
|
581
|
+
.chan { margin-bottom: 4px; }
|
|
582
|
+
.chan-head { display: flex; align-items: center; gap: 2px; }
|
|
583
|
+
.twist {
|
|
584
|
+
flex: 0 0 auto; width: 20px; height: 24px; padding: 0; cursor: pointer;
|
|
585
|
+
border: 1px solid transparent; border-radius: 6px; background: transparent;
|
|
586
|
+
color: var(--dim); font: inherit; font-size: 11px; line-height: 1;
|
|
587
|
+
}
|
|
588
|
+
.twist:hover { background: var(--accent-soft); color: var(--fg); }
|
|
589
|
+
.twist:focus-visible { outline: none; box-shadow: var(--focus); }
|
|
590
|
+
.chan-name { flex: 1; min-width: 0; }
|
|
591
|
+
.chan-body {
|
|
592
|
+
margin-left: 9px; padding-left: 10px; border-left: 1px solid var(--line);
|
|
593
|
+
margin-top: 1px;
|
|
594
|
+
}
|
|
595
|
+
/* The channel being read, said once and quietly. Every other row in here is
|
|
596
|
+
a link too, so the marker has to be weight rather than another colour. */
|
|
597
|
+
nav a.chan-name.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
|
|
598
|
+
.chan-body .none { font-size: 12px; color: var(--dim); font-style: italic; margin: 4px 8px; }
|
|
599
|
+
|
|
569
600
|
.stack { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
|
|
570
601
|
.alias {
|
|
571
602
|
font-size: 11px; color: var(--dim); line-height: 1.3;
|
|
@@ -811,9 +842,8 @@ const PAGE = `<!doctype html>
|
|
|
811
842
|
<span class="meta" style="margin-left:auto"><span class="dot" id="dot"></span> <span id="count">0</span> messages</span>
|
|
812
843
|
</header>
|
|
813
844
|
<div id="shell">
|
|
814
|
-
<aside id="side" aria-label="
|
|
815
|
-
<
|
|
816
|
-
<p class="rail-title">In this channel</p>
|
|
845
|
+
<aside id="side" aria-label="Channels">
|
|
846
|
+
<p class="rail-title">Channels</p>
|
|
817
847
|
<nav id="who-nav"></nav>
|
|
818
848
|
<details id="setup"><summary>This machine</summary><div id="setupbody">reading…</div></details>
|
|
819
849
|
</aside>
|
|
@@ -1028,6 +1058,15 @@ const PAGE = `<!doctype html>
|
|
|
1028
1058
|
const T = new URLSearchParams(location.search).get('t') || '';
|
|
1029
1059
|
const q = (path) => path + (path.includes('?') ? '&' : '?') + 't=' + encodeURIComponent(T);
|
|
1030
1060
|
|
|
1061
|
+
/** Every channel the server can open, from the poll. */
|
|
1062
|
+
let CHANNELS = [];
|
|
1063
|
+
/** Which of them are expanded in the rail. */
|
|
1064
|
+
const OPEN = new Set();
|
|
1065
|
+
/** The rendered agent tree per channel, so reopening one costs nothing. */
|
|
1066
|
+
const BRANCHES = new Map();
|
|
1067
|
+
/** Whether the channel being read has been opened for the first time yet. */
|
|
1068
|
+
let OPENED_ONCE = false;
|
|
1069
|
+
|
|
1031
1070
|
async function post(path, payload) {
|
|
1032
1071
|
const response = await fetch(q(path), {
|
|
1033
1072
|
method: 'POST',
|
|
@@ -1042,17 +1081,24 @@ const PAGE = `<!doctype html>
|
|
|
1042
1081
|
// answers to one question on one screen.
|
|
1043
1082
|
let ROSTER = [];
|
|
1044
1083
|
|
|
1045
|
-
|
|
1084
|
+
/**
|
|
1085
|
+
* ONE CHANNEL'S ROSTER, fetched and turned into a branch of the rail.
|
|
1086
|
+
*
|
|
1087
|
+
* Takes the channel rather than reading the URL, because the rail can now
|
|
1088
|
+
* show the members of a channel you are NOT looking at -- that is what
|
|
1089
|
+
* expanding one means. The active flag says whether this is the channel whose log
|
|
1090
|
+
* is on screen, which decides two things it would be wrong to do for the
|
|
1091
|
+
* others: filling the send box, and holding ROSTER for the log to read
|
|
1092
|
+
* names out of.
|
|
1093
|
+
*/
|
|
1094
|
+
async function roster(ref, active) {
|
|
1046
1095
|
let list;
|
|
1047
1096
|
try {
|
|
1048
|
-
|
|
1049
|
-
// reason the poll carries it.
|
|
1050
|
-
const on = new URLSearchParams(location.search).get('channel');
|
|
1051
|
-
list = await (await fetch(q('/agents' + (on ? '?channel=' + encodeURIComponent(on) : '')))).json();
|
|
1097
|
+
list = await (await fetch(q('/agents' + (ref ? '?channel=' + encodeURIComponent(ref) : '')))).json();
|
|
1052
1098
|
} catch {
|
|
1053
1099
|
return;
|
|
1054
1100
|
}
|
|
1055
|
-
ROSTER = list.recipients ?? [];
|
|
1101
|
+
if (active) ROSTER = list.recipients ?? [];
|
|
1056
1102
|
// People are listed too, and a person has no chat to open -- nothing is
|
|
1057
1103
|
// sent FROM a phone. Agents only.
|
|
1058
1104
|
const everyone = list.recipients ?? [];
|
|
@@ -1061,7 +1107,10 @@ const PAGE = `<!doctype html>
|
|
|
1061
1107
|
// a person's conversation -- nothing is sent from a phone -- but notifying
|
|
1062
1108
|
// one is the most useful thing this box does.
|
|
1063
1109
|
const to = document.getElementById('to');
|
|
1064
|
-
for
|
|
1110
|
+
// Only for the channel on screen. Expanding another channel to see who is
|
|
1111
|
+
// in it must not quietly add its members to the box that sends -- picking
|
|
1112
|
+
// one would deliver into a channel the composer is not looking at.
|
|
1113
|
+
for (const r of active ? everyone : []) {
|
|
1065
1114
|
const option = document.createElement('option');
|
|
1066
1115
|
option.value = r.key;
|
|
1067
1116
|
option.textContent = (who(r) || r.key) + (r.is_agent ? '' : ' (person)');
|
|
@@ -1120,8 +1169,13 @@ const PAGE = `<!doctype html>
|
|
|
1120
1169
|
* the top and this still caught me.
|
|
1121
1170
|
*/
|
|
1122
1171
|
const alias = a.name && a.name !== a.handle ? a.name : null;
|
|
1123
|
-
|
|
1124
|
-
|
|
1172
|
+
// The channel this agent is in, carried on the link so the rail can tell
|
|
1173
|
+
// a filter (same channel, no request) from a navigation (another
|
|
1174
|
+
// channel, which has no traffic loaded to filter). The href carries it
|
|
1175
|
+
// too, because following it must land on the right conversation.
|
|
1176
|
+
const at_channel = ref ? '?channel=' + encodeURIComponent(ref) : '';
|
|
1177
|
+
return '<a href="/a/' + encodeURIComponent(at) + at_channel + '" data-agent="' + esc(at) +
|
|
1178
|
+
'" data-channel="' + esc(ref ?? '') + '" data-key="' + esc(a.key) + '" class="' + state + on +
|
|
1125
1179
|
'" title="' + esc(name) + ' — last seen ' + esc(when) + '"><i></i>' +
|
|
1126
1180
|
'<span class="stack"><span class="nm">' + esc(a.handle ?? name) + '</span>' +
|
|
1127
1181
|
(alias ? '<small class="alias">' + esc(alias) + '</small>' : '') +
|
|
@@ -1178,11 +1232,17 @@ const PAGE = `<!doctype html>
|
|
|
1178
1232
|
.join('');
|
|
1179
1233
|
};
|
|
1180
1234
|
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1235
|
+
/**
|
|
1236
|
+
* Keyed by the ref the SERVER resolved, not the one we asked with.
|
|
1237
|
+
*
|
|
1238
|
+
* At boot there is no channel in the URL and no channel list yet, so the
|
|
1239
|
+
* fetch goes out unqualified and the server answers about its default.
|
|
1240
|
+
* Caching that under the empty string left the rail looking up the real
|
|
1241
|
+
* ref, finding nothing, and showing "reading..." forever under a channel
|
|
1242
|
+
* whose roster had already arrived.
|
|
1243
|
+
*/
|
|
1244
|
+
BRANCHES.set(list.channel?.ref ?? ref ?? '', branch(null, 0));
|
|
1245
|
+
drawRail();
|
|
1186
1246
|
}
|
|
1187
1247
|
|
|
1188
1248
|
/**
|
|
@@ -1199,25 +1259,147 @@ const PAGE = `<!doctype html>
|
|
|
1199
1259
|
* carried through, because dropping it is what made the agent links
|
|
1200
1260
|
* answer "Not found" before they stopped being links at all.
|
|
1201
1261
|
*/
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1262
|
+
/**
|
|
1263
|
+
* ONE TREE: every channel, each opening to show who is in it.
|
|
1264
|
+
*
|
|
1265
|
+
* It was two lists -- the channels, then "in this channel" -- which said the
|
|
1266
|
+
* same relationship twice and made the members look like a separate thing
|
|
1267
|
+
* rather than the contents of the row above them. Nesting is the honest
|
|
1268
|
+
* shape: an agent belongs to exactly one channel, and the rail should say so
|
|
1269
|
+
* by where it puts it.
|
|
1270
|
+
*
|
|
1271
|
+
* A channel you are not looking at can be opened. That costs one roster
|
|
1272
|
+
* fetch, once, and answers "who is in the other one" without leaving the
|
|
1273
|
+
* conversation you are reading.
|
|
1274
|
+
*/
|
|
1275
|
+
function drawRail() {
|
|
1276
|
+
const nav = document.getElementById('who-nav');
|
|
1277
|
+
if (!nav) return;
|
|
1278
|
+
|
|
1279
|
+
/**
|
|
1280
|
+
* SECTIONED BY COMPANY, because a channel name means little on its own.
|
|
1281
|
+
*
|
|
1282
|
+
* "Default" is the name almost every account's first channel has, so two
|
|
1283
|
+
* companies produce two rows called the same thing and the rail becomes a
|
|
1284
|
+
* list you have to decode. Grouped under whose they are, the same two rows
|
|
1285
|
+
* read at a glance.
|
|
1286
|
+
*
|
|
1287
|
+
* Grouped on the account ID and LABELLED with the name: two companies may
|
|
1288
|
+
* choose the same name, and one renamed mid-session must not split into
|
|
1289
|
+
* two sections. A channel whose account is not known yet -- the key
|
|
1290
|
+
* context is cached for a minute, so this happens right after the column
|
|
1291
|
+
* was added -- groups under its own ref rather than being hidden.
|
|
1292
|
+
*
|
|
1293
|
+
* The heading is dropped when everything belongs to one company. A section
|
|
1294
|
+
* label that is the same for every row underneath it is furniture.
|
|
1295
|
+
*/
|
|
1296
|
+
const groups = [];
|
|
1297
|
+
for (const c of CHANNELS) {
|
|
1298
|
+
/**
|
|
1299
|
+
* UNKNOWN ACCOUNTS SHARE ONE BUCKET, they do not each get their own.
|
|
1300
|
+
*
|
|
1301
|
+
* The account arrives from the API, and an older one does not send it at
|
|
1302
|
+
* all -- as does a key whose context was cached before the field
|
|
1303
|
+
* existed. Keying those on the channel instead would give every channel
|
|
1304
|
+
* a section of its own, each headed "Unnamed company", which is the flat
|
|
1305
|
+
* list back again with a wrong label on every row.
|
|
1306
|
+
*/
|
|
1307
|
+
const at = c.account ?? '';
|
|
1308
|
+
let group = groups.find((g) => g.at === at);
|
|
1309
|
+
if (!group) {
|
|
1310
|
+
group = { at, company: c.company ?? null, channels: [] };
|
|
1311
|
+
groups.push(group);
|
|
1312
|
+
}
|
|
1313
|
+
// The first non-null name wins, so one channel answering before another
|
|
1314
|
+
// does not leave the section unlabelled.
|
|
1315
|
+
group.company = group.company ?? c.company ?? null;
|
|
1316
|
+
group.channels.push(c);
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
// Headings only when they distinguish something. One company, or a server
|
|
1320
|
+
// that does not say, and the rail stays the plain list it was.
|
|
1321
|
+
const sectioned = groups.length > 1 && groups.every((g) => g.at);
|
|
1322
|
+
|
|
1323
|
+
const rows = (list) => list.map((c) => {
|
|
1324
|
+
const ref = c.ref ?? '';
|
|
1325
|
+
const open = OPEN.has(ref);
|
|
1326
|
+
const branch = BRANCHES.get(ref);
|
|
1327
|
+
const href = c.ref ? q('/?channel=' + encodeURIComponent(c.ref)) : q('/');
|
|
1328
|
+
|
|
1329
|
+
const head =
|
|
1330
|
+
'<div class="chan-head">' +
|
|
1331
|
+
'<button type="button" class="twist" data-open="' + ref + '" ' +
|
|
1332
|
+
'aria-expanded="' + (open ? 'true' : 'false') + '" ' +
|
|
1333
|
+
'aria-label="' + (open ? 'Collapse ' : 'Expand ') + esc(c.name || ref) + '">' +
|
|
1334
|
+
(open ? '▾' : '▸') + '</button>' +
|
|
1335
|
+
'<a class="chan-name' + (c.active ? ' on' : '') + '" href="' + esc(href) + '" data-channel="' + ref + '">' +
|
|
1336
|
+
'<span class="stack"><span class="nm">' + esc(c.name || ref || 'channel') + '</span>' +
|
|
1337
|
+
(ref ? '<small class="alias">' + esc(ref) + '</small>' : '') +
|
|
1338
|
+
'</span></a></div>';
|
|
1339
|
+
|
|
1340
|
+
if (!open) return '<div class="chan">' + head + '</div>';
|
|
1341
|
+
|
|
1342
|
+
// "everything" clears the agent filter, and only means anything in the
|
|
1343
|
+
// channel being read -- in any other it is the link that switches to it.
|
|
1344
|
+
const all =
|
|
1345
|
+
'<a href="' + esc(href) + '" data-agent="" data-key="" data-channel="' + ref + '" ' +
|
|
1346
|
+
'class="whole' + (c.active && !AGENT ? ' on' : '') + '">' +
|
|
1347
|
+
'<span class="nm">everything here</span></a>';
|
|
1348
|
+
|
|
1349
|
+
const body = branch === undefined ? '<p class="none">reading…</p>' : all + branch;
|
|
1350
|
+
return '<div class="chan">' + head + '<div class="chan-body">' + body + '</div></div>';
|
|
1351
|
+
}).join('');
|
|
1352
|
+
|
|
1353
|
+
nav.innerHTML = groups
|
|
1354
|
+
.map((g) =>
|
|
1355
|
+
sectioned
|
|
1356
|
+
? '<div class="company"><p class="company-name">' +
|
|
1357
|
+
esc(g.company || 'Unnamed company') +
|
|
1358
|
+
'</p>' + rows(g.channels) + '</div>'
|
|
1359
|
+
: rows(g.channels),
|
|
1360
|
+
)
|
|
1361
|
+
.join('');
|
|
1362
|
+
|
|
1363
|
+
markNav();
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
/**
|
|
1367
|
+
* Open a channel, fetching its roster the first time.
|
|
1368
|
+
*
|
|
1369
|
+
* Drawn twice on purpose: once immediately so the twisty turns and a
|
|
1370
|
+
* "reading…" line appears, and again when the roster lands. Waiting for the
|
|
1371
|
+
* network before showing anything makes a click feel like it missed.
|
|
1372
|
+
*/
|
|
1373
|
+
async function openChannel(ref) {
|
|
1374
|
+
if (OPEN.has(ref)) {
|
|
1375
|
+
OPEN.delete(ref);
|
|
1376
|
+
drawRail();
|
|
1207
1377
|
return;
|
|
1208
1378
|
}
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1379
|
+
OPEN.add(ref);
|
|
1380
|
+
drawRail();
|
|
1381
|
+
if (!BRANCHES.has(ref)) {
|
|
1382
|
+
await roster(ref, ref === activeRef());
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
/** The channel whose log is on screen. */
|
|
1387
|
+
function activeRef() {
|
|
1388
|
+
return new URLSearchParams(location.search).get('channel') ?? (CHANNELS[0]?.ref ?? '');
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
/** Keep the rail in step with what the poll says exists. */
|
|
1392
|
+
function renderChannels(list) {
|
|
1393
|
+
if (!list) return;
|
|
1394
|
+
CHANNELS = list;
|
|
1395
|
+
const active = list.find((c) => c.active);
|
|
1396
|
+
// The channel being read starts open, because its members are the ones
|
|
1397
|
+
// the log is about. The rest stay shut until asked for.
|
|
1398
|
+
if (active && !OPENED_ONCE) {
|
|
1399
|
+
OPEN.add(active.ref ?? '');
|
|
1400
|
+
OPENED_ONCE = true;
|
|
1401
|
+
}
|
|
1402
|
+
drawRail();
|
|
1221
1403
|
}
|
|
1222
1404
|
|
|
1223
1405
|
/** Whether a nav link is the one currently filtering. Key or handle, either may be in the URL. */
|
|
@@ -1228,10 +1410,26 @@ const PAGE = `<!doctype html>
|
|
|
1228
1410
|
return AGENT === at || ( AGENT !== '' && AGENT === key );
|
|
1229
1411
|
}
|
|
1230
1412
|
|
|
1413
|
+
/**
|
|
1414
|
+
* Whether a rail link is an agent filter at all.
|
|
1415
|
+
*
|
|
1416
|
+
* A channel row has no data-agent, and reading a missing one as the empty
|
|
1417
|
+
* string made every channel match the unfiltered view -- so both channels
|
|
1418
|
+
* lit up as selected at once, which is the one thing the highlight exists
|
|
1419
|
+
* to prevent.
|
|
1420
|
+
*/
|
|
1421
|
+
function isFilter(link) {
|
|
1422
|
+
return link.dataset.agent !== undefined;
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1231
1425
|
/** Move the highlight without re-rendering the roster, which would refetch /agents. */
|
|
1232
1426
|
function markNav() {
|
|
1233
1427
|
for (const link of document.querySelectorAll('#who-nav a')) {
|
|
1234
|
-
|
|
1428
|
+
if (!isFilter(link)) continue;
|
|
1429
|
+
// Only within the channel being read: an agent link in a channel you are
|
|
1430
|
+
// peeking into is a way to go there, not the current selection.
|
|
1431
|
+
const here = (link.dataset.channel ?? '') === activeRef();
|
|
1432
|
+
link.classList.toggle('on', here && matchesNav(link));
|
|
1235
1433
|
}
|
|
1236
1434
|
}
|
|
1237
1435
|
|
|
@@ -2055,10 +2253,30 @@ const PAGE = `<!doctype html>
|
|
|
2055
2253
|
// nothing a new tab could show that this does not. Somebody who wants one can copy the
|
|
2056
2254
|
// address bar, which has the token.
|
|
2057
2255
|
document.getElementById('who-nav').addEventListener('click', (event) => {
|
|
2058
|
-
|
|
2256
|
+
// The twisty opens and closes without going anywhere. Checked first
|
|
2257
|
+
// because it sits inside the same row as the link beside it.
|
|
2258
|
+
const twist = event.target.closest('.twist');
|
|
2259
|
+
if (twist) {
|
|
2260
|
+
event.preventDefault();
|
|
2261
|
+
openChannel(twist.dataset.open ?? '');
|
|
2262
|
+
return;
|
|
2263
|
+
}
|
|
2059
2264
|
|
|
2265
|
+
const link = event.target.closest('a');
|
|
2060
2266
|
if (!link) return;
|
|
2061
2267
|
|
|
2268
|
+
/**
|
|
2269
|
+
* AN AGENT IN ANOTHER CHANNEL IS A NAVIGATION, not a filter.
|
|
2270
|
+
*
|
|
2271
|
+
* Filtering in place is right within the channel on screen -- no request,
|
|
2272
|
+
* nothing to drop. It is wrong for a channel you are only peeking into:
|
|
2273
|
+
* there is no traffic loaded to filter, so the log would empty and look
|
|
2274
|
+
* broken. Let the browser follow the link instead; the page comes back on
|
|
2275
|
+
* that channel with that agent selected.
|
|
2276
|
+
*/
|
|
2277
|
+
const belongsTo = link.dataset.channel ?? '';
|
|
2278
|
+
if (belongsTo !== activeRef()) return;
|
|
2279
|
+
|
|
2062
2280
|
event.preventDefault();
|
|
2063
2281
|
filterTo(link.dataset.agent ?? '', true);
|
|
2064
2282
|
});
|
|
@@ -2067,7 +2285,7 @@ const PAGE = `<!doctype html>
|
|
|
2067
2285
|
// the navigations they replaced. No push: this IS the pop.
|
|
2068
2286
|
addEventListener('popstate', () => filterTo(agentFromPath(location.pathname), false));
|
|
2069
2287
|
|
|
2070
|
-
roster();
|
|
2288
|
+
roster(activeRef(), true);
|
|
2071
2289
|
setup();
|
|
2072
2290
|
pending();
|
|
2073
2291
|
setInterval(pending, 2000);
|
|
@@ -2974,6 +3192,12 @@ const server = createServer(async (req, res) => {
|
|
|
2974
3192
|
on.ref = body.channel.ref;
|
|
2975
3193
|
on.name = body.channel.name ?? on.name;
|
|
2976
3194
|
}
|
|
3195
|
+
// Whose channel it is, for the rail's sections. Kept on the channel
|
|
3196
|
+
// rather than looked up again: one poll already answered it.
|
|
3197
|
+
if (body.account?.id) {
|
|
3198
|
+
on.account = body.account.id;
|
|
3199
|
+
on.company = body.account.name ?? on.company;
|
|
3200
|
+
}
|
|
2977
3201
|
channelRef = on.ref ?? channelRef;
|
|
2978
3202
|
|
|
2979
3203
|
const fresh = (body.messages ?? []).map(keepable).filter(Boolean);
|
|
@@ -2989,6 +3213,8 @@ const server = createServer(async (req, res) => {
|
|
|
2989
3213
|
ref: c.ref,
|
|
2990
3214
|
name: c.name ?? c.via,
|
|
2991
3215
|
via: c.via,
|
|
3216
|
+
account: c.account ?? null,
|
|
3217
|
+
company: c.company ?? null,
|
|
2992
3218
|
active: c === on,
|
|
2993
3219
|
}));
|
|
2994
3220
|
// What this call actually cost, so the page can say so rather than
|
|
@@ -3088,12 +3314,16 @@ async function nameChannels() {
|
|
|
3088
3314
|
// already on its way, and it breaks the property that a viewer watching
|
|
3089
3315
|
// one channel makes exactly one call to fetch and one to keep up.
|
|
3090
3316
|
channels.slice(1).map(async (c) => {
|
|
3091
|
-
if (c.name) return;
|
|
3317
|
+
if (c.name && c.account) return;
|
|
3092
3318
|
const body = await upstream(`/v1/messages?limit=1&since=${encodeURIComponent(now)}`, c.key);
|
|
3093
3319
|
if (body?.channel?.name) {
|
|
3094
3320
|
c.name = body.channel.name;
|
|
3095
3321
|
c.ref = body.channel.ref ?? c.ref;
|
|
3096
3322
|
}
|
|
3323
|
+
if (body?.account?.id) {
|
|
3324
|
+
c.account = body.account.id;
|
|
3325
|
+
c.company = body.account.name ?? null;
|
|
3326
|
+
}
|
|
3097
3327
|
}),
|
|
3098
3328
|
);
|
|
3099
3329
|
}
|