@agentshouse/mdruntime 0.1.0-c01d4615bfe46 → 0.1.0-c024a9c474f5e
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 +14 -13
- package/dist/acceptance.d.ts.map +1 -1
- package/dist/acceptance.js +32 -3
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +58 -19
- package/dist/adapter.d.ts +183 -21
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +2 -2
- package/dist/{binary.d.ts → attachment.d.ts} +8 -4
- package/dist/attachment.d.ts.map +1 -0
- package/dist/attachment.js +15 -0
- package/dist/authored.d.ts +88 -0
- package/dist/authored.d.ts.map +1 -0
- package/dist/authored.js +345 -0
- package/dist/chain.d.ts +1 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/chain.js +5 -2
- package/dist/change.d.ts +6 -2
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +3 -0
- package/dist/chat-types.js +2 -2
- package/dist/client.d.ts +23 -8
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +25 -54
- package/dist/collection.d.ts +6 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +23 -9
- 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 +2 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +73 -42
- package/dist/connection.d.ts +1 -1
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +16 -6
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/conversation-live.d.ts +8 -5
- package/dist/conversation-live.d.ts.map +1 -1
- package/dist/conversation-live.js +5 -3
- package/dist/conversation-row.d.ts +23 -1
- package/dist/conversation-row.d.ts.map +1 -1
- package/dist/conversation-row.js +37 -8
- package/dist/conversation.d.ts +20 -9
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +102 -68
- package/dist/declaration.js +3 -3
- package/dist/discovery.d.ts +3 -1
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +30 -5
- 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 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +3 -0
- package/dist/entry.d.ts +26 -1
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +126 -36
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +3 -1
- package/dist/figures.d.ts +1 -1
- package/dist/figures.d.ts.map +1 -1
- package/dist/figures.js +6 -4
- package/dist/file.d.ts +1 -1
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +1 -1
- package/dist/holdings.d.ts.map +1 -1
- package/dist/holdings.js +5 -3
- package/dist/host.d.ts +6 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +70 -29
- package/dist/house-query.d.ts +24 -0
- package/dist/house-query.d.ts.map +1 -0
- package/dist/house-query.js +102 -0
- package/dist/identity.d.ts +1 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +1 -1
- package/dist/index.d.ts +20 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -5
- package/dist/install.d.ts +8 -2
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +40 -33
- package/dist/lifecycle.d.ts +1 -1
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +42 -25
- package/dist/linked-file.d.ts +7 -0
- package/dist/linked-file.d.ts.map +1 -0
- package/dist/linked-file.js +13 -0
- 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 +19 -3
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +94 -36
- package/dist/loaded.d.ts +7 -0
- package/dist/loaded.d.ts.map +1 -0
- package/dist/loaded.js +46 -0
- package/dist/locks.d.ts.map +1 -1
- package/dist/locks.js +4 -2
- package/dist/lost.js +1 -1
- package/dist/media.d.ts +19 -3
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +177 -27
- package/dist/memory.d.ts +4 -2
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +50 -16
- package/dist/messages.d.ts +12 -1
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +28 -6
- 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 +10 -7
- 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 +3 -3
- package/dist/name.d.ts +0 -1
- package/dist/name.d.ts.map +1 -1
- package/dist/name.js +3 -7
- package/dist/observation.d.ts +26 -10
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +200 -69
- package/dist/online.d.ts +7 -0
- package/dist/online.d.ts.map +1 -0
- package/dist/online.js +29 -0
- package/dist/opened.d.ts +5 -5
- package/dist/opened.d.ts.map +1 -1
- package/dist/opened.js +2 -2
- package/dist/opening.d.ts.map +1 -1
- package/dist/opening.js +20 -2
- package/dist/outcome.d.ts +27 -14
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +14 -5
- package/dist/overlay.d.ts +20 -9
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +110 -41
- package/dist/parts.d.ts +4 -1
- package/dist/parts.d.ts.map +1 -1
- package/dist/parts.js +30 -7
- package/dist/paths.d.ts +1 -1
- package/dist/paths.js +1 -1
- package/dist/preparation.d.ts +33 -7
- package/dist/preparation.d.ts.map +1 -1
- package/dist/preparation.js +195 -78
- 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 +115 -67
- package/dist/query.d.ts +2 -2
- package/dist/query.d.ts.map +1 -1
- package/dist/questions.d.ts +1 -0
- package/dist/questions.d.ts.map +1 -1
- package/dist/questions.js +3 -1
- package/dist/queue.d.ts +1 -1
- package/dist/queue.d.ts.map +1 -1
- package/dist/queue.js +55 -23
- package/dist/reach.d.ts +15 -6
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +140 -25
- package/dist/react.d.ts +11 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/readiness.d.ts +22 -3
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +18 -10
- package/dist/reads.d.ts +2 -2
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +21 -13
- package/dist/recovery.d.ts +1 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +2 -1
- package/dist/refresh.d.ts +1 -1
- package/dist/refresh.js +4 -4
- package/dist/replica.d.ts +3 -8
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +5 -5
- package/dist/room-draft.d.ts +29 -4
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +237 -16
- package/dist/room-drafts.d.ts.map +1 -1
- package/dist/room-drafts.js +12 -7
- package/dist/room-list.d.ts +10 -0
- package/dist/room-list.d.ts.map +1 -0
- package/dist/room-list.js +47 -0
- package/dist/rows.d.ts +11 -3
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +25 -11
- package/dist/run-tables.d.ts +25 -0
- package/dist/run-tables.d.ts.map +1 -0
- package/dist/run-tables.js +98 -0
- package/dist/running.d.ts +5 -0
- package/dist/running.d.ts.map +1 -0
- package/dist/running.js +10 -0
- package/dist/runs.d.ts +27 -0
- package/dist/runs.d.ts.map +1 -0
- package/dist/runs.js +92 -0
- package/dist/runtime.d.ts +7 -3
- package/dist/runtime.d.ts.map +1 -1
- package/dist/save.d.ts +1 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +31 -96
- package/dist/saves.d.ts +7 -5
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +108 -54
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +2 -2
- package/dist/selector.d.ts +3 -0
- package/dist/selector.d.ts.map +1 -0
- package/dist/selector.js +22 -0
- package/dist/shown.d.ts +4 -2
- package/dist/shown.d.ts.map +1 -1
- package/dist/shown.js +73 -48
- package/dist/socket/session.d.ts +4 -1
- package/dist/socket/session.d.ts.map +1 -1
- package/dist/socket/session.js +3 -0
- package/dist/socket.d.ts +6 -1
- package/dist/socket.d.ts.map +1 -1
- package/dist/socket.js +14 -2
- package/dist/source.d.ts +42 -0
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +76 -9
- 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 +24 -5
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +59 -24
- 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 +15 -10
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +12 -5
- package/dist/stored.d.ts +40 -16
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +210 -52
- package/dist/surface.d.ts +18 -7
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +52 -16
- package/dist/sync.d.ts +4 -2
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +47 -25
- package/dist/tables.d.ts +34 -49
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +84 -325
- package/dist/tallies.js +2 -2
- package/dist/validation.d.ts +2 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +50 -10
- package/dist/wire.d.ts +29 -14
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +18 -13
- package/package.json +4 -4
- package/dist/binary.d.ts.map +0 -1
- package/dist/binary.js +0 -8
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';
|
|
@@ -25,11 +25,11 @@ export function unheldView(conversation) {
|
|
|
25
25
|
options: [],
|
|
26
26
|
starting: null,
|
|
27
27
|
state: null,
|
|
28
|
-
link: null,
|
|
29
28
|
deliveryWaiting: [],
|
|
30
29
|
deliveryUnknown: [],
|
|
31
30
|
chatDraft: null,
|
|
32
31
|
dismissedSuggestion: null,
|
|
32
|
+
pins: [],
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
export const SESSION_STARTED = 'Session started';
|
|
@@ -208,7 +208,7 @@ function returned(draft, submission, others) {
|
|
|
208
208
|
revision: chatDraftRevision(),
|
|
209
209
|
}, others);
|
|
210
210
|
}
|
|
211
|
-
function viewOf(alive, conversation, held, frame, draft, ended, dismissed) {
|
|
211
|
+
function viewOf(alive, conversation, held, frame, { draft, ended, dismissed, pins }) {
|
|
212
212
|
const facts = alive.liveOf(conversation);
|
|
213
213
|
return {
|
|
214
214
|
conversation,
|
|
@@ -227,38 +227,44 @@ function viewOf(alive, conversation, held, frame, draft, ended, dismissed) {
|
|
|
227
227
|
options: structuredClone(facts.options),
|
|
228
228
|
starting: facts.starting,
|
|
229
229
|
state: sessionOf(facts, held, ended),
|
|
230
|
-
link: facts.link === null ? null : { ...facts.link },
|
|
231
230
|
deliveryWaiting: [...facts.deliveryWaiting],
|
|
232
231
|
deliveryUnknown: [...facts.deliveryUnknown],
|
|
233
232
|
chatDraft: draft === null || unwritten(draft) ? null : { text: draft.text, revision: draft.revision },
|
|
234
233
|
dismissedSuggestion: dismissed,
|
|
234
|
+
pins: [...pins],
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
|
-
function
|
|
237
|
+
function standing(facts, saved, ended) {
|
|
238
238
|
if (facts.state !== null)
|
|
239
239
|
return structuredClone(facts.state);
|
|
240
|
+
if (saved === null)
|
|
241
|
+
return null;
|
|
242
|
+
const down = facts.process?.running === false;
|
|
243
|
+
return structuredClone(standingState(saved.state, saved.at, down ? saved.at : ended));
|
|
244
|
+
}
|
|
245
|
+
function sessionOf(facts, held, ended) {
|
|
240
246
|
const saved = [...held]
|
|
241
247
|
.reverse()
|
|
242
248
|
.map(({ message }) => record(message))
|
|
243
249
|
.find(({ content }) => isTurn(content));
|
|
244
250
|
const at = saved === undefined ? null : text(saved, 'accepted_at');
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
return structuredClone(standingState(saved.content.state, at, down ? at : ended));
|
|
251
|
+
return standing(facts, saved === undefined || !isTurn(saved.content) || at === null
|
|
252
|
+
? null
|
|
253
|
+
: { state: saved.content.state, at }, ended);
|
|
249
254
|
}
|
|
250
255
|
function emit(alive, conversation) {
|
|
251
256
|
if (alive.deps.closed())
|
|
252
257
|
return;
|
|
253
258
|
for (const view of alive.views()) {
|
|
254
|
-
const
|
|
259
|
+
const held = view.held.now();
|
|
260
|
+
const { window } = held;
|
|
255
261
|
if (view.conversation !== conversation || window === null)
|
|
256
262
|
continue;
|
|
257
263
|
const ready = view.ready();
|
|
258
264
|
if (ready.length === 0)
|
|
259
265
|
continue;
|
|
260
266
|
const frame = sharedFrame(view, window);
|
|
261
|
-
const value = viewOf(alive, conversation, window, frame,
|
|
267
|
+
const value = viewOf(alive, conversation, window, frame, held);
|
|
262
268
|
for (const watcher of ready)
|
|
263
269
|
watcher.notify(value);
|
|
264
270
|
}
|
|
@@ -287,20 +293,21 @@ async function slide(alive, local, conversation, arriving) {
|
|
|
287
293
|
}
|
|
288
294
|
}
|
|
289
295
|
}
|
|
290
|
-
function stateOf(
|
|
291
|
-
|
|
292
|
-
|
|
296
|
+
function stateOf({ activity }) {
|
|
297
|
+
if (activity === null)
|
|
298
|
+
return 'idle';
|
|
299
|
+
if (activity.turn === 'asking')
|
|
293
300
|
return 'asking';
|
|
294
|
-
return
|
|
301
|
+
return activity.turn === 'running' || activity.background !== false ? 'working' : 'idle';
|
|
295
302
|
}
|
|
296
303
|
function rowOf(alive, conversation) {
|
|
297
|
-
const { turn, questions } = alive.liveOf(conversation);
|
|
304
|
+
const { turn, questions, deliveryWaiting } = alive.liveOf(conversation);
|
|
298
305
|
return {
|
|
299
|
-
state: stateOf(alive, conversation),
|
|
300
306
|
started: turn?.started ?? null,
|
|
301
307
|
line: turn === null ? null : runningLine(turn.parts),
|
|
302
308
|
question: openQuestion(questions),
|
|
303
309
|
asked: questionAsked(questions),
|
|
310
|
+
deliveryWaiting: [...deliveryWaiting],
|
|
304
311
|
};
|
|
305
312
|
}
|
|
306
313
|
async function entries(alive) {
|
|
@@ -321,13 +328,18 @@ async function entries(alive) {
|
|
|
321
328
|
conversation: entry.conversation,
|
|
322
329
|
agent: { identity: agent.id, name: agent.name, retired: agent.retired_at !== null },
|
|
323
330
|
name: entry.name,
|
|
331
|
+
conversation_name: entry.conversationName,
|
|
324
332
|
created: entry.created,
|
|
325
|
-
finished: entry.finished,
|
|
326
333
|
outcome: entry.outcome,
|
|
327
334
|
waiting: entry.waiting,
|
|
328
335
|
subject: entry.subject,
|
|
336
|
+
room: entry.room,
|
|
337
|
+
model: entry.model,
|
|
338
|
+
effort: entry.effort,
|
|
339
|
+
state: stateOf(entry),
|
|
329
340
|
...rowOf(alive, entry.conversation),
|
|
330
341
|
...heldFacts(rows.get(entry.conversation), entry),
|
|
342
|
+
jobs: standing(alive.liveOf(entry.conversation), rows.get(entry.conversation)?.saved ?? null, entry.processEnded)?.running ?? [],
|
|
331
343
|
};
|
|
332
344
|
});
|
|
333
345
|
}
|
|
@@ -350,33 +362,39 @@ function upserted(kept, set, key) {
|
|
|
350
362
|
held.set(key(one), { ...one });
|
|
351
363
|
return held;
|
|
352
364
|
}
|
|
365
|
+
async function listStored(alive, local, change) {
|
|
366
|
+
const { conversationList, agentList, conversationCursor, readUntil } = await local.facts();
|
|
367
|
+
if (readUntil === null)
|
|
368
|
+
await local.fact('readUntil', new Date().toISOString());
|
|
369
|
+
const held = upserted(change.replacing ? [] : (conversationList ?? []), change.set, (entry) => entry.conversation);
|
|
370
|
+
for (const entry of change.set)
|
|
371
|
+
alive.created(entry.conversation);
|
|
372
|
+
if (change.gone !== null)
|
|
373
|
+
held.delete(change.gone);
|
|
374
|
+
const list = [...held.values()];
|
|
375
|
+
const agents = [
|
|
376
|
+
...upserted(change.replacing ? [] : (agentList ?? []), change.agents, (agent) => agent.id).values(),
|
|
377
|
+
];
|
|
378
|
+
if (JSON.stringify(list) !== JSON.stringify(conversationList)) {
|
|
379
|
+
await local.fact('conversationList', list);
|
|
380
|
+
}
|
|
381
|
+
if (JSON.stringify(agents) !== JSON.stringify(agentList)) {
|
|
382
|
+
await local.fact('agentList', agents);
|
|
383
|
+
}
|
|
384
|
+
if (change.cursor !== undefined && !alive.held.now().listRefused) {
|
|
385
|
+
if (change.cursor !== conversationCursor) {
|
|
386
|
+
await local.fact('conversationCursor', change.cursor);
|
|
387
|
+
}
|
|
388
|
+
alive.deps.stream()?.hold(change.cursor);
|
|
389
|
+
}
|
|
390
|
+
return { conversations: list, agents };
|
|
391
|
+
}
|
|
353
392
|
function listChanged(alive, change) {
|
|
354
393
|
void alive.deps
|
|
355
|
-
.durably(
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
alive.created(entry.conversation);
|
|
360
|
-
if (change.gone !== null)
|
|
361
|
-
held.delete(change.gone);
|
|
362
|
-
const list = [...held.values()];
|
|
363
|
-
const agents = [
|
|
364
|
-
...upserted(change.replacing ? [] : (agentList ?? []), change.agents, (agent) => agent.id).values(),
|
|
365
|
-
];
|
|
366
|
-
if (JSON.stringify(list) !== JSON.stringify(conversationList)) {
|
|
367
|
-
await local.fact('conversationList', list);
|
|
368
|
-
}
|
|
369
|
-
if (JSON.stringify(agents) !== JSON.stringify(agentList)) {
|
|
370
|
-
await local.fact('agentList', agents);
|
|
371
|
-
}
|
|
372
|
-
if (change.cursor !== undefined) {
|
|
373
|
-
if (change.cursor !== conversationCursor) {
|
|
374
|
-
await local.fact('conversationCursor', change.cursor);
|
|
375
|
-
}
|
|
376
|
-
alive.deps.stream()?.hold(change.cursor);
|
|
377
|
-
}
|
|
378
|
-
return { conversations: list, agents };
|
|
379
|
-
})
|
|
394
|
+
.durably((local) => listStored(alive, local, change).catch((error) => {
|
|
395
|
+
alive.held.set({ listRefused: true });
|
|
396
|
+
throw error;
|
|
397
|
+
}))
|
|
380
398
|
.catch(async () => {
|
|
381
399
|
const { conversationList, agentList } = await (await alive.deps.local()).facts();
|
|
382
400
|
return { conversations: conversationList ?? [], agents: agentList ?? [] };
|
|
@@ -387,7 +405,7 @@ function listChanged(alive, change) {
|
|
|
387
405
|
const list = listing.conversations;
|
|
388
406
|
endedAnew(alive, list);
|
|
389
407
|
if (change.cursor !== undefined) {
|
|
390
|
-
alive.held.set({ listKnown: true, openingListed: true });
|
|
408
|
+
alive.held.set({ listKnown: true, listHeld: true, openingListed: true });
|
|
391
409
|
settleBehind(alive, list);
|
|
392
410
|
openingEnded(alive);
|
|
393
411
|
alive.deps.settled();
|
|
@@ -484,6 +502,9 @@ function agentsOf(listing) {
|
|
|
484
502
|
identity: agent.id,
|
|
485
503
|
name: agent.name,
|
|
486
504
|
cli: agent.cli,
|
|
505
|
+
model: agent.model,
|
|
506
|
+
effort: agent.effort,
|
|
507
|
+
model_fixed: agent.model_fixed,
|
|
487
508
|
environment: {
|
|
488
509
|
identity: agent.environment,
|
|
489
510
|
name: agent.environment_name,
|
|
@@ -512,11 +533,17 @@ function emitAgents(alive) {
|
|
|
512
533
|
}
|
|
513
534
|
});
|
|
514
535
|
}
|
|
536
|
+
function ran({ state, process }) {
|
|
537
|
+
return JSON.stringify([state?.running ?? null, process?.running ?? null]);
|
|
538
|
+
}
|
|
515
539
|
function setLive(alive, conversation, next) {
|
|
540
|
+
const was = ran(alive.liveOf(conversation));
|
|
516
541
|
const before = rowOf(alive, conversation);
|
|
517
542
|
alive.holdLive(conversation, next);
|
|
518
543
|
const after = rowOf(alive, conversation);
|
|
519
|
-
if (after.
|
|
544
|
+
if (after.started !== before.started ||
|
|
545
|
+
ran(alive.liveOf(conversation)) !== was ||
|
|
546
|
+
after.deliveryWaiting.join() !== before.deliveryWaiting.join())
|
|
520
547
|
emitList(alive);
|
|
521
548
|
else if (after.line !== before.line ||
|
|
522
549
|
after.question !== before.question ||
|
|
@@ -547,7 +574,6 @@ function openingEnded(alive) {
|
|
|
547
574
|
options: facts.has('options') ? QUIET.options : held.options,
|
|
548
575
|
starting: facts.has('starting') ? QUIET.starting : held.starting,
|
|
549
576
|
state: facts.has('state') ? QUIET.state : held.state,
|
|
550
|
-
link: facts.has('link') ? QUIET.link : held.link,
|
|
551
577
|
deliveryWaiting: facts.has('deliveryWaiting') ? QUIET.deliveryWaiting : held.deliveryWaiting,
|
|
552
578
|
deliveryUnknown: facts.has('deliveryUnknown') ? QUIET.deliveryUnknown : held.deliveryUnknown,
|
|
553
579
|
});
|
|
@@ -779,10 +805,6 @@ function heard(alive, event) {
|
|
|
779
805
|
live(alive, conversation, { state: structuredClone(event.state) });
|
|
780
806
|
return;
|
|
781
807
|
}
|
|
782
|
-
if (event.kind === 'link') {
|
|
783
|
-
live(alive, conversation, { link: { connected: event.connected } });
|
|
784
|
-
return;
|
|
785
|
-
}
|
|
786
808
|
if (event.kind === 'deliveries') {
|
|
787
809
|
live(alive, conversation, {
|
|
788
810
|
deliveryWaiting: [...event.waiting],
|
|
@@ -929,8 +951,9 @@ async function dispatched(alive, conversation, submission, resent = false) {
|
|
|
929
951
|
function invoke(alive, name, conversation, operation, extra = {}, attempt) {
|
|
930
952
|
return alive.deps.call(name, { conversation_id: conversation, operation_id: operation, ...extra }, attempt);
|
|
931
953
|
}
|
|
932
|
-
export function conversationSurface(alive) {
|
|
954
|
+
export function conversationSurface(alive, files) {
|
|
933
955
|
return {
|
|
956
|
+
...files,
|
|
934
957
|
list() {
|
|
935
958
|
return new Promise((settle) => {
|
|
936
959
|
const answer = (listed) => {
|
|
@@ -948,7 +971,12 @@ export function conversationSurface(alive) {
|
|
|
948
971
|
return alive.deps.durably(async (local) => {
|
|
949
972
|
const { messages, more } = await local.messageWindow(conversation, asked.limit, asked.before, phrase);
|
|
950
973
|
const total = asked.total ? await local.messageCount(conversation, phrase) : null;
|
|
951
|
-
return structuredClone(viewOf(alive, conversation, messages, frameOf(asked, messages, more, total),
|
|
974
|
+
return structuredClone(viewOf(alive, conversation, messages, frameOf(asked, messages, more, total), {
|
|
975
|
+
draft: (await local.chatDraft(conversation)) ?? null,
|
|
976
|
+
ended: await endedIn(alive, conversation),
|
|
977
|
+
dismissed: await dismissedIn(local, conversation),
|
|
978
|
+
pins: (await local.facts()).chatPins,
|
|
979
|
+
}));
|
|
952
980
|
});
|
|
953
981
|
},
|
|
954
982
|
async create(input) {
|
|
@@ -1014,25 +1042,27 @@ export function conversationSurface(alive) {
|
|
|
1014
1042
|
rename(conversation, name, operation) {
|
|
1015
1043
|
return invoke(alive, 'conversations/rename', conversation, operation, { name });
|
|
1016
1044
|
},
|
|
1017
|
-
|
|
1018
|
-
return invoke(alive, 'conversations/
|
|
1045
|
+
set(conversation, settings, operation) {
|
|
1046
|
+
return invoke(alive, 'conversations/set', conversation, operation, settings);
|
|
1019
1047
|
},
|
|
1020
1048
|
retry(conversation, message, operation) {
|
|
1021
1049
|
return invoke(alive, 'conversations/retry', conversation, operation, {
|
|
1022
1050
|
message_id: message,
|
|
1023
1051
|
});
|
|
1024
1052
|
},
|
|
1025
|
-
async
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1053
|
+
async pin(figures) {
|
|
1054
|
+
const pins = [...figures];
|
|
1055
|
+
await alive.deps.durably((local) => local.fact('chatPins', pins));
|
|
1056
|
+
const views = [...alive.views()];
|
|
1057
|
+
for (const view of views)
|
|
1058
|
+
view.held.set({ pins });
|
|
1059
|
+
for (const conversation of new Set(views.map((view) => view.conversation))) {
|
|
1060
|
+
emit(alive, conversation);
|
|
1061
|
+
}
|
|
1033
1062
|
},
|
|
1034
|
-
openTurn(conversation, turn) {
|
|
1035
|
-
|
|
1063
|
+
async openTurn(conversation, turn) {
|
|
1064
|
+
await alive.deps.durably((local) => local.keepConversationFact({ conversation, name: 'openedTurn', value: turn }));
|
|
1065
|
+
tellList(alive);
|
|
1036
1066
|
},
|
|
1037
1067
|
dismissSuggestion(conversation, suggestion) {
|
|
1038
1068
|
return alive.deps.durably(async (local) => {
|
|
@@ -1077,7 +1107,10 @@ export function chatDraftSurface(alive) {
|
|
|
1077
1107
|
}
|
|
1078
1108
|
export async function conversationsOpened(alive, local) {
|
|
1079
1109
|
const { conversationList, agentList, conversationCursor } = await local.facts();
|
|
1080
|
-
if (conversationList === null || agentList === null
|
|
1110
|
+
if (conversationList === null || agentList === null)
|
|
1111
|
+
return;
|
|
1112
|
+
alive.held.set({ listHeld: true });
|
|
1113
|
+
if (alive.known())
|
|
1081
1114
|
return;
|
|
1082
1115
|
alive.deps.stream()?.hold(conversationCursor);
|
|
1083
1116
|
conversationsLearned(alive);
|
|
@@ -1187,6 +1220,7 @@ export function watchConversation(alive, conversation, options, deliver) {
|
|
|
1187
1220
|
held.set({ draft: (await local.chatDraft(conversation)) ?? null });
|
|
1188
1221
|
held.set({ ended: await endedIn(alive, conversation) });
|
|
1189
1222
|
held.set({ dismissed: await dismissedIn(local, conversation) });
|
|
1223
|
+
held.set({ pins: (await local.facts()).chatPins });
|
|
1190
1224
|
held.set({ window: messages });
|
|
1191
1225
|
held.set({ more });
|
|
1192
1226
|
held.set({ total: asked.total ? await local.messageCount(conversation) : null });
|
|
@@ -1194,10 +1228,10 @@ export function watchConversation(alive, conversation, options, deliver) {
|
|
|
1194
1228
|
.then(() => {
|
|
1195
1229
|
if (alive.deps.closed() || !view.admit(watcher))
|
|
1196
1230
|
return;
|
|
1197
|
-
const
|
|
1198
|
-
const shown = window ?? [];
|
|
1231
|
+
const now = held.now();
|
|
1232
|
+
const shown = now.window ?? [];
|
|
1199
1233
|
const frame = sharedFrame(view, shown);
|
|
1200
|
-
watcher.notify(viewOf(alive, conversation, shown, frame,
|
|
1234
|
+
watcher.notify(viewOf(alive, conversation, shown, frame, now));
|
|
1201
1235
|
})
|
|
1202
1236
|
.catch(() => { });
|
|
1203
1237
|
return () => {
|
package/dist/declaration.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { equalValue } from '@agentshouse/mdmodel';
|
|
2
|
-
import {
|
|
2
|
+
import { documentAt, covered, normalize } from './paths.js';
|
|
3
3
|
export function declared({ locator: _locator, roomVersion: _roomVersion, ...declaration }) {
|
|
4
4
|
return declaration;
|
|
5
5
|
}
|
|
@@ -8,10 +8,10 @@ export function sameDeclaration(left, right) {
|
|
|
8
8
|
}
|
|
9
9
|
export function writeRule({ operations, providerOwnedPaths, authoredPaths, }, pathRule, local) {
|
|
10
10
|
return (path, needs) => {
|
|
11
|
-
const normalized = normalize(path);
|
|
11
|
+
const normalized = normalize(path.normalize('NFC'));
|
|
12
12
|
if (normalized === null || normalized === '')
|
|
13
13
|
return { code: 'room-root', path };
|
|
14
|
-
if (covered(providerOwnedPaths, normalized) || !
|
|
14
|
+
if (covered(providerOwnedPaths, normalized) || !documentAt(authoredPaths, normalized)) {
|
|
15
15
|
return { code: 'provider-owned-path', path: normalized };
|
|
16
16
|
}
|
|
17
17
|
if (!pathRule(normalized))
|
package/dist/discovery.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import type { CycleProgress } from './status.js';
|
|
|
5
5
|
import type { RuntimeStore } from './store.js';
|
|
6
6
|
export declare function malformed(listed: readonly DiscoveredRoom[]): string | null;
|
|
7
7
|
export declare function applyDiscovery(runtime: Runtime, found: readonly DiscoveredRoom[], started: number, left?: readonly string[]): Promise<readonly DiscoveredRoom[]>;
|
|
8
|
+
export declare const DISCOVERY = "discovery";
|
|
8
9
|
export declare function signIn(runtime: Runtime, local: RuntimeStore, signedIn: Member | null): Promise<void>;
|
|
9
|
-
export declare function
|
|
10
|
+
export declare function zoned(runtime: Runtime, local: RuntimeStore, zone: string | null): Promise<void>;
|
|
11
|
+
export declare function discoverRooms(runtime: Runtime, progress: CycleProgress, live: Live, found: Discovery | null): Promise<readonly DiscoveredRoom[] | null>;
|
|
10
12
|
//# sourceMappingURL=discovery.d.ts.map
|
package/dist/discovery.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,SAAS,EACT,cAAc,EACd,MAAM,EAEP,MAAM,cAAc,CAAC;AAOtB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAkB/C,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,GAAG,MAAM,GAAG,IAAI,CAsB1E;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,GACvB,OAAO,CAAC,SAAS,cAAc,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,SAAS,EACT,cAAc,EACd,MAAM,EAEP,MAAM,cAAc,CAAC;AAOtB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAkB/C,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,GAAG,MAAM,GAAG,IAAI,CAsB1E;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,GACvB,OAAO,CAAC,SAAS,cAAc,EAAE,CAAC,CAgDpC;AAUD,eAAO,MAAM,SAAS,cAAc,CAAC;AAErC,wBAAsB,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,iBAI1F;AAED,wBAAsB,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,iBAIrF;AAED,wBAAsB,aAAa,CACjC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,SAAS,GAAG,IAAI,GACtB,OAAO,CAAC,SAAS,cAAc,EAAE,GAAG,IAAI,CAAC,CA2E3C"}
|
package/dist/discovery.js
CHANGED
|
@@ -4,7 +4,7 @@ import { loseRooms } from './lost.js';
|
|
|
4
4
|
import { cachedModels } from './models.js';
|
|
5
5
|
import { beneath } from './paths.js';
|
|
6
6
|
import { refuse } from './refusal.js';
|
|
7
|
-
import { emitMember, emitRefusal, emitRooms, moveTo, transferring } from './shown.js';
|
|
7
|
+
import { emitMember, emitRefusal, emitRooms, emitTimeZone, moveTo, transferring } from './shown.js';
|
|
8
8
|
function within(root, path) {
|
|
9
9
|
return root === '' || beneath(root, path);
|
|
10
10
|
}
|
|
@@ -37,6 +37,12 @@ export function malformed(listed) {
|
|
|
37
37
|
}
|
|
38
38
|
export async function applyDiscovery(runtime, found, started, left) {
|
|
39
39
|
const { store, socket, presence } = runtime;
|
|
40
|
+
if (found.length === 0 && !store.needed()) {
|
|
41
|
+
const listed = presence.list([], { whole: left === undefined, live: socket.isOpen() });
|
|
42
|
+
socket.session.set({ roomsListed: true });
|
|
43
|
+
emitRooms(runtime);
|
|
44
|
+
return listed;
|
|
45
|
+
}
|
|
40
46
|
const lockedBefore = await lockedRooms(runtime);
|
|
41
47
|
const local = await store.open();
|
|
42
48
|
const fenced = new Set(await local.fences());
|
|
@@ -77,15 +83,21 @@ async function asked({ socket }, authorized) {
|
|
|
77
83
|
return { kind: 'transport-uncertainty', failure };
|
|
78
84
|
}
|
|
79
85
|
}
|
|
80
|
-
const DISCOVERY = 'discovery';
|
|
86
|
+
export const DISCOVERY = 'discovery';
|
|
81
87
|
export async function signIn(runtime, local, signedIn) {
|
|
82
88
|
if (JSON.stringify(signedIn) === JSON.stringify((await local.facts()).member))
|
|
83
89
|
return;
|
|
84
90
|
await local.fact('member', signedIn);
|
|
85
91
|
emitMember(runtime, signedIn);
|
|
86
92
|
}
|
|
87
|
-
export async function
|
|
88
|
-
|
|
93
|
+
export async function zoned(runtime, local, zone) {
|
|
94
|
+
if (zone === (await local.facts()).timeZone)
|
|
95
|
+
return;
|
|
96
|
+
await local.fact('timeZone', zone);
|
|
97
|
+
emitTimeZone(runtime, zone);
|
|
98
|
+
}
|
|
99
|
+
export async function discoverRooms(runtime, progress, live, found) {
|
|
100
|
+
const { store, socket } = runtime;
|
|
89
101
|
const { session } = socket;
|
|
90
102
|
const { closed, authorization } = session.now();
|
|
91
103
|
if (closed || authorization === undefined) {
|
|
@@ -108,7 +120,8 @@ export async function discoverRooms(runtime, local, progress, live, found) {
|
|
|
108
120
|
if (result.kind === 'discovery')
|
|
109
121
|
runtime.retries.succeeded('connection', DISCOVERY);
|
|
110
122
|
if (result.kind === 'transport-uncertainty') {
|
|
111
|
-
|
|
123
|
+
if (store.needed())
|
|
124
|
+
await cachedModels(runtime, await store.open());
|
|
112
125
|
progress.reachable = false;
|
|
113
126
|
progress.complete = false;
|
|
114
127
|
socket.notifyReady();
|
|
@@ -138,13 +151,25 @@ export async function discoverRooms(runtime, local, progress, live, found) {
|
|
|
138
151
|
session.set({ refusal: null });
|
|
139
152
|
emitRefusal(runtime);
|
|
140
153
|
}
|
|
154
|
+
const queriesOnly = result.queriesOnly ?? [];
|
|
155
|
+
if (!store.needed() && result.rooms.length === 0) {
|
|
156
|
+
session.set({ queriesOnly, unstored: result });
|
|
157
|
+
socket.notifyReady();
|
|
158
|
+
return applyDiscovery(runtime, result.rooms, started);
|
|
159
|
+
}
|
|
160
|
+
const local = await store.open();
|
|
141
161
|
const held = await local.facts();
|
|
142
162
|
if (JSON.stringify(result.providerLimits) !== JSON.stringify(held.providerLimits) ||
|
|
143
163
|
JSON.stringify(result.capabilities) !== JSON.stringify(held.capabilities)) {
|
|
144
164
|
await local.fact('providerLimits', result.providerLimits);
|
|
145
165
|
await local.fact('capabilities', result.capabilities);
|
|
146
166
|
}
|
|
167
|
+
if (JSON.stringify(queriesOnly) !== JSON.stringify(held.queriesOnly)) {
|
|
168
|
+
await local.fact('queriesOnly', queriesOnly);
|
|
169
|
+
}
|
|
170
|
+
session.set({ queriesOnly, unstored: null });
|
|
147
171
|
socket.notifyReady();
|
|
148
172
|
await signIn(runtime, local, result.member ?? null);
|
|
173
|
+
await zoned(runtime, local, result.timeZone ?? null);
|
|
149
174
|
return applyDiscovery(runtime, result.rooms, started);
|
|
150
175
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MdRuntimeClient } from './client.js';
|
|
2
|
+
import type { AttachmentLinkAnswer, DownloadAnswer } from './outcome.js';
|
|
3
|
+
export declare function handedCopy(copy: Blob, name: string): DownloadAnswer;
|
|
4
|
+
export declare function handedLink(path: string, link: () => Promise<AttachmentLinkAnswer>): Promise<DownloadAnswer>;
|
|
5
|
+
export declare function downloadAttachment(client: MdRuntimeClient, link: string): Promise<DownloadAnswer>;
|
|
6
|
+
//# sourceMappingURL=download.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../src/download.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAuBzE,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,CAKnE;AAED,wBAAsB,UAAU,CAC9B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,OAAO,CAAC,oBAAoB,CAAC,GACxC,OAAO,CAAC,cAAc,CAAC,CAazB;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAEjG"}
|
package/dist/download.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { linkedFile } from './linked-file.js';
|
|
2
|
+
// A browser reads a download's address only after the click that hands it returns, so a copy's address is released a minute later.
|
|
3
|
+
const HANDED_COPY_MS = 60_000;
|
|
4
|
+
const PAGE = /\.html?$/iu;
|
|
5
|
+
const STARTED = { kind: 'started' };
|
|
6
|
+
const BLOCKED = {
|
|
7
|
+
kind: 'blocked',
|
|
8
|
+
code: 'popup-blocked',
|
|
9
|
+
fields: {},
|
|
10
|
+
retryable: true,
|
|
11
|
+
};
|
|
12
|
+
function handed(url, name) {
|
|
13
|
+
const anchor = document.createElement('a');
|
|
14
|
+
anchor.href = url;
|
|
15
|
+
anchor.download = name;
|
|
16
|
+
anchor.click();
|
|
17
|
+
}
|
|
18
|
+
export function handedCopy(copy, name) {
|
|
19
|
+
const url = URL.createObjectURL(copy);
|
|
20
|
+
handed(url, name);
|
|
21
|
+
setTimeout(() => URL.revokeObjectURL(url), HANDED_COPY_MS);
|
|
22
|
+
return STARTED;
|
|
23
|
+
}
|
|
24
|
+
export async function handedLink(path, link) {
|
|
25
|
+
const tab = PAGE.test(path) ? globalThis.open('', '_blank') : null;
|
|
26
|
+
const linked = await link();
|
|
27
|
+
if (linked.kind === 'link' && PAGE.test(linked.name)) {
|
|
28
|
+
const away = tab ?? globalThis.open('', '_blank');
|
|
29
|
+
if (away === null)
|
|
30
|
+
return BLOCKED;
|
|
31
|
+
away.location.replace(linked.url);
|
|
32
|
+
return STARTED;
|
|
33
|
+
}
|
|
34
|
+
tab?.close();
|
|
35
|
+
if (linked.kind !== 'link')
|
|
36
|
+
return linked;
|
|
37
|
+
handed(linked.url, linked.name);
|
|
38
|
+
return STARTED;
|
|
39
|
+
}
|
|
40
|
+
export function downloadAttachment(client, link) {
|
|
41
|
+
return handedLink(linkedFile(link)?.path ?? link, () => client.conversation.attachment(link));
|
|
42
|
+
}
|
package/dist/durability.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export type UnsentWork = {
|
|
|
5
5
|
readonly kind: UnsentKind;
|
|
6
6
|
readonly count: number;
|
|
7
7
|
};
|
|
8
|
+
export declare function leftToSend(unsent: readonly UnsentWork[]): boolean;
|
|
8
9
|
export type AppCode = {
|
|
9
10
|
readonly running: number;
|
|
10
11
|
readonly older: number;
|
|
@@ -19,7 +20,7 @@ export type RuntimeShell = {
|
|
|
19
20
|
keepGeneration(value: string): void | Promise<void>;
|
|
20
21
|
dropGeneration(): void | Promise<void>;
|
|
21
22
|
cleanUp?(): Promise<number>;
|
|
22
|
-
measure?(measured: (app: string, code: AppCode | null) => void): Promise<HeldCode>;
|
|
23
|
+
measure?(measured: (app: string | null, code: AppCode | null) => void): Promise<HeldCode>;
|
|
23
24
|
reset(): Promise<void>;
|
|
24
25
|
retried?(failure: RetriedFailure): void;
|
|
25
26
|
succeeded?(step: Step): void;
|
package/dist/durability.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"durability.d.ts","sourceRoot":"","sources":["../src/durability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAMzD,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG,MAAM,GAAG,YAAY,GAAG,YAAY,CAAC;AAEjF,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/E,MAAM,MAAM,OAAO,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3E,MAAM,MAAM,QAAQ,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAE3F,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,cAAc,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5B,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"durability.d.ts","sourceRoot":"","sources":["../src/durability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAMzD,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG,MAAM,GAAG,YAAY,GAAG,YAAY,CAAC;AAEjF,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/E,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,GAAG,OAAO,CAEjE;AAED,MAAM,MAAM,OAAO,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3E,MAAM,MAAM,QAAQ,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAE3F,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,cAAc,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5B,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC1F,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,OAAO,CAAC,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;IACxC,SAAS,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAMvD;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAG/F;AAED,wBAAgB,UAAU,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAEvF;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAGrF"}
|
package/dist/durability.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
const STORAGE_LOSS_CODE = 'storage-loss';
|
|
2
2
|
const VISIT_LOSS_CODE = 'visit';
|
|
3
|
+
export function leftToSend(unsent) {
|
|
4
|
+
return unsent.some(({ kind }) => kind === 'pending-change' || kind === 'call');
|
|
5
|
+
}
|
|
3
6
|
export function refusedForSpace(error) {
|
|
4
7
|
return (typeof error === 'object' &&
|
|
5
8
|
error !== null &&
|
package/dist/entry.d.ts
CHANGED
|
@@ -1,20 +1,45 @@
|
|
|
1
1
|
import { type VerifiedModel } from '@agentshouse/mdmodel';
|
|
2
|
+
import type { Attachment, HeadChange } from './adapter.js';
|
|
3
|
+
import type { ChangeBatch } from './change.js';
|
|
4
|
+
import { type Written } from './overlay.js';
|
|
2
5
|
import { type QueryRows } from './query.js';
|
|
6
|
+
import { type ValuedEntry } from './stored.js';
|
|
3
7
|
import type { Connection } from './tables.js';
|
|
4
8
|
export { QueryError } from '@agentshouse/mdmodel';
|
|
9
|
+
export { documentKey, pathOfKey } from './rows.js';
|
|
10
|
+
export type { ValuedEntry } from './stored.js';
|
|
11
|
+
export type EntryArea = {
|
|
12
|
+
readonly path: string;
|
|
13
|
+
readonly open: readonly string[];
|
|
14
|
+
};
|
|
5
15
|
export type EntryRoom = {
|
|
6
16
|
locator: string;
|
|
17
|
+
handle?: string;
|
|
18
|
+
readable?: readonly string[];
|
|
19
|
+
areas?: readonly EntryArea[];
|
|
7
20
|
schema: string | null;
|
|
8
21
|
documents: Readonly<Record<string, string>>;
|
|
9
22
|
revisions?: Readonly<Record<string, string>>;
|
|
23
|
+
fileIds?: Readonly<Record<string, string>>;
|
|
24
|
+
created?: Readonly<Record<string, string>>;
|
|
25
|
+
changes?: Readonly<Record<string, HeadChange>>;
|
|
26
|
+
attachments?: Readonly<Record<string, Attachment>>;
|
|
10
27
|
};
|
|
11
28
|
export type EntryArguments = Readonly<Record<string, string>>;
|
|
12
29
|
export type EntryParameterKind = 'string' | 'integer' | 'number' | 'boolean';
|
|
13
30
|
export declare function boundQuery(template: unknown, args: EntryArguments): unknown;
|
|
14
31
|
export declare function entryParameters(template: unknown): readonly string[];
|
|
32
|
+
export declare function localQueryRefusal(template: unknown): string | null;
|
|
15
33
|
export declare function entryRefusal(template: unknown): string | null;
|
|
16
34
|
export type EntryScope = {
|
|
17
35
|
results(queries: Readonly<Record<string, unknown>>): Promise<Record<string, QueryRows>>;
|
|
18
36
|
};
|
|
19
|
-
export
|
|
37
|
+
export type CountedRoom = {
|
|
38
|
+
locator: string;
|
|
39
|
+
schema: string | null;
|
|
40
|
+
documents: readonly ValuedEntry[];
|
|
41
|
+
};
|
|
42
|
+
export declare function writtenIn(room: EntryRoom, roomTypes: VerifiedModel, batch: ChangeBatch): Written;
|
|
43
|
+
export declare function entryScope(rooms: readonly EntryRoom[], roomTypes: VerifiedModel, connection: Connection, followed?: readonly EntryRoom[]): EntryScope;
|
|
44
|
+
export declare function countScope(room: CountedRoom, roomTypes: VerifiedModel, connection: Connection): EntryScope;
|
|
20
45
|
//# sourceMappingURL=entry.d.ts.map
|
package/dist/entry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"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"}
|