@cotal-ai/cli 0.133.12 → 0.133.13

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 (142) hide show
  1. package/dist/chat/static-session.d.ts +1 -1
  2. package/dist/chat/static-session.d.ts.map +1 -1
  3. package/dist/chat/static-session.js +3 -2
  4. package/dist/chat/static-session.js.map +1 -1
  5. package/dist/command.d.ts.map +1 -1
  6. package/dist/command.js +2 -2
  7. package/dist/command.js.map +1 -1
  8. package/dist/commands/agents.d.ts +1 -117
  9. package/dist/commands/agents.d.ts.map +1 -1
  10. package/dist/commands/agents.js +13 -178
  11. package/dist/commands/agents.js.map +1 -1
  12. package/dist/commands/console.js +5 -4
  13. package/dist/commands/console.js.map +1 -1
  14. package/dist/commands/down.d.ts.map +1 -1
  15. package/dist/commands/down.js +8 -7
  16. package/dist/commands/down.js.map +1 -1
  17. package/dist/commands/models.d.ts.map +1 -1
  18. package/dist/commands/models.js +4 -3
  19. package/dist/commands/models.js.map +1 -1
  20. package/dist/commands/persona-remote.js +1 -2
  21. package/dist/commands/persona-remote.js.map +1 -1
  22. package/dist/commands/spawn.d.ts +1 -37
  23. package/dist/commands/spawn.d.ts.map +1 -1
  24. package/dist/commands/spawn.js +24 -43
  25. package/dist/commands/spawn.js.map +1 -1
  26. package/dist/commands/status.d.ts.map +1 -1
  27. package/dist/commands/status.js +4 -3
  28. package/dist/commands/status.js.map +1 -1
  29. package/dist/commands/team-agent-apply.d.ts.map +1 -1
  30. package/dist/commands/team-agent-apply.js +6 -5
  31. package/dist/commands/team-agent-apply.js.map +1 -1
  32. package/dist/commands/team-agent-remove.d.ts.map +1 -1
  33. package/dist/commands/team-agent-remove.js +6 -5
  34. package/dist/commands/team-agent-remove.js.map +1 -1
  35. package/dist/commands/team-deploy-apply.d.ts.map +1 -1
  36. package/dist/commands/team-deploy-apply.js +1 -2
  37. package/dist/commands/team-deploy-apply.js.map +1 -1
  38. package/dist/commands/up.d.ts.map +1 -1
  39. package/dist/commands/up.js +7 -6
  40. package/dist/commands/up.js.map +1 -1
  41. package/dist/commands/update.d.ts.map +1 -1
  42. package/dist/commands/update.js +5 -4
  43. package/dist/commands/update.js.map +1 -1
  44. package/dist/commands/watch.d.ts.map +1 -1
  45. package/dist/commands/watch.js +5 -17
  46. package/dist/commands/watch.js.map +1 -1
  47. package/dist/commands/who.d.ts.map +1 -1
  48. package/dist/commands/who.js +1 -1
  49. package/dist/commands/who.js.map +1 -1
  50. package/dist/console/app.d.ts +1 -1
  51. package/dist/console/app.d.ts.map +1 -1
  52. package/dist/console/app.js +6 -5
  53. package/dist/console/app.js.map +1 -1
  54. package/dist/console/commands.d.ts +2 -3
  55. package/dist/console/commands.d.ts.map +1 -1
  56. package/dist/console/commands.js.map +1 -1
  57. package/dist/console/launch.d.ts +1 -1
  58. package/dist/console/launch.d.ts.map +1 -1
  59. package/dist/console/mesh.d.ts +2 -2
  60. package/dist/console/mesh.d.ts.map +1 -1
  61. package/dist/console/mesh.js +2 -2
  62. package/dist/console/mesh.js.map +1 -1
  63. package/dist/console/root.d.ts +2 -16
  64. package/dist/console/root.d.ts.map +1 -1
  65. package/dist/console/root.js +6 -30
  66. package/dist/console/root.js.map +1 -1
  67. package/dist/console/ui/CommandPalette.d.ts +2 -2
  68. package/dist/console/ui/CommandPalette.d.ts.map +1 -1
  69. package/dist/console/ui/CommandPalette.js.map +1 -1
  70. package/dist/console/ui/Dm.d.ts +1 -1
  71. package/dist/console/ui/Dm.d.ts.map +1 -1
  72. package/dist/console/ui/Tiles.d.ts +1 -1
  73. package/dist/console/ui/Tiles.d.ts.map +1 -1
  74. package/dist/index.d.ts +1 -1
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +1 -1
  77. package/dist/index.js.map +1 -1
  78. package/dist/lib/control.d.ts +5 -280
  79. package/dist/lib/control.d.ts.map +1 -1
  80. package/dist/lib/control.js +24 -782
  81. package/dist/lib/control.js.map +1 -1
  82. package/dist/lib/controller-preserve.d.ts.map +1 -1
  83. package/dist/lib/controller-preserve.js +5 -4
  84. package/dist/lib/controller-preserve.js.map +1 -1
  85. package/dist/lib/endpoint-errors.d.ts +1 -3
  86. package/dist/lib/endpoint-errors.d.ts.map +1 -1
  87. package/dist/lib/endpoint-errors.js +1 -6
  88. package/dist/lib/endpoint-errors.js.map +1 -1
  89. package/dist/lib/endpoint-scatter.d.ts.map +1 -1
  90. package/dist/lib/endpoint-scatter.js +1 -2
  91. package/dist/lib/endpoint-scatter.js.map +1 -1
  92. package/dist/lib/manager-choice.d.ts +2 -31
  93. package/dist/lib/manager-choice.d.ts.map +1 -1
  94. package/dist/lib/manager-choice.js +10 -61
  95. package/dist/lib/manager-choice.js.map +1 -1
  96. package/dist/lib/manifest/live.js +1 -1
  97. package/dist/lib/manifest/live.js.map +1 -1
  98. package/dist/lib/service-census.d.ts +10 -10
  99. package/dist/lib/service-install-intent.d.ts +2 -2
  100. package/dist/lib/service-instances.d.ts +1 -1
  101. package/dist/lib/service-supervision.d.ts +1 -1
  102. package/dist/lib/service-systemd-attempt-read.d.ts +3 -3
  103. package/dist/lib/service-uninstall-intent.d.ts +3 -3
  104. package/dist/lib/space-schema-report.d.ts +5 -5
  105. package/dist/lib/stack-runs.d.ts.map +1 -1
  106. package/dist/lib/stack-runs.js +4 -3
  107. package/dist/lib/stack-runs.js.map +1 -1
  108. package/dist/lib/team-retained.d.ts.map +1 -1
  109. package/dist/lib/team-retained.js +4 -3
  110. package/dist/lib/team-retained.js.map +1 -1
  111. package/dist/lib/teardown-spare.d.ts.map +1 -1
  112. package/dist/lib/teardown-spare.js +4 -3
  113. package/dist/lib/teardown-spare.js.map +1 -1
  114. package/dist/lib/transient.js +1 -1
  115. package/dist/lib/transient.js.map +1 -1
  116. package/dist/render.js +1 -1
  117. package/dist/render.js.map +1 -1
  118. package/dist/ui.d.ts +0 -7
  119. package/dist/ui.d.ts.map +1 -1
  120. package/dist/ui.js +1 -24
  121. package/dist/ui.js.map +1 -1
  122. package/dist/watch-data.d.ts +1 -1
  123. package/dist/watch-data.d.ts.map +1 -1
  124. package/dist/watch-json.js +1 -1
  125. package/dist/watch-json.js.map +1 -1
  126. package/dist/watch-view.d.ts +1 -1
  127. package/dist/watch-view.d.ts.map +1 -1
  128. package/dist/watch-view.js +1 -1
  129. package/dist/watch-view.js.map +1 -1
  130. package/package.json +5 -6
  131. package/dist/console/control.d.ts +0 -141
  132. package/dist/console/control.d.ts.map +0 -1
  133. package/dist/console/control.js +0 -191
  134. package/dist/console/control.js.map +0 -1
  135. package/dist/lib/dial-retry.d.ts +0 -33
  136. package/dist/lib/dial-retry.d.ts.map +0 -1
  137. package/dist/lib/dial-retry.js +0 -70
  138. package/dist/lib/dial-retry.js.map +0 -1
  139. package/dist/view/mesh-view.d.ts +0 -213
  140. package/dist/view/mesh-view.d.ts.map +0 -1
  141. package/dist/view/mesh-view.js +0 -527
  142. package/dist/view/mesh-view.js.map +0 -1
