@agentshouse/mdruntime 0.1.0-caf080a9a9c60 → 0.1.0-cb0700ba4630b
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/README.md +18 -16
- package/dist/acceptance.d.ts.map +1 -1
- package/dist/acceptance.js +2 -21
- package/dist/act-lanes.d.ts +1 -0
- package/dist/act-lanes.d.ts.map +1 -1
- package/dist/act-lanes.js +53 -5
- package/dist/actions.d.ts +1 -0
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +102 -50
- package/dist/adapter.d.ts +85 -14
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +0 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +0 -5
- package/dist/authored.d.ts +88 -0
- package/dist/authored.d.ts.map +1 -0
- package/dist/authored.js +345 -0
- package/dist/change.d.ts +4 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +3 -0
- package/dist/chat-types.d.ts +0 -2
- package/dist/chat-types.d.ts.map +1 -1
- package/dist/chat-types.js +0 -2
- package/dist/client.d.ts +14 -11
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +18 -46
- package/dist/collection.d.ts +5 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +16 -8
- package/dist/column.d.ts +5 -0
- package/dist/column.d.ts.map +1 -0
- package/dist/column.js +9 -0
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +2 -3
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +11 -12
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/conversation-live.d.ts +18 -6
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +16 -6
- package/dist/conversation-row.d.ts +8 -1
- package/dist/conversation-row.d.ts.map +1 -1
- package/dist/conversation-row.js +20 -7
- package/dist/conversation.d.ts +19 -7
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +226 -163
- package/dist/discovery.d.ts +2 -0
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +15 -6
- package/dist/download.d.ts +6 -0
- package/dist/download.d.ts.map +1 -0
- package/dist/download.js +42 -0
- package/dist/durability.d.ts +2 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +7 -0
- package/dist/entry.d.ts +5 -0
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +22 -11
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +3 -1
- package/dist/figures.d.ts.map +1 -1
- package/dist/figures.js +4 -2
- package/dist/file.d.ts +1 -1
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +3 -2
- package/dist/host.d.ts +3 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +32 -10
- package/dist/house-query.d.ts +21 -0
- package/dist/house-query.d.ts.map +1 -0
- package/dist/house-query.js +41 -0
- package/dist/index.d.ts +11 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/install.d.ts +9 -3
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +44 -46
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +26 -18
- package/dist/listing.d.ts +24 -12
- package/dist/listing.d.ts.map +1 -1
- package/dist/listing.js +50 -21
- package/dist/live.d.ts +5 -3
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +71 -30
- package/dist/loaded.d.ts +5 -0
- package/dist/loaded.d.ts.map +1 -0
- package/dist/loaded.js +40 -0
- package/dist/locks.d.ts.map +1 -1
- package/dist/locks.js +2 -3
- package/dist/lost.d.ts.map +1 -1
- package/dist/lost.js +2 -3
- package/dist/media.d.ts +18 -1
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +102 -24
- package/dist/memory.d.ts +5 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +55 -15
- package/dist/messages.d.ts +12 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +24 -10
- package/dist/modal.d.ts +2 -0
- package/dist/modal.d.ts.map +1 -0
- package/dist/modal.js +11 -0
- package/dist/model.d.ts +4 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +7 -1
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +5 -8
- package/dist/observation.d.ts +29 -12
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +206 -69
- package/dist/online.d.ts +7 -0
- package/dist/online.d.ts.map +1 -0
- package/dist/online.js +29 -0
- package/dist/opening.d.ts.map +1 -1
- package/dist/opening.js +4 -9
- package/dist/outcome.d.ts +10 -1
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +17 -2
- package/dist/overlay.d.ts +1 -1
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +3 -5
- package/dist/parts.d.ts +3 -0
- package/dist/parts.d.ts.map +1 -1
- package/dist/parts.js +31 -5
- package/dist/preparation.d.ts +27 -6
- package/dist/preparation.d.ts.map +1 -1
- package/dist/preparation.js +137 -56
- package/dist/presence.d.ts +8 -2
- package/dist/presence.d.ts.map +1 -1
- package/dist/presence.js +24 -13
- package/dist/queries.d.ts +1 -1
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +63 -61
- package/dist/questions.d.ts +1 -0
- package/dist/questions.d.ts.map +1 -1
- package/dist/questions.js +1 -0
- package/dist/queue.d.ts +1 -1
- package/dist/queue.d.ts.map +1 -1
- package/dist/queue.js +54 -39
- package/dist/reach.d.ts +14 -6
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +140 -29
- package/dist/react.d.ts +6 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/readiness.d.ts +9 -3
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +3 -5
- package/dist/reads.d.ts +1 -1
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +2 -2
- package/dist/recovery.d.ts +1 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +2 -1
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +1 -3
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +2 -2
- package/dist/room-draft.d.ts +28 -3
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +230 -12
- package/dist/room-drafts.d.ts.map +1 -1
- package/dist/room-drafts.js +5 -2
- package/dist/room-list.d.ts +10 -0
- package/dist/room-list.d.ts.map +1 -0
- package/dist/room-list.js +45 -0
- package/dist/rows.d.ts +2 -1
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +6 -6
- package/dist/running.d.ts +5 -0
- package/dist/running.d.ts.map +1 -0
- package/dist/running.js +10 -0
- package/dist/runtime.d.ts +1 -2
- package/dist/runtime.d.ts.map +1 -1
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +17 -86
- package/dist/saves.d.ts +2 -0
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +42 -18
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +2 -2
- package/dist/shown.d.ts +5 -2
- package/dist/shown.d.ts.map +1 -1
- package/dist/shown.js +62 -39
- package/dist/socket/lanes.d.ts +10 -3
- package/dist/socket/lanes.d.ts.map +1 -1
- package/dist/socket/lanes.js +29 -6
- package/dist/socket/session.d.ts +2 -1
- package/dist/socket/session.d.ts.map +1 -1
- package/dist/socket/session.js +1 -0
- package/dist/socket.d.ts +3 -3
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +3 -9
- package/dist/source.d.ts +5 -0
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +13 -2
- package/dist/store/installs.d.ts +2 -2
- package/dist/store/installs.d.ts.map +1 -1
- package/dist/store/installs.js +10 -4
- package/dist/store/readiness.d.ts +5 -4
- package/dist/store/readiness.d.ts.map +1 -1
- package/dist/store/readiness.js +28 -12
- package/dist/store/records.d.ts +19 -5
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +60 -22
- package/dist/store/rooms-shown.d.ts +8 -0
- package/dist/store/rooms-shown.d.ts.map +1 -0
- package/dist/store/rooms-shown.js +13 -0
- package/dist/store.d.ts +14 -9
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +9 -4
- package/dist/stored.d.ts +24 -13
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +78 -27
- package/dist/surface.d.ts +12 -6
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +57 -25
- package/dist/sync.d.ts +3 -2
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +27 -18
- package/dist/tables.d.ts +16 -52
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +86 -324
- package/dist/tallies.d.ts.map +1 -1
- package/dist/tallies.js +1 -2
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +3 -9
- package/dist/wire.d.ts +33 -10
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +15 -8
- package/package.json +3 -3
- package/dist/log.d.ts +0 -6
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -14
package/dist/conversation.js
CHANGED
|
@@ -6,7 +6,7 @@ import { heldFacts } from './conversation-row.js';
|
|
|
6
6
|
import { runtimeError, uncaught } from './failure.js';
|
|
7
7
|
import { refusedForSpace } from './durability.js';
|
|
8
8
|
import { changeBatchIdentity, chatDraftRevision } from './identity.js';
|
|
9
|
-
import { OFFLINE } from './outcome.js';
|
|
9
|
+
import { OFFLINE, } from './outcome.js';
|
|
10
10
|
import { runningLine } from './parts.js';
|
|
11
11
|
import { record, text } from './read.js';
|
|
12
12
|
import { openQuestion, questionAsked } from './questions.js';
|
|
@@ -29,12 +29,13 @@ export function unheldView(conversation) {
|
|
|
29
29
|
deliveryWaiting: [],
|
|
30
30
|
deliveryUnknown: [],
|
|
31
31
|
chatDraft: null,
|
|
32
|
+
dismissedSuggestion: null,
|
|
33
|
+
pins: [],
|
|
32
34
|
};
|
|
33
35
|
}
|
|
34
36
|
export const SESSION_STARTED = 'Session started';
|
|
35
37
|
const NEW_CHAT = 'new:';
|
|
36
38
|
const LISTING = 'listing';
|
|
37
|
-
const AGENTS = 'agents';
|
|
38
39
|
export const CATCHING_UP = 'catching-up';
|
|
39
40
|
export const HISTORY_CONVERSATIONS = 64;
|
|
40
41
|
export function newChat(agent) {
|
|
@@ -198,17 +199,17 @@ function withSubmitted(draft, submitted) {
|
|
|
198
199
|
const { submitted: _held, ...unsent } = draft;
|
|
199
200
|
return submitted.length === 0 ? unsent : { ...unsent, submitted };
|
|
200
201
|
}
|
|
201
|
-
function
|
|
202
|
-
return
|
|
202
|
+
export function joinedDraft(first, second) {
|
|
203
|
+
return [first, second].filter((one) => one !== '').join('\n');
|
|
203
204
|
}
|
|
204
205
|
function returned(draft, submission, others) {
|
|
205
206
|
return withSubmitted({
|
|
206
207
|
conversation: draft.conversation,
|
|
207
|
-
|
|
208
|
+
text: joinedDraft(submission.text, draft.text),
|
|
208
209
|
revision: chatDraftRevision(),
|
|
209
210
|
}, others);
|
|
210
211
|
}
|
|
211
|
-
function viewOf(alive, conversation, held, frame, draft, ended) {
|
|
212
|
+
function viewOf(alive, conversation, held, frame, { draft, ended, dismissed, pins }) {
|
|
212
213
|
const facts = alive.liveOf(conversation);
|
|
213
214
|
return {
|
|
214
215
|
conversation,
|
|
@@ -231,6 +232,8 @@ function viewOf(alive, conversation, held, frame, draft, ended) {
|
|
|
231
232
|
deliveryWaiting: [...facts.deliveryWaiting],
|
|
232
233
|
deliveryUnknown: [...facts.deliveryUnknown],
|
|
233
234
|
chatDraft: draft === null || unwritten(draft) ? null : { text: draft.text, revision: draft.revision },
|
|
235
|
+
dismissedSuggestion: dismissed,
|
|
236
|
+
pins: [...pins],
|
|
234
237
|
};
|
|
235
238
|
}
|
|
236
239
|
function sessionOf(facts, held, ended) {
|
|
@@ -250,13 +253,15 @@ function emit(alive, conversation) {
|
|
|
250
253
|
if (alive.deps.closed())
|
|
251
254
|
return;
|
|
252
255
|
for (const view of alive.views()) {
|
|
253
|
-
const
|
|
256
|
+
const held = view.held.now();
|
|
257
|
+
const { window } = held;
|
|
254
258
|
if (view.conversation !== conversation || window === null)
|
|
255
259
|
continue;
|
|
256
260
|
const ready = view.ready();
|
|
257
261
|
if (ready.length === 0)
|
|
258
262
|
continue;
|
|
259
|
-
const
|
|
263
|
+
const frame = sharedFrame(view, window);
|
|
264
|
+
const value = viewOf(alive, conversation, window, frame, held);
|
|
260
265
|
for (const watcher of ready)
|
|
261
266
|
watcher.notify(value);
|
|
262
267
|
}
|
|
@@ -302,66 +307,92 @@ function rowOf(alive, conversation) {
|
|
|
302
307
|
};
|
|
303
308
|
}
|
|
304
309
|
async function entries(alive) {
|
|
305
|
-
const
|
|
306
|
-
if (
|
|
310
|
+
const listing = await heldListing(alive);
|
|
311
|
+
if (listing === null)
|
|
312
|
+
return null;
|
|
313
|
+
const list = listing.conversations;
|
|
314
|
+
const agents = new Map(listing.agents.map((agent) => [agent.id, agent]));
|
|
315
|
+
if (list.some((entry) => !agents.has(entry.agent)))
|
|
307
316
|
return null;
|
|
308
317
|
const held = list.length === 0
|
|
309
318
|
? []
|
|
310
319
|
: await alive.deps.durably((local) => local.conversationRows(list.map(({ conversation }) => conversation)));
|
|
311
320
|
const rows = new Map(held.map((one) => [one.conversation, one]));
|
|
312
|
-
return list.map((entry) =>
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
321
|
+
return list.map((entry) => {
|
|
322
|
+
const agent = agents.get(entry.agent);
|
|
323
|
+
return {
|
|
324
|
+
conversation: entry.conversation,
|
|
325
|
+
agent: { identity: agent.id, name: agent.name, retired: agent.retired_at !== null },
|
|
326
|
+
name: entry.name,
|
|
327
|
+
created: entry.created,
|
|
328
|
+
finished: entry.finished,
|
|
329
|
+
outcome: entry.outcome,
|
|
330
|
+
waiting: entry.waiting,
|
|
331
|
+
subject: entry.subject,
|
|
332
|
+
...rowOf(alive, entry.conversation),
|
|
333
|
+
...heldFacts(rows.get(entry.conversation), entry),
|
|
334
|
+
};
|
|
335
|
+
});
|
|
323
336
|
}
|
|
324
|
-
async function
|
|
325
|
-
const
|
|
326
|
-
if (
|
|
327
|
-
return
|
|
328
|
-
return !alive.known() && alive.deps.stream() !== undefined && alive.deps.online()
|
|
337
|
+
async function heldListing(alive) {
|
|
338
|
+
const { conversationList, agentList } = await (await alive.deps.local()).facts();
|
|
339
|
+
if (conversationList !== null && agentList !== null)
|
|
340
|
+
return { conversations: conversationList, agents: agentList };
|
|
341
|
+
return !alive.known() && alive.deps.stream() !== undefined && alive.deps.online()
|
|
342
|
+
? null
|
|
343
|
+
: { conversations: [], agents: [] };
|
|
329
344
|
}
|
|
330
345
|
async function endedIn(alive, conversation) {
|
|
331
|
-
const
|
|
332
|
-
return
|
|
346
|
+
const listing = await heldListing(alive);
|
|
347
|
+
return (listing?.conversations.find((entry) => entry.conversation === conversation)?.processEnded ??
|
|
348
|
+
null);
|
|
349
|
+
}
|
|
350
|
+
function upserted(kept, set, key) {
|
|
351
|
+
const held = new Map(kept.map((one) => [key(one), one]));
|
|
352
|
+
for (const one of set)
|
|
353
|
+
held.set(key(one), { ...one });
|
|
354
|
+
return held;
|
|
333
355
|
}
|
|
334
356
|
function listChanged(alive, change) {
|
|
335
357
|
void alive.deps
|
|
336
358
|
.durably(async (local) => {
|
|
337
|
-
const { conversationList, conversationCursor } = await local.facts();
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
359
|
+
const { conversationList, agentList, conversationCursor, readUntil } = await local.facts();
|
|
360
|
+
if (readUntil === null)
|
|
361
|
+
await local.fact('readUntil', new Date().toISOString());
|
|
362
|
+
const held = upserted(change.replacing ? [] : (conversationList ?? []), change.set, (entry) => entry.conversation);
|
|
363
|
+
for (const entry of change.set)
|
|
342
364
|
alive.created(entry.conversation);
|
|
343
|
-
}
|
|
344
365
|
if (change.gone !== null)
|
|
345
366
|
held.delete(change.gone);
|
|
346
367
|
const list = [...held.values()];
|
|
368
|
+
const agents = [
|
|
369
|
+
...upserted(change.replacing ? [] : (agentList ?? []), change.agents, (agent) => agent.id).values(),
|
|
370
|
+
];
|
|
347
371
|
if (JSON.stringify(list) !== JSON.stringify(conversationList)) {
|
|
348
372
|
await local.fact('conversationList', list);
|
|
349
373
|
}
|
|
374
|
+
if (JSON.stringify(agents) !== JSON.stringify(agentList)) {
|
|
375
|
+
await local.fact('agentList', agents);
|
|
376
|
+
}
|
|
350
377
|
if (change.cursor !== undefined) {
|
|
351
378
|
if (change.cursor !== conversationCursor) {
|
|
352
379
|
await local.fact('conversationCursor', change.cursor);
|
|
353
380
|
}
|
|
354
381
|
alive.deps.stream()?.hold(change.cursor);
|
|
355
382
|
}
|
|
356
|
-
return list;
|
|
383
|
+
return { conversations: list, agents };
|
|
357
384
|
})
|
|
358
|
-
.catch(async () =>
|
|
359
|
-
.
|
|
385
|
+
.catch(async () => {
|
|
386
|
+
const { conversationList, agentList } = await (await alive.deps.local()).facts();
|
|
387
|
+
return { conversations: conversationList ?? [], agents: agentList ?? [] };
|
|
388
|
+
})
|
|
389
|
+
.then((listing) => {
|
|
360
390
|
if (alive.deps.closed() || change.paged === true)
|
|
361
391
|
return;
|
|
392
|
+
const list = listing.conversations;
|
|
362
393
|
endedAnew(alive, list);
|
|
363
394
|
if (change.cursor !== undefined) {
|
|
364
|
-
alive.held.set({ listKnown: true });
|
|
395
|
+
alive.held.set({ listKnown: true, openingListed: true });
|
|
365
396
|
settleBehind(alive, list);
|
|
366
397
|
openingEnded(alive);
|
|
367
398
|
alive.deps.settled();
|
|
@@ -369,11 +400,12 @@ function listChanged(alive, change) {
|
|
|
369
400
|
emitList(alive);
|
|
370
401
|
if (!alive.known())
|
|
371
402
|
return;
|
|
372
|
-
retiredDrafts(alive,
|
|
373
|
-
const { replicated } = alive.held.now();
|
|
374
|
-
if (change.cursor === undefined
|
|
375
|
-
|
|
376
|
-
list.some(({ conversation }) => !replicated.has(conversation))
|
|
403
|
+
retiredDrafts(alive, listing);
|
|
404
|
+
const { replicated, openingRead } = alive.held.now();
|
|
405
|
+
if (change.cursor === undefined
|
|
406
|
+
? list.length !== replicated.size ||
|
|
407
|
+
list.some(({ conversation }) => !replicated.has(conversation))
|
|
408
|
+
: openingRead) {
|
|
377
409
|
alive.deps.again();
|
|
378
410
|
}
|
|
379
411
|
}, uncaught);
|
|
@@ -389,16 +421,16 @@ function endedAnew(alive, list) {
|
|
|
389
421
|
emit(alive, view.conversation);
|
|
390
422
|
}
|
|
391
423
|
}
|
|
392
|
-
function
|
|
393
|
-
const reading =
|
|
424
|
+
function shownListing(alive, work) {
|
|
425
|
+
const reading = heldListing(alive);
|
|
394
426
|
alive.inOrder(async () => {
|
|
395
|
-
const
|
|
427
|
+
const listing = await reading.catch((error) => {
|
|
396
428
|
uncaught(error);
|
|
397
429
|
return null;
|
|
398
430
|
});
|
|
399
|
-
if (
|
|
431
|
+
if (listing === null || alive.deps.closed())
|
|
400
432
|
return;
|
|
401
|
-
work(
|
|
433
|
+
work(listing);
|
|
402
434
|
});
|
|
403
435
|
}
|
|
404
436
|
async function told(alive) {
|
|
@@ -443,66 +475,48 @@ export function conversationsLearned(alive) {
|
|
|
443
475
|
return;
|
|
444
476
|
if (alive.listeners.waiting())
|
|
445
477
|
tellList(alive);
|
|
446
|
-
if (!alive.agentListeners.waiting())
|
|
478
|
+
if (!alive.agentListeners.waiting() && !alive.listedListeners.waiting())
|
|
447
479
|
return;
|
|
448
|
-
|
|
480
|
+
shownListing(alive, (listing) => {
|
|
481
|
+
alive.agentListeners.welcome(agentsOf(listing));
|
|
482
|
+
alive.listedListeners.welcome(structuredClone(listing.agents));
|
|
483
|
+
});
|
|
449
484
|
}
|
|
450
|
-
function
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
.
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
:
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
cli: held.cli,
|
|
466
|
-
environment: structuredClone(held.environment),
|
|
467
|
-
};
|
|
468
|
-
})
|
|
485
|
+
function agentsOf(listing) {
|
|
486
|
+
return listing.agents
|
|
487
|
+
.filter((agent) => agent.retired_at === null)
|
|
488
|
+
.map((agent) => ({
|
|
489
|
+
identity: agent.id,
|
|
490
|
+
name: agent.name,
|
|
491
|
+
cli: agent.cli,
|
|
492
|
+
model: agent.model,
|
|
493
|
+
effort: agent.effort,
|
|
494
|
+
environment: {
|
|
495
|
+
identity: agent.environment,
|
|
496
|
+
name: agent.environment_name,
|
|
497
|
+
state: agent.environment_connected ? 'online' : 'offline',
|
|
498
|
+
},
|
|
499
|
+
}))
|
|
469
500
|
.sort((left, right) => left.name === right.name
|
|
470
501
|
? left.identity.localeCompare(right.identity)
|
|
471
502
|
: left.name.localeCompare(right.name));
|
|
472
503
|
}
|
|
473
|
-
function readAgents(alive) {
|
|
474
|
-
const stream = alive.deps.stream();
|
|
475
|
-
if (stream?.agents === undefined || !alive.deps.online() || alive.held.now().agentsReading)
|
|
476
|
-
return;
|
|
477
|
-
const { agents: read } = stream;
|
|
478
|
-
const { agentListeners } = alive;
|
|
479
|
-
alive.held.set({ agentsReading: true });
|
|
480
|
-
void alive.deps.recovery
|
|
481
|
-
.attempt('agents', async () => {
|
|
482
|
-
if (!alive.deps.online() || (!agentListeners.waiting() && !agentListeners.told())) {
|
|
483
|
-
return 'done';
|
|
484
|
-
}
|
|
485
|
-
const listed = await retrying(alive.deps.retries, 'conversations', AGENTS, read)();
|
|
486
|
-
if (listed === null)
|
|
487
|
-
return 'done';
|
|
488
|
-
alive.held.set({ listedAgents: listed });
|
|
489
|
-
emitAgents(alive);
|
|
490
|
-
return 'done';
|
|
491
|
-
})
|
|
492
|
-
.finally(() => {
|
|
493
|
-
alive.held.set({ agentsReading: false });
|
|
494
|
-
});
|
|
495
|
-
}
|
|
496
504
|
function emitAgents(alive) {
|
|
497
|
-
|
|
505
|
+
const { agentListeners, listedListeners } = alive;
|
|
506
|
+
if (alive.deps.closed() || (!agentListeners.told() && !listedListeners.told()))
|
|
498
507
|
return;
|
|
499
|
-
|
|
500
|
-
const value =
|
|
508
|
+
shownListing(alive, (listing) => {
|
|
509
|
+
const value = agentsOf(listing);
|
|
501
510
|
const shown = JSON.stringify(value);
|
|
502
|
-
if (shown
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
511
|
+
if (shown !== alive.held.now().agentsShown) {
|
|
512
|
+
alive.held.set({ agentsShown: shown });
|
|
513
|
+
agentListeners.tell(value);
|
|
514
|
+
}
|
|
515
|
+
const listed = JSON.stringify(listing.agents);
|
|
516
|
+
if (listed !== alive.held.now().listedShown) {
|
|
517
|
+
alive.held.set({ listedShown: listed });
|
|
518
|
+
listedListeners.tell(structuredClone(listing.agents));
|
|
519
|
+
}
|
|
506
520
|
});
|
|
507
521
|
}
|
|
508
522
|
function setLive(alive, conversation, next) {
|
|
@@ -516,11 +530,11 @@ function setLive(alive, conversation, next) {
|
|
|
516
530
|
after.asked !== before.asked)
|
|
517
531
|
tellSoon(alive);
|
|
518
532
|
}
|
|
519
|
-
function retiredChat(conversation,
|
|
533
|
+
function retiredChat(conversation, listing) {
|
|
520
534
|
if (!conversation.startsWith(NEW_CHAT))
|
|
521
535
|
return false;
|
|
522
536
|
const agent = conversation.slice(NEW_CHAT.length);
|
|
523
|
-
return
|
|
537
|
+
return listing.agents.some((one) => one.id === agent && one.retired_at !== null);
|
|
524
538
|
}
|
|
525
539
|
function live(alive, conversation, change) {
|
|
526
540
|
alive.factsHeard(conversation, FACTS.filter((one) => one in change));
|
|
@@ -573,19 +587,13 @@ function handReplicated(alive) {
|
|
|
573
587
|
}
|
|
574
588
|
async function remove(alive, leaving) {
|
|
575
589
|
await alive.deps.durably(async (local) => {
|
|
576
|
-
const kept = new Set(
|
|
577
|
-
...(await local.conversations(leaving)).map(({ conversation }) => conversation),
|
|
578
|
-
...(await local.chatDrafts())
|
|
579
|
-
.filter(({ conversation }) => leaving.includes(conversation))
|
|
580
|
-
.map(({ conversation }) => conversation),
|
|
581
|
-
]);
|
|
582
|
-
await local.dropConversations(leaving);
|
|
590
|
+
const kept = new Set(await local.dropConversations(leaving));
|
|
583
591
|
const changed = [];
|
|
584
592
|
for (const conversation of leaving) {
|
|
585
593
|
if (kept.has(conversation) || alive.liveHeld(conversation) !== undefined) {
|
|
586
594
|
changed.push(conversation);
|
|
587
595
|
}
|
|
588
|
-
|
|
596
|
+
heldInViews(alive, conversation, { draft: null, dismissed: null });
|
|
589
597
|
alive.forget(conversation);
|
|
590
598
|
setLive(alive, conversation, null);
|
|
591
599
|
await slide(alive, local, conversation, null);
|
|
@@ -614,7 +622,7 @@ async function readsOf(local, conversations) {
|
|
|
614
622
|
return new Map((await local.conversations(conversations)).map((held) => [held.conversation, held]));
|
|
615
623
|
}
|
|
616
624
|
function retiredDrafts(alive, list) {
|
|
617
|
-
if (!list.some((
|
|
625
|
+
if (!list.agents.some((agent) => agent.retired_at !== null))
|
|
618
626
|
return;
|
|
619
627
|
void alive.deps
|
|
620
628
|
.local()
|
|
@@ -810,19 +818,27 @@ function heard(alive, event) {
|
|
|
810
818
|
emit(alive, conversation);
|
|
811
819
|
}
|
|
812
820
|
async function kept(alive, local, conversation, following) {
|
|
813
|
-
const
|
|
814
|
-
if (
|
|
821
|
+
const draft = following === null || empty(following) ? null : following;
|
|
822
|
+
if (draft === null)
|
|
815
823
|
await local.dropChatDraft(conversation);
|
|
816
824
|
else
|
|
817
|
-
await local.keepChatDrafts([
|
|
818
|
-
|
|
825
|
+
await local.keepChatDrafts([draft]);
|
|
826
|
+
heldInViews(alive, conversation, { draft });
|
|
819
827
|
}
|
|
820
|
-
function
|
|
828
|
+
function heldInViews(alive, conversation, held) {
|
|
821
829
|
for (const view of alive.views()) {
|
|
822
830
|
if (view.conversation === conversation)
|
|
823
|
-
view.held.set(
|
|
831
|
+
view.held.set(held);
|
|
824
832
|
}
|
|
825
833
|
}
|
|
834
|
+
async function factOf(local, name) {
|
|
835
|
+
return Object.fromEntries((await local.conversationFacts())
|
|
836
|
+
.filter((fact) => fact.name === name)
|
|
837
|
+
.map(({ conversation, value }) => [conversation, value]));
|
|
838
|
+
}
|
|
839
|
+
async function dismissedIn(local, conversation) {
|
|
840
|
+
return (await factOf(local, 'dismissedSuggestion'))[conversation] ?? null;
|
|
841
|
+
}
|
|
826
842
|
async function draftAt(local, conversation) {
|
|
827
843
|
return (await local.chatDraft(conversation)) ?? undefined;
|
|
828
844
|
}
|
|
@@ -853,9 +869,9 @@ function moved(alive, agent, operation, to) {
|
|
|
853
869
|
: [{ ...unsent, conversation: to }];
|
|
854
870
|
const left = { ...(taken.length === 0 ? unsent : blank), moves: [...earlier, operation] };
|
|
855
871
|
await local.keepChatDrafts([left, ...taken]);
|
|
856
|
-
|
|
872
|
+
heldInViews(alive, from, { draft: left });
|
|
857
873
|
for (const one of taken)
|
|
858
|
-
|
|
874
|
+
heldInViews(alive, to, { draft: one });
|
|
859
875
|
alive.deps.publish(conversationChangeSet([from, to]));
|
|
860
876
|
});
|
|
861
877
|
}
|
|
@@ -886,7 +902,7 @@ async function submitted(alive, conversation, operation, draft) {
|
|
|
886
902
|
});
|
|
887
903
|
return submission;
|
|
888
904
|
}
|
|
889
|
-
async function dispatched(alive, conversation, submission) {
|
|
905
|
+
async function dispatched(alive, conversation, submission, resent = false) {
|
|
890
906
|
const dispatch = alive.sendingBegan(submission.operation);
|
|
891
907
|
try {
|
|
892
908
|
const result = await invoke(alive, 'conversations/send', conversation, submission.operation, { text: submission.text }, { step: 'sending', instance: `message ${submission.operation}` });
|
|
@@ -897,6 +913,7 @@ async function dispatched(alive, conversation, submission) {
|
|
|
897
913
|
alive.deps.unanswered();
|
|
898
914
|
return result;
|
|
899
915
|
}
|
|
916
|
+
alive.deps.heard(submission.operation, resent);
|
|
900
917
|
const turn = answered(result, 'message_id');
|
|
901
918
|
await withDraft(alive, conversation, async (current, local) => {
|
|
902
919
|
const held = current?.submitted?.find((one) => one.operation === submission.operation);
|
|
@@ -919,8 +936,9 @@ async function dispatched(alive, conversation, submission) {
|
|
|
919
936
|
function invoke(alive, name, conversation, operation, extra = {}, attempt) {
|
|
920
937
|
return alive.deps.call(name, { conversation_id: conversation, operation_id: operation, ...extra }, attempt);
|
|
921
938
|
}
|
|
922
|
-
export function conversationSurface(alive) {
|
|
939
|
+
export function conversationSurface(alive, files) {
|
|
923
940
|
return {
|
|
941
|
+
...files,
|
|
924
942
|
list() {
|
|
925
943
|
return new Promise((settle) => {
|
|
926
944
|
const answer = (listed) => {
|
|
@@ -938,7 +956,12 @@ export function conversationSurface(alive) {
|
|
|
938
956
|
return alive.deps.durably(async (local) => {
|
|
939
957
|
const { messages, more } = await local.messageWindow(conversation, asked.limit, asked.before, phrase);
|
|
940
958
|
const total = asked.total ? await local.messageCount(conversation, phrase) : null;
|
|
941
|
-
return structuredClone(viewOf(alive, conversation, messages, frameOf(asked, messages, more, total),
|
|
959
|
+
return structuredClone(viewOf(alive, conversation, messages, frameOf(asked, messages, more, total), {
|
|
960
|
+
draft: (await local.chatDraft(conversation)) ?? null,
|
|
961
|
+
ended: await endedIn(alive, conversation),
|
|
962
|
+
dismissed: await dismissedIn(local, conversation),
|
|
963
|
+
pins: (await local.facts()).chatPins,
|
|
964
|
+
}));
|
|
942
965
|
});
|
|
943
966
|
},
|
|
944
967
|
async create(input) {
|
|
@@ -946,7 +969,7 @@ export function conversationSurface(alive) {
|
|
|
946
969
|
const conversation = answered(result, 'conversation_id');
|
|
947
970
|
if (conversation === null)
|
|
948
971
|
return result;
|
|
949
|
-
const listed = (await
|
|
972
|
+
const listed = (await heldListing(alive))?.conversations ?? [];
|
|
950
973
|
if (!listed.some((entry) => entry.conversation === conversation)) {
|
|
951
974
|
alive.creating(conversation);
|
|
952
975
|
}
|
|
@@ -1012,40 +1035,53 @@ export function conversationSurface(alive) {
|
|
|
1012
1035
|
message_id: message,
|
|
1013
1036
|
});
|
|
1014
1037
|
},
|
|
1015
|
-
async
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1038
|
+
async pin(figures) {
|
|
1039
|
+
const pins = [...figures];
|
|
1040
|
+
await alive.deps.durably((local) => local.fact('chatPins', pins));
|
|
1041
|
+
const views = [...alive.views()];
|
|
1042
|
+
for (const view of views)
|
|
1043
|
+
view.held.set({ pins });
|
|
1044
|
+
for (const conversation of new Set(views.map((view) => view.conversation))) {
|
|
1045
|
+
emit(alive, conversation);
|
|
1046
|
+
}
|
|
1020
1047
|
},
|
|
1021
|
-
async
|
|
1022
|
-
|
|
1048
|
+
async openTurn(conversation, turn) {
|
|
1049
|
+
await alive.deps.durably((local) => local.keepConversationFact({ conversation, name: 'openedTurn', value: turn }));
|
|
1050
|
+
tellList(alive);
|
|
1023
1051
|
},
|
|
1024
|
-
|
|
1052
|
+
dismissSuggestion(conversation, suggestion) {
|
|
1025
1053
|
return alive.deps.durably(async (local) => {
|
|
1026
|
-
|
|
1027
|
-
|
|
1054
|
+
if ((await dismissedIn(local, conversation)) === suggestion)
|
|
1055
|
+
return;
|
|
1056
|
+
await local.keepConversationFact({
|
|
1057
|
+
conversation,
|
|
1058
|
+
name: 'dismissedSuggestion',
|
|
1059
|
+
value: suggestion,
|
|
1060
|
+
});
|
|
1061
|
+
heldInViews(alive, conversation, { dismissed: suggestion });
|
|
1062
|
+
alive.deps.publish(conversationChangeSet([conversation]));
|
|
1028
1063
|
});
|
|
1029
1064
|
},
|
|
1030
1065
|
};
|
|
1031
1066
|
}
|
|
1067
|
+
function rewritten(alive, conversation, text, revision = chatDraftRevision()) {
|
|
1068
|
+
return withDraft(alive, conversation, (current) => ({
|
|
1069
|
+
conversation,
|
|
1070
|
+
text: text(current?.text ?? ''),
|
|
1071
|
+
revision,
|
|
1072
|
+
...(current === undefined ? {} : pending(current)),
|
|
1073
|
+
}));
|
|
1074
|
+
}
|
|
1032
1075
|
export function chatDraftSurface(alive) {
|
|
1033
1076
|
return {
|
|
1034
|
-
write(conversation, draft, revision
|
|
1035
|
-
return
|
|
1036
|
-
conversation,
|
|
1037
|
-
text: draft.text,
|
|
1038
|
-
revision,
|
|
1039
|
-
...(current === undefined ? {} : pending(current)),
|
|
1040
|
-
}));
|
|
1077
|
+
write(conversation, draft, revision) {
|
|
1078
|
+
return rewritten(alive, conversation, () => draft.text, revision);
|
|
1041
1079
|
},
|
|
1042
1080
|
prepend(conversation, draft) {
|
|
1043
|
-
return
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
...(current === undefined ? {} : pending(current)),
|
|
1048
|
-
}));
|
|
1081
|
+
return rewritten(alive, conversation, (held) => joinedDraft(draft.text, held));
|
|
1082
|
+
},
|
|
1083
|
+
append(conversation, draft) {
|
|
1084
|
+
return rewritten(alive, conversation, (held) => joinedDraft(held, draft.text));
|
|
1049
1085
|
},
|
|
1050
1086
|
discard(conversation) {
|
|
1051
1087
|
return withDraft(alive, conversation, (current) => current === undefined
|
|
@@ -1055,31 +1091,34 @@ export function chatDraftSurface(alive) {
|
|
|
1055
1091
|
};
|
|
1056
1092
|
}
|
|
1057
1093
|
export async function conversationsOpened(alive, local) {
|
|
1058
|
-
const { conversationList, conversationCursor } = await local.facts();
|
|
1059
|
-
if (conversationList === null || alive.known())
|
|
1094
|
+
const { conversationList, agentList, conversationCursor } = await local.facts();
|
|
1095
|
+
if (conversationList === null || agentList === null || alive.known())
|
|
1060
1096
|
return;
|
|
1061
1097
|
alive.deps.stream()?.hold(conversationCursor);
|
|
1062
1098
|
conversationsLearned(alive);
|
|
1063
1099
|
}
|
|
1100
|
+
export function reconcileOpening(alive) {
|
|
1101
|
+
alive.held.set({ openingRead: true });
|
|
1102
|
+
return reconcileConversations(alive);
|
|
1103
|
+
}
|
|
1064
1104
|
export async function reconcileConversations(alive) {
|
|
1065
1105
|
if (!alive.known())
|
|
1066
1106
|
return;
|
|
1067
1107
|
const local = await alive.deps.local();
|
|
1068
|
-
const [held,
|
|
1108
|
+
const [held, stored, { conversationList, agentList }] = await Promise.all([
|
|
1069
1109
|
local.conversations(),
|
|
1070
|
-
local.
|
|
1110
|
+
local.storedConversations(),
|
|
1071
1111
|
local.facts(),
|
|
1072
1112
|
]);
|
|
1073
1113
|
const list = conversationList ?? [];
|
|
1114
|
+
const listing = { conversations: list, agents: agentList ?? [] };
|
|
1074
1115
|
const entries = new Map(list.map((entry) => [entry.conversation, entry]));
|
|
1075
1116
|
const named = new Set(entries.keys());
|
|
1076
1117
|
const reads = new Map(held.map((one) => [one.conversation, one]));
|
|
1077
1118
|
const { replicated } = alive.held.now();
|
|
1078
|
-
const leaving = [
|
|
1079
|
-
...new Set([...replicated, ...reads.keys(), ...kept.map(({ conversation }) => conversation)]),
|
|
1080
|
-
].filter((conversation) => !named.has(conversation) &&
|
|
1119
|
+
const leaving = [...new Set([...replicated, ...stored])].filter((conversation) => !named.has(conversation) &&
|
|
1081
1120
|
!alive.isCreating(conversation) &&
|
|
1082
|
-
(!conversation.startsWith(NEW_CHAT) || retiredChat(conversation,
|
|
1121
|
+
(!conversation.startsWith(NEW_CHAT) || retiredChat(conversation, listing)));
|
|
1083
1122
|
for (const conversation of named) {
|
|
1084
1123
|
if (!replicated.has(conversation) &&
|
|
1085
1124
|
missed(alive, conversation, reads.get(conversation), entries.get(conversation))) {
|
|
@@ -1114,6 +1153,17 @@ export async function catchUpConversations(alive, progress) {
|
|
|
1114
1153
|
if (!alive.current())
|
|
1115
1154
|
progress.complete = false;
|
|
1116
1155
|
}
|
|
1156
|
+
export async function holdsSubmission(alive, operation) {
|
|
1157
|
+
if (alive.sending(operation))
|
|
1158
|
+
return true;
|
|
1159
|
+
const local = await alive.deps.local();
|
|
1160
|
+
for (const { conversation } of await local.chatDrafts()) {
|
|
1161
|
+
const held = (await local.chatDraft(conversation))?.submitted;
|
|
1162
|
+
if (held?.some((one) => one.operation === operation && one.turn === null) === true)
|
|
1163
|
+
return true;
|
|
1164
|
+
}
|
|
1165
|
+
return false;
|
|
1166
|
+
}
|
|
1117
1167
|
export async function resendConversations(alive, progress) {
|
|
1118
1168
|
const local = await alive.deps.local();
|
|
1119
1169
|
const tried = new Set();
|
|
@@ -1125,7 +1175,7 @@ export async function resendConversations(alive, progress) {
|
|
|
1125
1175
|
if (alive.deps.closed())
|
|
1126
1176
|
return;
|
|
1127
1177
|
tried.add(submission.operation);
|
|
1128
|
-
const result = await dispatched(alive, conversation, submission);
|
|
1178
|
+
const result = await dispatched(alive, conversation, submission, true);
|
|
1129
1179
|
if (result.kind === 'revoked-authorization')
|
|
1130
1180
|
return;
|
|
1131
1181
|
if (result.kind === 'transport-uncertainty') {
|
|
@@ -1151,6 +1201,8 @@ export function watchConversation(alive, conversation, options, deliver) {
|
|
|
1151
1201
|
const { messages, more } = await local.messageWindow(conversation, asked.limit, asked.before);
|
|
1152
1202
|
held.set({ draft: (await local.chatDraft(conversation)) ?? null });
|
|
1153
1203
|
held.set({ ended: await endedIn(alive, conversation) });
|
|
1204
|
+
held.set({ dismissed: await dismissedIn(local, conversation) });
|
|
1205
|
+
held.set({ pins: (await local.facts()).chatPins });
|
|
1154
1206
|
held.set({ window: messages });
|
|
1155
1207
|
held.set({ more });
|
|
1156
1208
|
held.set({ total: asked.total ? await local.messageCount(conversation) : null });
|
|
@@ -1158,9 +1210,10 @@ export function watchConversation(alive, conversation, options, deliver) {
|
|
|
1158
1210
|
.then(() => {
|
|
1159
1211
|
if (alive.deps.closed() || !view.admit(watcher))
|
|
1160
1212
|
return;
|
|
1161
|
-
const
|
|
1162
|
-
const shown = window ?? [];
|
|
1163
|
-
|
|
1213
|
+
const now = held.now();
|
|
1214
|
+
const shown = now.window ?? [];
|
|
1215
|
+
const frame = sharedFrame(view, shown);
|
|
1216
|
+
watcher.notify(viewOf(alive, conversation, shown, frame, now));
|
|
1164
1217
|
})
|
|
1165
1218
|
.catch(() => { });
|
|
1166
1219
|
return () => {
|
|
@@ -1176,9 +1229,13 @@ export function watchConversationList(alive, deliver) {
|
|
|
1176
1229
|
export function watchConversationAgents(alive, deliver) {
|
|
1177
1230
|
alive.agentListeners.join(deliver);
|
|
1178
1231
|
conversationsLearned(alive);
|
|
1179
|
-
readAgents(alive);
|
|
1180
1232
|
return () => alive.agentListeners.leave(deliver);
|
|
1181
1233
|
}
|
|
1234
|
+
export function watchListedAgents(alive, deliver) {
|
|
1235
|
+
alive.listedListeners.join(deliver);
|
|
1236
|
+
conversationsLearned(alive);
|
|
1237
|
+
return () => alive.listedListeners.leave(deliver);
|
|
1238
|
+
}
|
|
1182
1239
|
export function conversationsChanged(alive, set) {
|
|
1183
1240
|
for (const conversation of set.conversations)
|
|
1184
1241
|
emit(alive, conversation);
|
|
@@ -1190,26 +1247,32 @@ export function receiveConversationEvent(alive, event) {
|
|
|
1190
1247
|
if (event.whole)
|
|
1191
1248
|
alive.relistBegun();
|
|
1192
1249
|
if (alive.relisting())
|
|
1193
|
-
alive.relistHeard(event.entries);
|
|
1250
|
+
alive.relistHeard(event.entries, event.agents);
|
|
1194
1251
|
if (event.more && alive.relisting())
|
|
1195
1252
|
return;
|
|
1196
1253
|
const whole = alive.relistTaken();
|
|
1197
1254
|
listChanged(alive, {
|
|
1198
1255
|
replacing: whole !== null,
|
|
1199
|
-
set: whole === null ? event.entries : [...whole.values()],
|
|
1256
|
+
set: whole === null ? event.entries : [...whole.conversations.values()],
|
|
1257
|
+
agents: whole === null ? event.agents : [...whole.agents.values()],
|
|
1200
1258
|
gone: null,
|
|
1201
1259
|
...(event.more ? { paged: true } : { cursor: event.cursor }),
|
|
1202
1260
|
});
|
|
1203
1261
|
return;
|
|
1204
1262
|
}
|
|
1205
1263
|
if (event.kind === 'listed') {
|
|
1206
|
-
alive.relistHeard([event.entry]);
|
|
1207
|
-
listChanged(alive, { replacing: false, set: [event.entry], gone: null });
|
|
1264
|
+
alive.relistHeard([event.entry], []);
|
|
1265
|
+
listChanged(alive, { replacing: false, set: [event.entry], agents: [], gone: null });
|
|
1266
|
+
return;
|
|
1267
|
+
}
|
|
1268
|
+
if (event.kind === 'agent') {
|
|
1269
|
+
alive.relistHeard([], [event.agent]);
|
|
1270
|
+
listChanged(alive, { replacing: false, set: [], agents: [event.agent], gone: null });
|
|
1208
1271
|
return;
|
|
1209
1272
|
}
|
|
1210
1273
|
if (event.kind === 'unlisted') {
|
|
1211
1274
|
alive.relistDropped(event.conversation);
|
|
1212
|
-
listChanged(alive, { replacing: false, set: [], gone: event.conversation });
|
|
1275
|
+
listChanged(alive, { replacing: false, set: [], agents: [], gone: event.conversation });
|
|
1213
1276
|
return;
|
|
1214
1277
|
}
|
|
1215
1278
|
heard(alive, event);
|