@@ -1,527 +0,0 @@
1
- // See docs/mesh-view.mdx.
2
- import { EventEmitter } from "node:events";
3
- import { deliveryOf, chatWildcard, isEventChannel, partsToText } from "@cotal-ai/core";
4
- // ---- internals -------------------------------------------------------------
5
- const STATUS_ORDER = { working: 0, waiting: 1, idle: 2, offline: 3 };
6
- const BURST_MS = 400; // unicast burst-coalescing window
7
- const TICK_MS = 75; // batch every source into one "change"
8
- const CHANNELS_MS = 2000; // listChannels() refresh
9
- const DEFAULT_WINDOW = 300;
10
- const HISTORY_LIMIT = 50; // per-channel prefill depth
11
- const DM_LOG_CAP = 1000; // raw DMs retained for the roll-up
12
- const MEMBERSHIP_DEBOUNCE_MS = 150; // coalesce the watch's replay burst into one re-read (the web's 150 ms)
13
- const BUCKET_MS = 4000; // activity series bucket width
14
- const BUCKET_COUNT = 15; // activity series length → 15×4s = 60s window
15
- function bodyText(msg) {
16
- return partsToText(msg.parts);
17
- }
18
- /** Does this error say the membership feed's bucket does not exist (no delivery daemon ever
19
- * provisioned it)? The JetStream "stream not found" answer, by API code and by message; anything
20
- * else (a permission refusal, a timeout, a closed connection) is a failed read, not an absent feed. */
21
- function feedAbsent(e) {
22
- const err = e;
23
- if (err?.api_error?.err_code === 10059)
24
- return true;
25
- if (err?.code === 404 || err?.code === "404")
26
- return true;
27
- return /stream not found/i.test(err?.message ?? "");
28
- }
29
- function sortRoster(r) {
30
- // getRoster()/the "roster" event sort by name only — re-apply the status order here.
31
- return [...r].sort((a, b) => (STATUS_ORDER[a.status] ?? 9) - (STATUS_ORDER[b.status] ?? 9) ||
32
- a.card.name.localeCompare(b.card.name));
33
- }
34
- /**
35
- * Events:
36
- * - `"entry"` `(e: FeedEntry)` — one live feed row, as it lands (for the stream renderer).
37
- * - `"presence"` `(ev: PresenceEvent)` — forwarded presence change (join/update/offline).
38
- * - `"warning"` `(e: Error)` — a recoverable endpoint notice for the stream renderer.
39
- * - `"change"` `(s: MeshSnapshot)` — a batched snapshot every ~75ms (for dashboards).
40
- */
41
- export class MeshView extends EventEmitter {
42
- ep;
43
- roster = [];
44
- byId = new Map();
45
- channelCounts = new Map();
46
- arrivals = new Map();
47
- feed = [];
48
- seen = new Set(); // feed ids, for prefill ∪ live dedupe-by-id
49
- pending = new Map();
50
- dmLog = []; // raw unicast for the DM roll-up
51
- recentTs = []; // tap arrivals in the last 1s → msgs/s
52
- msgsPerSec = 0;
53
- bucketCounts = new Array(BUCKET_COUNT).fill(0); // 60s volume series, oldest→newest
54
- bucketEpoch = 0; // floor(now/BUCKET_MS) of the newest (last) bucket; 0 = uninitialized
55
- connected = false;
56
- error;
57
- presenceCurrent = true;
58
- errorWhilePresenceStale = false;
59
- warning;
60
- dirty = true;
61
- membership = {};
62
- membershipWatch;
63
- membershipTimer;
64
- window;
65
- tapSubject;
66
- chatOnly;
67
- timers = [];
68
- onRoster = (r) => this.setRoster(r);
69
- onPresence = (ev) => this.emit("presence", ev);
70
- onError = (e) => {
71
- this.error = e.message;
72
- this.errorWhilePresenceStale = !this.presenceCurrent;
73
- this.dirty = true;
74
- };
75
- /** A broker restart reconnects the transport without a new `connection`, and its errors (the
76
- * presence stream missing until the space is provisioned again) arrive while the presence view
77
- * is stale. When that view is current again the outage is over, so its error clears with it
78
- * (AGENT-2889). An error raised while the view was current stays until the next connection. */
79
- onPresenceView = (v) => {
80
- const current = v.state === "current";
81
- if (current && !this.presenceCurrent && this.errorWhilePresenceStale)
82
- this.error = undefined;
83
- this.presenceCurrent = current;
84
- this.dirty = true;
85
- };
86
- /** A rebuilt connection clears the fault that dropped the old one, so the view reports itself
87
- * connected again instead of keeping that error for good. */
88
- onConnection = (s) => {
89
- this.connected = s.connected;
90
- if (s.connected)
91
- this.error = undefined;
92
- this.dirty = true;
93
- };
94
- onWarning = (e) => {
95
- this.warning = e.message;
96
- this.dirty = true;
97
- this.emit("warning", e);
98
- };
99
- constructor(ep, opts = {}) {
100
- super();
101
- this.ep = ep;
102
- this.window = opts.window ?? DEFAULT_WINDOW;
103
- this.tapSubject = opts.tapSubject;
104
- // DMs are hidden only when the tap is narrowed to the chat subtree.
105
- this.chatOnly = opts.tapSubject === chatWildcard(ep.space);
106
- }
107
- async start() {
108
- // The error listener MUST be attached before start() — async faults surface as events.
109
- this.ep.on("error", this.onError);
110
- this.ep.on("warning", this.onWarning);
111
- this.ep.on("connection", this.onConnection);
112
- this.ep.on("roster", this.onRoster);
113
- this.ep.on("presence", this.onPresence);
114
- this.ep.on("presence-view", this.onPresenceView);
115
- await this.ep.start();
116
- this.connected = true;
117
- this.setRoster(this.ep.getRoster());
118
- this.ep.tap((subject, msg) => {
119
- if (msg)
120
- this.ingest(subject, msg);
121
- }, this.tapSubject ? { subject: this.tapSubject } : undefined);
122
- void this.prefill();
123
- void this.refreshChannels();
124
- void this.startMembership();
125
- this.timers.push(setInterval(() => this.flush(), TICK_MS));
126
- this.timers.push(setInterval(() => void this.refreshChannels(), CHANNELS_MS));
127
- this.timers.push(setInterval(() => (this.dirty = true), 1000)); // refresh ages + decay rate
128
- }
129
- async stop() {
130
- for (const t of this.timers)
131
- clearInterval(t);
132
- this.timers = [];
133
- for (const b of this.pending.values())
134
- clearTimeout(b.timer); // bursts hold live timers
135
- this.pending.clear();
136
- this.ep.off("error", this.onError);
137
- this.ep.off("warning", this.onWarning);
138
- this.ep.off("connection", this.onConnection);
139
- this.ep.off("roster", this.onRoster);
140
- this.ep.off("presence", this.onPresence);
141
- this.ep.off("presence-view", this.onPresenceView);
142
- clearTimeout(this.membershipTimer);
143
- // The endpoint's stop deletes the watch's consumer over a live connection, and it is what settles
144
- // the watch's own stop once the connection is closed for good, so it must not wait behind it.
145
- const membership = this.membershipWatch?.stop().catch(() => undefined);
146
- await this.ep.stop();
147
- await membership;
148
- }
149
- /** Read the broker-authoritative membership feed and follow it. A membership fault is never
150
- * a connection fault: it lands on `membership.unreadable` (with its reason), not on
151
- * `status.error`, because the mesh is fine and only this viewer's read of one feed is not. */
152
- async startMembership() {
153
- await this.loadMembership();
154
- try {
155
- this.membershipWatch = await this.ep.watchMembership((change) => this.onMembershipChange(change), (e) => { this.membership = { ...this.membership, unreadable: `watch: ${e.message}` }; this.dirty = true; });
156
- }
157
- catch (e) {
158
- // A feed that does not exist cannot be watched, and that is the traffic-only fact the read
159
- // above already recorded; any other failure is this viewer's, named as such.
160
- if (!feedAbsent(e))
161
- this.membership = { ...this.membership, unreadable: `watch: ${e.message}` };
162
- this.dirty = true;
163
- }
164
- }
165
- /** A heartbeat moves only `asOf`, so it is copied into the last snapshot instead of costing a
166
- * bucket re-read (#4904); a member change is read back in full, and a heartbeat that arrives
167
- * while the last read failed is the retry. */
168
- onMembershipChange(change) {
169
- if (change.type === "replayed")
170
- return;
171
- if (change.type === "heartbeat" && change.update && this.membership.snapshot && this.membership.unreadable === undefined) {
172
- this.membership = { snapshot: { ...this.membership.snapshot, asOf: change.asOf } };
173
- this.dirty = true;
174
- return;
175
- }
176
- this.scheduleMembership();
177
- }
178
- scheduleMembership() {
179
- clearTimeout(this.membershipTimer);
180
- this.membershipTimer = setTimeout(() => void this.loadMembership(), MEMBERSHIP_DEBOUNCE_MS);
181
- }
182
- /** One read of the feed. Three outcomes, kept distinct: a snapshot (readable, whatever it holds),
183
- * an absent feed (readable in the sense that the mesh has no daemon writing one: an empty
184
- * snapshot, traffic-only), and a failed read (`unreadable`, reason kept, last snapshot kept so
185
- * the reason is shown against what was last known rather than against nothing). */
186
- async loadMembership() {
187
- try {
188
- this.membership = { snapshot: await this.ep.readMembership() };
189
- }
190
- catch (e) {
191
- this.membership = feedAbsent(e)
192
- ? { snapshot: { asOf: undefined, members: [] } }
193
- : { ...this.membership, unreadable: e.message };
194
- }
195
- this.dirty = true;
196
- }
197
- snapshot() {
198
- const channels = [...this.channelCounts]
199
- .map(([channel, messages]) => ({ channel, messages, arrivals: this.arrivals.get(channel) ?? 0 }))
200
- .sort((a, b) => a.channel.localeCompare(b.channel));
201
- return {
202
- agents: this.roster.filter((p) => p.card.kind === "agent"),
203
- endpoints: this.roster.filter((p) => p.card.kind !== "agent"),
204
- channels,
205
- feed: this.feed.slice(),
206
- membership: { ...this.membership },
207
- rates: { msgsPerSec: this.msgsPerSec, activity: this.bucketCounts.slice() },
208
- status: {
209
- connected: this.connected,
210
- space: this.ep.space,
211
- dmVisible: !this.chatOnly,
212
- error: this.error,
213
- warning: this.warning,
214
- },
215
- signals: this.signals(),
216
- nameOf: this.nameOf,
217
- };
218
- }
219
- // Stable identity across snapshots; reads the live byId map.
220
- nameOf = (id) => this.byId.get(id) ?? id.slice(0, 8);
221
- // ---- sources -------------------------------------------------------------
222
- setRoster(r) {
223
- this.roster = sortRoster(r);
224
- for (const p of r)
225
- this.byId.set(p.card.id, p.card.name);
226
- this.dirty = true;
227
- }
228
- /** Live read-only tap. Drops control/presence/trace frames (deliveryOf → null). A payload
229
- * from.name is sender-chosen display text, not identity (#1399): the roster is the only writer
230
- * of id→name, so a spoofed name can never re-key a thread or a label. */
231
- ingest(subject, msg) {
232
- const kind = deliveryOf(subject);
233
- if (!kind)
234
- return;
235
- const now = Date.now();
236
- this.recentTs.push(now);
237
- this.roll(now);
238
- this.bucketCounts[BUCKET_COUNT - 1]++;
239
- if (kind === "unicast")
240
- return this.coalesce(msg);
241
- this.push({
242
- id: msg.id,
243
- ts: msg.ts,
244
- from: msg.from,
245
- delivery: kind === "anycast" ? "anycast" : "multicast", // "chat" → multicast
246
- channel: kind === "anycast" ? undefined : msg.channel,
247
- toService: kind === "anycast" ? msg.toService : undefined,
248
- // MARKED, NEVER DROPPED. The channel-list filter below keeps event channels out of the tab
249
- // strip and out of the history prefill, for a cost reason; the live feed is a different
250
- // question and the answer here is different on purpose. Dropping an event row would delete
251
- // the only traffic this release just taught the console to draw, and it would delete it
252
- // silently, which is the failure mode this whole lane exists to remove. A surface that wants
253
- // a chat-only feed can filter on this flag and say so in its own UI.
254
- events: kind === "anycast" ? undefined : isEventChannel(msg.channel) || undefined,
255
- text: bodyText(msg),
256
- });
257
- }
258
- /** Group a same-sender/same-text unicast burst into one feed entry over BURST_MS, and retain
259
- * each raw message for the DM roll-up. */
260
- coalesce(msg) {
261
- const body = bodyText(msg);
262
- if (msg.to)
263
- this.recordDm({ ts: msg.ts, from: msg.from, toId: msg.to, text: body });
264
- const key = msg.from.id + " " + body;
265
- let b = this.pending.get(key);
266
- if (!b) {
267
- b = {
268
- from: msg.from,
269
- body,
270
- id: msg.id,
271
- ts: msg.ts,
272
- ids: [],
273
- timer: setTimeout(() => this.flushBurst(key), BURST_MS),
274
- };
275
- this.pending.set(key, b);
276
- }
277
- b.ts = Math.min(b.ts, msg.ts); // earliest in the burst → deterministic order
278
- if (msg.to)
279
- b.ids.push(msg.to);
280
- }
281
- flushBurst(key) {
282
- const b = this.pending.get(key);
283
- if (!b)
284
- return;
285
- this.pending.delete(key);
286
- this.push({
287
- id: b.id,
288
- ts: b.ts,
289
- from: b.from,
290
- delivery: "unicast",
291
- toIds: [...b.ids],
292
- toNames: b.ids.map((id) => this.nameOf(id)),
293
- count: b.ids.length,
294
- text: b.body,
295
- });
296
- }
297
- /** Append to the feed, dedupe by id, keep it windowed, and notify stream consumers. */
298
- push(e) {
299
- if (this.seen.has(e.id))
300
- return;
301
- this.seen.add(e.id);
302
- this.feed.push(e);
303
- this.trim();
304
- // Surface a brand-new channel as a tab now, not at the next poll. The third filter site, and it
305
- // is not redundant: this one runs on live arrival, so without it an event channel would appear
306
- // as a tab the moment a frame landed and then vanish at the next `refreshChannels`, which reads
307
- // as a flickering bug rather than as a filter.
308
- if (e.delivery === "multicast" && e.channel && !e.events) {
309
- if (!this.channelCounts.has(e.channel))
310
- this.channelCounts.set(e.channel, 1);
311
- // Counted on ARRIVAL, not read back from the broker: the retained count is capped per sender
312
- // and stops climbing under live traffic, so a badge derived from it goes quiet at the cap.
313
- this.arrivals.set(e.channel, (this.arrivals.get(e.channel) ?? 0) + 1);
314
- }
315
- this.dirty = true;
316
- this.emit("entry", e);
317
- }
318
- trim() {
319
- if (this.feed.length <= this.window)
320
- return;
321
- for (const d of this.feed.splice(0, this.feed.length - this.window))
322
- this.seen.delete(d.id);
323
- }
324
- recordDm(d) {
325
- this.dmLog.push(d);
326
- if (this.dmLog.length > DM_LOG_CAP)
327
- this.dmLog.splice(0, this.dmLog.length - DM_LOG_CAP);
328
- }
329
- /** One-shot backlog: prefill each channel's history (multicast), plus the DM backlog when DMs
330
- * are visible (god-view — `dmHistory` needs an admin cred), deduped by id, oldest-first. */
331
- async prefill() {
332
- let chans;
333
- try {
334
- chans = await this.ep.listChannels();
335
- }
336
- catch {
337
- return;
338
- }
339
- // THE FILTER RUNS BEFORE THE HISTORY READ, AND THE ORDER IS THE WHOLE POINT.
340
- //
341
- // `listChannels()` derives an entry from every RETAINED CONCRETE SUBJECT, and the chat stream
342
- // caps per subject rather than by age or count, so a session's last frames are retained
343
- // indefinitely and this list grows by one row per agent that has ever run. Filtering after the
344
- // fetch would enumerate every one of them, issue a `channelHistory` round trip each, and then
345
- // throw the results away: unbounded work to display nothing. That is a performance defect
346
- // rather than a cosmetic one, which is why it is filtered here and not in the loop below.
347
- const chat = chans.filter((c) => !isEventChannel(c.channel));
348
- const batches = await Promise.all(chat.map((c) => this.ep.channelHistory(c.channel, { limit: HISTORY_LIMIT }).catch(() => [])));
349
- const history = [];
350
- for (const msgs of batches)
351
- for (const msg of msgs) {
352
- if (!msg.channel || this.seen.has(msg.id))
353
- continue;
354
- this.seen.add(msg.id);
355
- history.push({
356
- id: msg.id,
357
- ts: msg.ts,
358
- from: msg.from,
359
- delivery: "multicast",
360
- channel: msg.channel,
361
- text: bodyText(msg),
362
- });
363
- }
364
- if (history.length) {
365
- this.feed = [...history, ...this.feed].sort((a, b) => a.ts - b.ts);
366
- this.trim();
367
- this.dirty = true;
368
- }
369
- if (!this.chatOnly)
370
- await this.prefillDms();
371
- }
372
- /** Best-effort DM backlog for the roll-up — only meaningful for a god-view cred; a non-admin
373
- * observer's `dmHistory` throws (ACL), which just leaves the DM lens live-only. A history
374
- * row's from.name is payload text, never an id→name source (#1399). */
375
- async prefillDms() {
376
- let msgs;
377
- try {
378
- msgs = await this.ep.dmHistory({ limit: DM_LOG_CAP });
379
- }
380
- catch {
381
- return;
382
- }
383
- // Merge backlog into the live dmLog, deduped by sender+recipient+ts (a live tap may already
384
- // have collected backlog-adjacent messages), then keep it ordered and capped.
385
- const key = (d) => d.from.id + ">" + d.toId + "@" + d.ts;
386
- const have = new Set(this.dmLog.map(key));
387
- for (const m of msgs) {
388
- if (!m.to)
389
- continue;
390
- const d = { ts: m.ts, from: m.from, toId: m.to, text: bodyText(m) };
391
- if (have.has(key(d)))
392
- continue;
393
- have.add(key(d));
394
- this.dmLog.push(d);
395
- }
396
- this.dmLog.sort((a, b) => a.ts - b.ts);
397
- if (this.dmLog.length > DM_LOG_CAP)
398
- this.dmLog.splice(0, this.dmLog.length - DM_LOG_CAP);
399
- this.dirty = true;
400
- }
401
- async refreshChannels() {
402
- let chans;
403
- try {
404
- chans = await this.ep.listChannels();
405
- }
406
- catch {
407
- return;
408
- }
409
- // Event channels are not chat tabs: one per agent that has ever run would bury the handful of
410
- // channels a human actually talks on. Same classifier as the prefill, so the tab strip and the
411
- // backlog cannot disagree about what a channel is. The map is REBUILT, not merged: a channel
412
- // the broker no longer lists (deleted, its history purged and its registry entry gone) leaves
413
- // the strip on this poll instead of lingering with its last count.
414
- const next = new Map();
415
- for (const { channel, messages } of chans)
416
- if (!isEventChannel(channel))
417
- next.set(channel, messages);
418
- this.channelCounts = next;
419
- for (const channel of this.arrivals.keys())
420
- if (!next.has(channel))
421
- this.arrivals.delete(channel);
422
- this.dirty = true;
423
- }
424
- // ---- derived signals -----------------------------------------------------
425
- signals() {
426
- const agents = this.roster.filter((p) => p.card.kind === "agent");
427
- const counts = { working: 0, waiting: 0, idle: 0, offline: 0 };
428
- for (const p of agents)
429
- if (p.status in counts)
430
- counts[p.status]++;
431
- // Name-ordered, deliberately not by `ts`: that is the last heartbeat, so sorting by it and
432
- // presenting the result as a priority queue would imply an age we cannot compute.
433
- const waiting = agents
434
- .filter((p) => p.status === "waiting")
435
- .sort((a, b) => a.card.name.localeCompare(b.card.name) || a.card.id.localeCompare(b.card.id));
436
- const live = agents.filter((p) => p.status !== "offline");
437
- return {
438
- counts,
439
- waiting,
440
- stalestLiveTs: live.length ? Math.min(...live.map((p) => p.ts)) : undefined,
441
- dms: this.rollupDms(),
442
- };
443
- }
444
- /** Group raw DMs into per-peer rows; each peer lists its counterparties (conversations).
445
- * Only pairs that actually talked — never the n² cross-product. Conversations key on the two
446
- * AUTHENTICATED ids; display names, roles and statuses resolve through the roster by id, so a
447
- * payload `from.name` cannot move a line into another peer's thread (#1399). */
448
- rollupDms() {
449
- const statusOf = (id) => this.roster.find((p) => p.card.id === id)?.status ?? "offline";
450
- const roleOf = (id) => this.roster.find((p) => p.card.id === id)?.card.role;
451
- const conv = new Map();
452
- for (const d of this.dmLog) {
453
- const a = d.from.id;
454
- const b = d.toId;
455
- if (!a || !b || a === b)
456
- continue;
457
- const parts = [a, b].sort();
458
- const k = parts.join("\u0000");
459
- let c = conv.get(k);
460
- if (!c)
461
- conv.set(k, (c = { parts, msgs: [], last: 0 }));
462
- c.msgs.push({ ts: d.ts, from: this.nameOf(a), to: this.nameOf(b), text: d.text });
463
- c.last = Math.max(c.last, d.ts);
464
- }
465
- const peers = new Map();
466
- for (const c of conv.values()) {
467
- c.msgs.sort((x, y) => x.ts - y.ts);
468
- for (const id of c.parts) {
469
- const other = c.parts[0] === id ? c.parts[1] : c.parts[0];
470
- const name = this.nameOf(id);
471
- let pe = peers.get(id);
472
- if (!pe)
473
- peers.set(id, (pe = { name, role: roleOf(id), status: statusOf(id), lastTs: 0, conversations: [] }));
474
- pe.conversations.push({
475
- with: this.nameOf(other),
476
- role: roleOf(other),
477
- status: statusOf(other),
478
- lastTs: c.last,
479
- messages: c.msgs,
480
- });
481
- pe.lastTs = Math.max(pe.lastTs, c.last);
482
- }
483
- }
484
- for (const pe of peers.values())
485
- pe.conversations.sort((a, b) => b.lastTs - a.lastTs);
486
- return [...peers.values()].sort((a, b) => b.lastTs - a.lastTs);
487
- }
488
- /** Advance the activity ring to `now`: shift past buckets out the left, fill the gap with zeros,
489
- * so idle time decays the series. The newest (last) bucket is always the current ~4s window. */
490
- roll(now) {
491
- const epoch = Math.floor(now / BUCKET_MS);
492
- if (this.bucketEpoch === 0) {
493
- this.bucketEpoch = epoch;
494
- return;
495
- }
496
- const advance = epoch - this.bucketEpoch;
497
- if (advance <= 0)
498
- return;
499
- if (advance >= BUCKET_COUNT) {
500
- this.bucketCounts.fill(0);
501
- }
502
- else {
503
- this.bucketCounts.splice(0, advance);
504
- while (this.bucketCounts.length < BUCKET_COUNT)
505
- this.bucketCounts.push(0);
506
- }
507
- this.bucketEpoch = epoch;
508
- this.dirty = true;
509
- }
510
- /** The single batch point: recompute the rolling rate, then emit one snapshot if dirty. */
511
- flush() {
512
- const now = Date.now();
513
- const cutoff = now - 1000;
514
- while (this.recentTs.length && this.recentTs[0] < cutoff)
515
- this.recentTs.shift();
516
- this.roll(now); // decay the activity window even when no message arrived
517
- if (this.recentTs.length !== this.msgsPerSec) {
518
- this.msgsPerSec = this.recentTs.length;
519
- this.dirty = true;
520
- }
521
- if (!this.dirty)
522
- return;
523
- this.dirty = false;
524
- this.emit("change", this.snapshot());
525
- }
526
- }
527
- //# sourceMappingURL=mesh-view.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mesh-view.js","sourceRoot":"","sources":["../../src/view/mesh-view.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAiHvF,+EAA+E;AAE/E,MAAM,YAAY,GAA2B,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AAC7F,MAAM,QAAQ,GAAG,GAAG,CAAC,CAAC,kCAAkC;AACxD,MAAM,OAAO,GAAG,EAAE,CAAC,CAAC,uCAAuC;AAC3D,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,yBAAyB;AACnD,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,aAAa,GAAG,EAAE,CAAC,CAAC,4BAA4B;AACtD,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,mCAAmC;AAC5D,MAAM,sBAAsB,GAAG,GAAG,CAAC,CAAC,wEAAwE;AAC5G,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,+BAA+B;AACvD,MAAM,YAAY,GAAG,EAAE,CAAC,CAAC,8CAA8C;AAEvE,SAAS,QAAQ,CAAC,GAAiB;IACjC,OAAO,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAED;;wGAEwG;AACxG,SAAS,UAAU,CAAC,CAAU;IAC5B,MAAM,GAAG,GAAG,CAA2F,CAAC;IACxG,IAAI,GAAG,EAAE,SAAS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