@agentshouse/mdruntime 0.1.0-cee9c8aa4cd86 → 0.1.0-cefbc8bb8a1c0
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 +10 -8
- package/dist/adapter.d.ts +31 -18
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +2 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +28 -4
- package/dist/binary.d.ts +0 -5
- package/dist/binary.d.ts.map +1 -1
- package/dist/binary.js +1 -1
- package/dist/bootstrap.d.ts +15 -4
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +140 -90
- package/dist/client.d.ts +6 -7
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +54 -7
- package/dist/collection.d.ts +5 -0
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +23 -2
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +85 -30
- package/dist/connection.d.ts +9 -7
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +961 -476
- package/dist/conversation.d.ts +7 -5
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +166 -41
- package/dist/durability.d.ts +2 -5
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +5 -0
- package/dist/entry.d.ts +1 -0
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +1 -1
- package/dist/file.d.ts +2 -11
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +6 -4
- package/dist/fulltext.d.ts.map +1 -1
- package/dist/fulltext.js +8 -6
- package/dist/host.d.ts +4 -3
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +43 -15
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +2 -1
- package/dist/media.d.ts +8 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +218 -0
- package/dist/memory.d.ts +2 -2
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +46 -19
- package/dist/model.d.ts +6 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +7 -1
- package/dist/observation.d.ts +1 -0
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +1 -1
- package/dist/outcome.d.ts +13 -3
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +16 -5
- package/dist/overlay.js +1 -1
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +4 -0
- package/dist/query.d.ts +9 -0
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +12 -1
- package/dist/reach.d.ts +8 -3
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +68 -45
- package/dist/readiness.d.ts +17 -7
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +6 -6
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +10 -17
- package/dist/recovery.d.ts +1 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +26 -0
- package/dist/refresh.d.ts +6 -2
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +61 -27
- package/dist/replica.d.ts +5 -4
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +4 -3
- package/dist/room-draft.d.ts +18 -2
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +73 -6
- package/dist/rows.d.ts +15 -6
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +102 -74
- package/dist/save.d.ts +2 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +13 -7
- package/dist/status.d.ts +5 -0
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -1
- package/dist/store.d.ts +18 -12
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +25 -20
- package/dist/stored.d.ts +10 -13
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +210 -174
- package/dist/tables.d.ts +26 -6
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +57 -6
- package/dist/wire.d.ts +5 -5
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +2 -2
- package/dist/words.d.ts.map +1 -1
- package/dist/words.js +8 -2
- package/package.json +11 -18
- package/AGENTS.md +0 -320
- package/dist/chat/acts.d.ts +0 -33
- package/dist/chat/acts.d.ts.map +0 -1
- package/dist/chat/acts.js +0 -36
- package/dist/chat/context.d.ts +0 -3
- package/dist/chat/context.d.ts.map +0 -1
- package/dist/chat/context.js +0 -10
- package/dist/chat/earlier.d.ts +0 -10
- package/dist/chat/earlier.d.ts.map +0 -1
- package/dist/chat/earlier.js +0 -54
- package/dist/chat/house.d.ts +0 -25
- package/dist/chat/house.d.ts.map +0 -1
- package/dist/chat/house.js +0 -38
- package/dist/chat/input.d.ts +0 -11
- package/dist/chat/input.d.ts.map +0 -1
- package/dist/chat/input.js +0 -92
- package/dist/chat/kit.d.ts +0 -61
- package/dist/chat/kit.d.ts.map +0 -1
- package/dist/chat/kit.js +0 -123
- package/dist/chat/lasting.d.ts +0 -6
- package/dist/chat/lasting.d.ts.map +0 -1
- package/dist/chat/lasting.js +0 -19
- package/dist/chat/list.d.ts +0 -28
- package/dist/chat/list.d.ts.map +0 -1
- package/dist/chat/list.js +0 -103
- package/dist/chat/markdown.d.ts +0 -21
- package/dist/chat/markdown.d.ts.map +0 -1
- package/dist/chat/markdown.js +0 -246
- package/dist/chat/message.d.ts +0 -7
- package/dist/chat/message.d.ts.map +0 -1
- package/dist/chat/message.js +0 -254
- package/dist/chat/messages.d.ts +0 -35
- package/dist/chat/messages.d.ts.map +0 -1
- package/dist/chat/messages.js +0 -210
- package/dist/chat/name.d.ts +0 -7
- package/dist/chat/name.d.ts.map +0 -1
- package/dist/chat/name.js +0 -37
- package/dist/chat/opened.d.ts +0 -12
- package/dist/chat/opened.d.ts.map +0 -1
- package/dist/chat/opened.js +0 -19
- package/dist/chat/overlay.d.ts +0 -32
- package/dist/chat/overlay.d.ts.map +0 -1
- package/dist/chat/overlay.js +0 -103
- package/dist/chat/parts.d.ts +0 -58
- package/dist/chat/parts.d.ts.map +0 -1
- package/dist/chat/parts.js +0 -120
- package/dist/chat/pieces.d.ts +0 -62
- package/dist/chat/pieces.d.ts.map +0 -1
- package/dist/chat/pieces.js +0 -1110
- package/dist/chat/process.d.ts +0 -20
- package/dist/chat/process.d.ts.map +0 -1
- package/dist/chat/process.js +0 -32
- package/dist/chat/provider.d.ts +0 -70
- package/dist/chat/provider.d.ts.map +0 -1
- package/dist/chat/provider.js +0 -635
- package/dist/chat/question.d.ts +0 -9
- package/dist/chat/question.d.ts.map +0 -1
- package/dist/chat/question.js +0 -69
- package/dist/chat/questions.d.ts +0 -31
- package/dist/chat/questions.d.ts.map +0 -1
- package/dist/chat/questions.js +0 -111
- package/dist/chat/read.d.ts +0 -5
- package/dist/chat/read.d.ts.map +0 -1
- package/dist/chat/read.js +0 -13
- package/dist/chat/ready.d.ts +0 -37
- package/dist/chat/ready.d.ts.map +0 -1
- package/dist/chat/ready.js +0 -93
- package/dist/chat/room-file.d.ts +0 -8
- package/dist/chat/room-file.d.ts.map +0 -1
- package/dist/chat/room-file.js +0 -72
- package/dist/chat/steady.d.ts +0 -3
- package/dist/chat/steady.d.ts.map +0 -1
- package/dist/chat/steady.js +0 -26
- package/dist/chat/style.d.ts +0 -4
- package/dist/chat/style.d.ts.map +0 -1
- package/dist/chat/style.js +0 -307
- package/dist/chat.d.ts +0 -15
- package/dist/chat.d.ts.map +0 -1
- package/dist/chat.js +0 -8
package/dist/conversation.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { ConversationAction, ConversationAgents, ConversationEvent, ConversationMessage, ConversationStream, ProcessCommand, SessionOption, TurnContext } from './adapter.js';
|
|
1
|
+
import type { ConversationAction, ConversationAgents, ConversationEvent, ConversationMessage, ConversationStream, ListedConversation, ProcessCommand, SessionOption, TurnContext } from './adapter.js';
|
|
2
2
|
import { type ChangeSet } from './change-set.js';
|
|
3
|
-
import { type ChosenFile } from './file.js';
|
|
4
3
|
import type { Open } from './open.js';
|
|
5
4
|
import { type CallResult, type Offline } from './outcome.js';
|
|
6
5
|
import type { DocumentResult, PendingResult } from './query.js';
|
|
@@ -65,7 +64,6 @@ export type ConversationSurface = {
|
|
|
65
64
|
read(conversation: string, options?: ConversationOptions): Promise<ConversationView>;
|
|
66
65
|
create(input: unknown): Promise<CallResult>;
|
|
67
66
|
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
68
|
-
attach(room: string, file: ChosenFile): Promise<CallResult | Offline>;
|
|
69
67
|
answer(conversation: string, answer: unknown): Promise<CallResult>;
|
|
70
68
|
interrupt(conversation: string): Promise<CallResult>;
|
|
71
69
|
kill(conversation: string): Promise<CallResult>;
|
|
@@ -85,6 +83,8 @@ export type ConversationDependencies = {
|
|
|
85
83
|
stream(): ConversationStream | undefined;
|
|
86
84
|
publish(set: ChangeSet): void;
|
|
87
85
|
online(): boolean;
|
|
86
|
+
listed(): boolean;
|
|
87
|
+
full(): boolean;
|
|
88
88
|
closed(): boolean;
|
|
89
89
|
unanswered(): void;
|
|
90
90
|
expired(operation: string): boolean;
|
|
@@ -92,13 +92,14 @@ export type ConversationDependencies = {
|
|
|
92
92
|
export type ConversationStore = {
|
|
93
93
|
surface: ConversationSurface;
|
|
94
94
|
chatDraft: ChatDraftSurface;
|
|
95
|
-
hydrate(held: readonly HeldConversation[], drafts: readonly ChatDraftRecord[]): void;
|
|
95
|
+
hydrate(held: readonly HeldConversation[], drafts: readonly ChatDraftRecord[], list: readonly ListedConversation[] | null): void;
|
|
96
96
|
reconcile(): Promise<void>;
|
|
97
97
|
catchUp(progress: CycleProgress): Promise<void>;
|
|
98
98
|
resend(progress: CycleProgress): Promise<void>;
|
|
99
99
|
current(): boolean;
|
|
100
100
|
known(): boolean;
|
|
101
|
-
|
|
101
|
+
learned(): void;
|
|
102
|
+
declared(): void;
|
|
102
103
|
reopened(): void;
|
|
103
104
|
lost(): void;
|
|
104
105
|
watch(conversation: string, options: ConversationOptions, deliver: (view: ConversationView) => void): () => void;
|
|
@@ -112,6 +113,7 @@ export type ConversationStore = {
|
|
|
112
113
|
};
|
|
113
114
|
export declare function unheldView(conversation: string): ConversationView;
|
|
114
115
|
export declare const SESSION_STARTED = "Session started";
|
|
116
|
+
export declare const HISTORY_CONVERSATIONS = 64;
|
|
115
117
|
export declare function newChat(agent: string): string;
|
|
116
118
|
export declare function createConversationStore(deps: ConversationDependencies): ConversationStore;
|
|
117
119
|
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../src/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EAEjB,mBAAmB,EACnB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../src/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EAEjB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,WAAW,EAEZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIxE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAW,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,eAAe,EAAkB,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGlG,MAAM,MAAM,iBAAiB,GAAG,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E,MAAM,GAAG,gBAAgB,CAcjE;AAED,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAIjD,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7C;AAoQD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,wBAAwB,GAAG,iBAAiB,CAw+BzF"}
|
package/dist/conversation.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { conversationChangeSet } from './change-set.js';
|
|
2
2
|
import { runtimeError } from './failure.js';
|
|
3
|
-
import {
|
|
3
|
+
import { refusedForSpace } from './durability.js';
|
|
4
4
|
import { changeBatchIdentity, chatDraftRevision } from './identity.js';
|
|
5
5
|
import { OFFLINE } from './outcome.js';
|
|
6
|
+
import { untilAnswered } from './recovery.js';
|
|
6
7
|
import { capped, cursorOf, decodedCursor, FROM_START, messageOrder, precedes } from './windows.js';
|
|
7
8
|
const QUIET = {
|
|
8
9
|
turn: null,
|
|
@@ -40,6 +41,7 @@ export function unheldView(conversation) {
|
|
|
40
41
|
}
|
|
41
42
|
export const SESSION_STARTED = 'Session started';
|
|
42
43
|
const NEW_CHAT = 'new:';
|
|
44
|
+
export const HISTORY_CONVERSATIONS = 64;
|
|
43
45
|
export function newChat(agent) {
|
|
44
46
|
return `${NEW_CHAT}${agent}`;
|
|
45
47
|
}
|
|
@@ -209,6 +211,12 @@ function askedOf(options) {
|
|
|
209
211
|
return { limit: capped(limit), after, before: beforeOf(after), total: total === true };
|
|
210
212
|
}
|
|
211
213
|
const EXPIRED = { kind: 'rejected', code: 'expired', fields: {}, retryable: false };
|
|
214
|
+
const DURABLE_WRITE = {
|
|
215
|
+
kind: 'rejected',
|
|
216
|
+
code: 'durable-write',
|
|
217
|
+
fields: {},
|
|
218
|
+
retryable: true,
|
|
219
|
+
};
|
|
212
220
|
function unwritten(draft) {
|
|
213
221
|
return draft.text === '';
|
|
214
222
|
}
|
|
@@ -250,11 +258,17 @@ export function createConversationStore(deps) {
|
|
|
250
258
|
const listing = new Map();
|
|
251
259
|
const creations = new Set();
|
|
252
260
|
const listWatchers = new Set();
|
|
261
|
+
const unlisted = new Set();
|
|
253
262
|
let listKnown = false;
|
|
263
|
+
let listHeld = false;
|
|
264
|
+
let listKept = false;
|
|
254
265
|
const agentWatchers = new Set();
|
|
266
|
+
const unnamed = new Set();
|
|
267
|
+
let agentsKnown = false;
|
|
255
268
|
let agentNames = new Map();
|
|
256
269
|
let retiredAgents = new Set();
|
|
257
270
|
let agentsRead = null;
|
|
271
|
+
let agentsFrom;
|
|
258
272
|
let replicated = new Set();
|
|
259
273
|
let handedReplicated;
|
|
260
274
|
function liveOf(conversation) {
|
|
@@ -343,12 +357,53 @@ export function createConversationStore(deps) {
|
|
|
343
357
|
started: lives.get(entry.conversation)?.turn?.started ?? null,
|
|
344
358
|
}));
|
|
345
359
|
}
|
|
360
|
+
function keepList() {
|
|
361
|
+
if (!listKnown || listKept)
|
|
362
|
+
return;
|
|
363
|
+
listKept = true;
|
|
364
|
+
queueMicrotask(() => {
|
|
365
|
+
listKept = false;
|
|
366
|
+
if (deps.closed())
|
|
367
|
+
return;
|
|
368
|
+
const entries = [...listing.values()];
|
|
369
|
+
void deps.durably((local) => local.fact('conversationList', entries)).catch(() => { });
|
|
370
|
+
});
|
|
371
|
+
}
|
|
346
372
|
function emitList() {
|
|
347
|
-
if (deps.closed()
|
|
373
|
+
if (deps.closed())
|
|
348
374
|
return;
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
watcher
|
|
375
|
+
if (listWatchers.size > 0) {
|
|
376
|
+
const value = entries();
|
|
377
|
+
for (const watcher of listWatchers)
|
|
378
|
+
watcher(value);
|
|
379
|
+
}
|
|
380
|
+
learned();
|
|
381
|
+
}
|
|
382
|
+
function unlearnable() {
|
|
383
|
+
return !deps.online() || (deps.listed() && deps.agents() === undefined);
|
|
384
|
+
}
|
|
385
|
+
function learned() {
|
|
386
|
+
if (deps.closed())
|
|
387
|
+
return;
|
|
388
|
+
const named = agentsKnown || unlearnable();
|
|
389
|
+
if (unlisted.size > 0 &&
|
|
390
|
+
named &&
|
|
391
|
+
(listKnown || listHeld || deps.stream() === undefined || unlearnable())) {
|
|
392
|
+
const value = entries();
|
|
393
|
+
for (const watcher of [...unlisted]) {
|
|
394
|
+
unlisted.delete(watcher);
|
|
395
|
+
listWatchers.add(watcher);
|
|
396
|
+
watcher(value);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (unnamed.size > 0 && named) {
|
|
400
|
+
const value = agents();
|
|
401
|
+
for (const watcher of [...unnamed]) {
|
|
402
|
+
unnamed.delete(watcher);
|
|
403
|
+
agentWatchers.add(watcher);
|
|
404
|
+
watcher(value);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
352
407
|
}
|
|
353
408
|
function agents() {
|
|
354
409
|
return [...agentNames]
|
|
@@ -379,6 +434,7 @@ export function createConversationStore(deps) {
|
|
|
379
434
|
}
|
|
380
435
|
async function readAgents() {
|
|
381
436
|
const declaration = deps.agents();
|
|
437
|
+
agentsFrom = JSON.stringify(declaration);
|
|
382
438
|
if (declaration === undefined)
|
|
383
439
|
return;
|
|
384
440
|
const names = new Map();
|
|
@@ -406,14 +462,18 @@ export function createConversationStore(deps) {
|
|
|
406
462
|
break;
|
|
407
463
|
after = read.next;
|
|
408
464
|
}
|
|
465
|
+
agentsKnown = true;
|
|
409
466
|
const named = JSON.stringify([...names]) !== JSON.stringify([...agentNames]);
|
|
410
|
-
if (!named && JSON.stringify([...retired]) === JSON.stringify([...retiredAgents]))
|
|
467
|
+
if (!named && JSON.stringify([...retired]) === JSON.stringify([...retiredAgents])) {
|
|
468
|
+
learned();
|
|
411
469
|
return;
|
|
470
|
+
}
|
|
412
471
|
agentNames = names;
|
|
413
472
|
retiredAgents = retired;
|
|
473
|
+
emitAgents();
|
|
414
474
|
if (named)
|
|
415
475
|
emitList();
|
|
416
|
-
|
|
476
|
+
learned();
|
|
417
477
|
const ended = [...drafts.keys()].filter(retiredChat);
|
|
418
478
|
if (ended.length > 0)
|
|
419
479
|
await remove(ended);
|
|
@@ -501,6 +561,20 @@ export function createConversationStore(deps) {
|
|
|
501
561
|
deps.publish(conversationChangeSet(changed));
|
|
502
562
|
});
|
|
503
563
|
}
|
|
564
|
+
function missed(conversation) {
|
|
565
|
+
const read = reads.get(conversation);
|
|
566
|
+
const newest = listing.get(conversation)?.newest;
|
|
567
|
+
return (read === undefined ||
|
|
568
|
+
newest === undefined ||
|
|
569
|
+
partials.has(conversation) ||
|
|
570
|
+
(newest !== null && (read === null || newest > read)));
|
|
571
|
+
}
|
|
572
|
+
function noted(conversation, message) {
|
|
573
|
+
const entry = listing.get(conversation);
|
|
574
|
+
if (entry === undefined || (entry.newest !== null && entry.newest >= message.position))
|
|
575
|
+
return;
|
|
576
|
+
listing.set(conversation, { ...entry, newest: message.position });
|
|
577
|
+
}
|
|
504
578
|
function gap(conversation) {
|
|
505
579
|
gaps.set(conversation, (gaps.get(conversation) ?? 0) + 1);
|
|
506
580
|
behind.add(conversation);
|
|
@@ -529,11 +603,12 @@ export function createConversationStore(deps) {
|
|
|
529
603
|
}
|
|
530
604
|
async function readHistories(conversations, ended) {
|
|
531
605
|
const generations = new Map(conversations.map((one) => [one, gaps.get(one) ?? 0]));
|
|
532
|
-
let
|
|
606
|
+
let waiting = conversations.map((conversation) => ({
|
|
533
607
|
conversation,
|
|
534
608
|
after: reads.get(conversation) ?? undefined,
|
|
535
609
|
}));
|
|
536
|
-
while (
|
|
610
|
+
while (waiting.length > 0) {
|
|
611
|
+
const asking = waiting.slice(0, HISTORY_CONVERSATIONS);
|
|
537
612
|
const result = await deps.call('conversation.history', {
|
|
538
613
|
conversations: asking.map(({ conversation, after }) => ({
|
|
539
614
|
conversation,
|
|
@@ -557,7 +632,7 @@ export function createConversationStore(deps) {
|
|
|
557
632
|
if (!following.some((next) => next.conversation === conversation))
|
|
558
633
|
ended(conversation);
|
|
559
634
|
}
|
|
560
|
-
|
|
635
|
+
waiting = [...waiting.slice(HISTORY_CONVERSATIONS), ...following];
|
|
561
636
|
}
|
|
562
637
|
return null;
|
|
563
638
|
}
|
|
@@ -648,8 +723,16 @@ export function createConversationStore(deps) {
|
|
|
648
723
|
const arriving = acceptedMessage(event.message);
|
|
649
724
|
if (arriving === null)
|
|
650
725
|
return;
|
|
726
|
+
noted(conversation, arriving);
|
|
651
727
|
if (replicated.has(conversation)) {
|
|
652
|
-
|
|
728
|
+
if (deps.full()) {
|
|
729
|
+
gap(conversation);
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
void keep(conversation, arriving).catch((error) => {
|
|
733
|
+
if (refusedForSpace(error))
|
|
734
|
+
gap(conversation);
|
|
735
|
+
});
|
|
653
736
|
return;
|
|
654
737
|
}
|
|
655
738
|
if (sealTurns(conversation, new Set([arriving.turn])))
|
|
@@ -734,13 +817,14 @@ export function createConversationStore(deps) {
|
|
|
734
817
|
});
|
|
735
818
|
}
|
|
736
819
|
async function dispatched(conversation, submission) {
|
|
737
|
-
const dispatch = {};
|
|
820
|
+
const dispatch = { answered: false };
|
|
738
821
|
sending.set(submission.operation, dispatch);
|
|
739
822
|
try {
|
|
740
823
|
const result = await invoke('conversation.send', conversation, {
|
|
741
824
|
text: submission.text,
|
|
742
825
|
operation_id: submission.operation,
|
|
743
826
|
});
|
|
827
|
+
dispatch.answered = result.kind !== 'transport-uncertainty';
|
|
744
828
|
if (result.kind === 'revoked-authorization')
|
|
745
829
|
return result;
|
|
746
830
|
if (result.kind !== 'action' && result.retryable) {
|
|
@@ -773,7 +857,15 @@ export function createConversationStore(deps) {
|
|
|
773
857
|
const surface = {
|
|
774
858
|
async list() {
|
|
775
859
|
await agentsReady();
|
|
776
|
-
return
|
|
860
|
+
return new Promise((settle) => {
|
|
861
|
+
const answer = (listed) => {
|
|
862
|
+
unlisted.delete(answer);
|
|
863
|
+
listWatchers.delete(answer);
|
|
864
|
+
settle(listed);
|
|
865
|
+
};
|
|
866
|
+
unlisted.add(answer);
|
|
867
|
+
learned();
|
|
868
|
+
});
|
|
777
869
|
},
|
|
778
870
|
async read(conversation, options = {}) {
|
|
779
871
|
const asked = askedOf(options);
|
|
@@ -796,8 +888,17 @@ export function createConversationStore(deps) {
|
|
|
796
888
|
return result;
|
|
797
889
|
},
|
|
798
890
|
async send(conversation, operation = changeBatchIdentity(), draft) {
|
|
891
|
+
if (deps.full())
|
|
892
|
+
return DURABLE_WRITE;
|
|
799
893
|
if (deps.online()) {
|
|
800
|
-
const
|
|
894
|
+
const held = await submitted(conversation, operation, draft).catch((error) => {
|
|
895
|
+
if (refusedForSpace(error))
|
|
896
|
+
return null;
|
|
897
|
+
throw error;
|
|
898
|
+
});
|
|
899
|
+
if (held === null)
|
|
900
|
+
return DURABLE_WRITE;
|
|
901
|
+
const { submission, earlier } = held;
|
|
801
902
|
if (!earlier || !deps.expired(operation))
|
|
802
903
|
return dispatched(conversation, submission);
|
|
803
904
|
await forgotten(conversation, submission);
|
|
@@ -810,15 +911,6 @@ export function createConversationStore(deps) {
|
|
|
810
911
|
}
|
|
811
912
|
return OFFLINE;
|
|
812
913
|
},
|
|
813
|
-
async attach(room, file) {
|
|
814
|
-
if (!deps.online())
|
|
815
|
-
return OFFLINE;
|
|
816
|
-
return deps.call('conversation.attach', {
|
|
817
|
-
room,
|
|
818
|
-
...(await declaredFile(file)),
|
|
819
|
-
blob: file.blob,
|
|
820
|
-
});
|
|
821
|
-
},
|
|
822
914
|
answer(conversation, answer) {
|
|
823
915
|
return invoke('conversation.answer', conversation, { answer });
|
|
824
916
|
},
|
|
@@ -870,7 +962,13 @@ export function createConversationStore(deps) {
|
|
|
870
962
|
return {
|
|
871
963
|
surface,
|
|
872
964
|
chatDraft,
|
|
873
|
-
hydrate(held, kept) {
|
|
965
|
+
hydrate(held, kept, list) {
|
|
966
|
+
if (list !== null && !listKnown) {
|
|
967
|
+
listing.clear();
|
|
968
|
+
for (const entry of list)
|
|
969
|
+
listing.set(entry.conversation, { ...entry });
|
|
970
|
+
listHeld = true;
|
|
971
|
+
}
|
|
874
972
|
stored.clear();
|
|
875
973
|
reads.clear();
|
|
876
974
|
partials.clear();
|
|
@@ -884,6 +982,8 @@ export function createConversationStore(deps) {
|
|
|
884
982
|
drafts.clear();
|
|
885
983
|
for (const record of kept)
|
|
886
984
|
drafts.set(record.conversation, record);
|
|
985
|
+
if (listHeld)
|
|
986
|
+
learned();
|
|
887
987
|
},
|
|
888
988
|
async reconcile() {
|
|
889
989
|
if (!listKnown)
|
|
@@ -895,7 +995,7 @@ export function createConversationStore(deps) {
|
|
|
895
995
|
!creations.has(conversation) &&
|
|
896
996
|
(!conversation.startsWith(NEW_CHAT) || retiredChat(conversation)));
|
|
897
997
|
for (const conversation of named) {
|
|
898
|
-
if (!replicated.has(conversation))
|
|
998
|
+
if (!replicated.has(conversation) && missed(conversation))
|
|
899
999
|
behind.add(conversation);
|
|
900
1000
|
}
|
|
901
1001
|
replicated = named;
|
|
@@ -904,6 +1004,11 @@ export function createConversationStore(deps) {
|
|
|
904
1004
|
await remove(leaving);
|
|
905
1005
|
},
|
|
906
1006
|
async catchUp(progress) {
|
|
1007
|
+
if (deps.full()) {
|
|
1008
|
+
if (behind.size > 0)
|
|
1009
|
+
progress.complete = false;
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
907
1012
|
const owed = (conversation) => behind.has(conversation) && replicated.has(conversation);
|
|
908
1013
|
const read = async (conversations) => {
|
|
909
1014
|
if (conversations.length === 0 || deps.closed())
|
|
@@ -952,12 +1057,10 @@ export function createConversationStore(deps) {
|
|
|
952
1057
|
known() {
|
|
953
1058
|
return listKnown;
|
|
954
1059
|
},
|
|
955
|
-
reconnected() {
|
|
956
|
-
for (const conversation of replicated)
|
|
957
|
-
gap(conversation);
|
|
958
|
-
},
|
|
959
1060
|
reopened() {
|
|
960
|
-
sending
|
|
1061
|
+
for (const [operation, dispatch] of sending)
|
|
1062
|
+
if (!dispatch.answered)
|
|
1063
|
+
sending.delete(operation);
|
|
961
1064
|
},
|
|
962
1065
|
lost() {
|
|
963
1066
|
catching.clear();
|
|
@@ -976,15 +1079,15 @@ export function createConversationStore(deps) {
|
|
|
976
1079
|
views.set(key, view);
|
|
977
1080
|
const watcher = { notify: deliver, ready: false };
|
|
978
1081
|
view.watchers.add(watcher);
|
|
979
|
-
|
|
980
|
-
|
|
1082
|
+
const reading = new AbortController();
|
|
1083
|
+
void untilAnswered(() => deps.durably(async (local) => {
|
|
981
1084
|
if (view.window !== null)
|
|
982
1085
|
return;
|
|
983
1086
|
const { messages, more } = await local.messageWindow(conversation, asked.limit, asked.before);
|
|
984
1087
|
view.window = messages;
|
|
985
1088
|
view.more = more;
|
|
986
1089
|
view.total = asked.total ? await local.messageCount(conversation) : null;
|
|
987
|
-
})
|
|
1090
|
+
}), reading.signal)
|
|
988
1091
|
.then(() => {
|
|
989
1092
|
if (deps.closed() || !view.watchers.has(watcher))
|
|
990
1093
|
return;
|
|
@@ -994,6 +1097,7 @@ export function createConversationStore(deps) {
|
|
|
994
1097
|
})
|
|
995
1098
|
.catch(() => { });
|
|
996
1099
|
return () => {
|
|
1100
|
+
reading.abort();
|
|
997
1101
|
if (!view.watchers.delete(watcher))
|
|
998
1102
|
return;
|
|
999
1103
|
if (view.watchers.size === 0)
|
|
@@ -1001,25 +1105,35 @@ export function createConversationStore(deps) {
|
|
|
1001
1105
|
};
|
|
1002
1106
|
},
|
|
1003
1107
|
watchList(deliver) {
|
|
1004
|
-
|
|
1108
|
+
let ended = false;
|
|
1005
1109
|
void agentsReady().then(() => {
|
|
1006
|
-
if (
|
|
1007
|
-
|
|
1110
|
+
if (ended)
|
|
1111
|
+
return;
|
|
1112
|
+
unlisted.add(deliver);
|
|
1113
|
+
learned();
|
|
1008
1114
|
});
|
|
1009
1115
|
return () => {
|
|
1116
|
+
ended = true;
|
|
1117
|
+
unlisted.delete(deliver);
|
|
1010
1118
|
listWatchers.delete(deliver);
|
|
1011
1119
|
};
|
|
1012
1120
|
},
|
|
1013
1121
|
watchAgents(deliver) {
|
|
1014
|
-
|
|
1015
|
-
void agentsReady().then(
|
|
1016
|
-
if (!deps.closed() && agentWatchers.has(deliver))
|
|
1017
|
-
deliver(agents());
|
|
1018
|
-
});
|
|
1122
|
+
unnamed.add(deliver);
|
|
1123
|
+
void agentsReady().then(learned);
|
|
1019
1124
|
return () => {
|
|
1125
|
+
unnamed.delete(deliver);
|
|
1020
1126
|
agentWatchers.delete(deliver);
|
|
1021
1127
|
};
|
|
1022
1128
|
},
|
|
1129
|
+
learned,
|
|
1130
|
+
declared() {
|
|
1131
|
+
if (JSON.stringify(deps.agents()) === agentsFrom)
|
|
1132
|
+
return;
|
|
1133
|
+
agentsRead = readAgents().catch(() => {
|
|
1134
|
+
agentsRead = null;
|
|
1135
|
+
});
|
|
1136
|
+
},
|
|
1023
1137
|
changed(set) {
|
|
1024
1138
|
for (const conversation of set.conversations)
|
|
1025
1139
|
emit(conversation);
|
|
@@ -1042,6 +1156,14 @@ export function createConversationStore(deps) {
|
|
|
1042
1156
|
creations.delete(entry.conversation);
|
|
1043
1157
|
}
|
|
1044
1158
|
listKnown = true;
|
|
1159
|
+
for (const conversation of replicated) {
|
|
1160
|
+
if (!listing.has(conversation))
|
|
1161
|
+
continue;
|
|
1162
|
+
if (!missed(conversation))
|
|
1163
|
+
behind.delete(conversation);
|
|
1164
|
+
else if (!behind.has(conversation))
|
|
1165
|
+
gap(conversation);
|
|
1166
|
+
}
|
|
1045
1167
|
openingEnded();
|
|
1046
1168
|
}
|
|
1047
1169
|
else if (event.kind === 'listed') {
|
|
@@ -1051,6 +1173,7 @@ export function createConversationStore(deps) {
|
|
|
1051
1173
|
else {
|
|
1052
1174
|
listing.delete(event.conversation);
|
|
1053
1175
|
}
|
|
1176
|
+
keepList();
|
|
1054
1177
|
emitList();
|
|
1055
1178
|
return (event.kind !== 'list' &&
|
|
1056
1179
|
listKnown &&
|
|
@@ -1071,7 +1194,9 @@ export function createConversationStore(deps) {
|
|
|
1071
1194
|
lives.clear();
|
|
1072
1195
|
unsent.clear();
|
|
1073
1196
|
listWatchers.clear();
|
|
1197
|
+
unlisted.clear();
|
|
1074
1198
|
agentWatchers.clear();
|
|
1199
|
+
unnamed.clear();
|
|
1075
1200
|
},
|
|
1076
1201
|
};
|
|
1077
1202
|
}
|
package/dist/durability.d.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import type { Persistence } from './readiness.js';
|
|
2
|
-
export type StorageEstimate = {
|
|
3
|
-
readonly usage: number;
|
|
4
|
-
readonly total: number;
|
|
5
|
-
};
|
|
6
2
|
export type RuntimeShell = {
|
|
7
3
|
persistence: Persistence;
|
|
8
4
|
generation: string | null;
|
|
5
|
+
onScreen: boolean;
|
|
9
6
|
keepGeneration(value: string): void | Promise<void>;
|
|
10
7
|
dropGeneration(): void | Promise<void>;
|
|
11
|
-
estimate?(): Promise<StorageEstimate | null>;
|
|
12
8
|
cleanUp?(): Promise<number>;
|
|
13
9
|
};
|
|
10
|
+
export declare function refusedForSpace(error: unknown): boolean;
|
|
14
11
|
export declare function detectStorageLoss(stored: string | null, reported: string | null): string | null;
|
|
15
12
|
export declare function nextGeneration(stored: string | null, reported: string | null): string;
|
|
16
13
|
//# sourceMappingURL=durability.d.ts.map
|
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;AAIlD,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"durability.d.ts","sourceRoot":"","sources":["../src/durability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,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;CAC7B,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,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAGrF"}
|
package/dist/durability.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
const STORAGE_LOSS_CODE = 'storage-loss';
|
|
2
|
+
export function refusedForSpace(error) {
|
|
3
|
+
return (typeof error === 'object' &&
|
|
4
|
+
error !== null &&
|
|
5
|
+
error.name === 'QuotaExceededError');
|
|
6
|
+
}
|
|
2
7
|
export function detectStorageLoss(stored, reported) {
|
|
3
8
|
if (reported === null || reported === stored)
|
|
4
9
|
return null;
|
package/dist/entry.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export type EntryRoom = {
|
|
|
6
6
|
locator: string;
|
|
7
7
|
schema: string | null;
|
|
8
8
|
documents: Readonly<Record<string, string>>;
|
|
9
|
+
revisions?: Readonly<Record<string, string>>;
|
|
9
10
|
};
|
|
10
11
|
export type EntryArguments = Readonly<Record<string, string>>;
|
|
11
12
|
export type EntryParameterKind = 'string' | 'integer' | 'number' | 'boolean';
|
package/dist/entry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AAA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;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAMpE;AAkCD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAQ7D;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;CACzF,CAAC;AAEF,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,UAAU,GACrB,UAAU,CAmDZ"}
|
package/dist/entry.js
CHANGED
package/dist/file.d.ts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
blob: Blob;
|
|
4
|
-
};
|
|
5
|
-
export type FileDeclaration = {
|
|
6
|
-
name: string;
|
|
7
|
-
mediaType: string;
|
|
8
|
-
byteLength: number;
|
|
9
|
-
contentHash: string;
|
|
10
|
-
};
|
|
11
|
-
export declare function declaredFile(file: ChosenFile): Promise<FileDeclaration>;
|
|
1
|
+
import type { AttachRequest } from './adapter.js';
|
|
2
|
+
export declare function attachedFile(locator: string, file: File): Promise<AttachRequest>;
|
|
12
3
|
//# sourceMappingURL=file.d.ts.map
|
package/dist/file.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,CAStF"}
|
package/dist/file.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { sha256 } from './digest.js';
|
|
2
|
-
export async function
|
|
2
|
+
export async function attachedFile(locator, file) {
|
|
3
3
|
return {
|
|
4
|
+
locator,
|
|
4
5
|
name: file.name,
|
|
5
|
-
mediaType: file.
|
|
6
|
-
byteLength: file.
|
|
7
|
-
|
|
6
|
+
mediaType: file.type,
|
|
7
|
+
byteLength: file.size,
|
|
8
|
+
sha256: await sha256(file),
|
|
9
|
+
blob: file,
|
|
8
10
|
};
|
|
9
11
|
}
|
package/dist/fulltext.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fulltext.d.ts","sourceRoot":"","sources":["../src/fulltext.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,KAAK,EAGV,SAAS,EAET,YAAY,EAEb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,UAAU,EAAS,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"fulltext.d.ts","sourceRoot":"","sources":["../src/fulltext.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,KAAK,EAGV,SAAS,EAET,YAAY,EAEb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,UAAU,EAAS,MAAM,aAAa,CAAC;AAoBrD,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAG1C,CAAC;AAsCF,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ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ath } from './rows.js';
|
|
4
4
|
import { indexed, matchClauses, matched, matchExpression, queryTerms, snippet, } from './words.js';
|
|
5
|
-
const TOKENIZER = "porter unicode61 remove_diacritics 2 categories 'L* N* Co M*'";
|
|
5
|
+
const TOKENIZER = "porter unicode61 remove_diacritics 2 categories 'L* N* Co M* S*' separators '$+<=>^`|~'";
|
|
6
6
|
const CONTENTLESS = `content='', contentless_delete=1, detail=full, tokenize="${TOKENIZER}"`;
|
|
7
7
|
const DOCUMENTS = 'replica_search';
|
|
8
8
|
const MESSAGES = 'conversation_search';
|
|
@@ -242,11 +242,13 @@ function documentsListed(connection, documents) {
|
|
|
242
242
|
if (documents.rooms.length === 0)
|
|
243
243
|
return null;
|
|
244
244
|
const filter = selected(connection, documents.plan, documents.rooms);
|
|
245
|
-
const outside =
|
|
246
|
-
sql:
|
|
247
|
-
bind: [
|
|
248
|
-
|
|
249
|
-
|
|
245
|
+
const outside = {
|
|
246
|
+
sql: "NOT EXISTS (SELECT 1 FROM json_each(?) r WHERE d.key = r.value ->> 0 AND (d.path = r.value ->> 1 OR (d.path >= (r.value ->> 1) || '/' AND d.path < (r.value ->> 1) || '0')))",
|
|
247
|
+
bind: [
|
|
248
|
+
JSON.stringify(documents.beneath.flatMap(({ key, roots }) => roots.map((root) => [key, root]))),
|
|
249
|
+
],
|
|
250
|
+
};
|
|
251
|
+
const conditions = [filter, outside];
|
|
250
252
|
const locators = new Map(documents.rooms.map(({ key, locator }) => [key, locator]));
|
|
251
253
|
return {
|
|
252
254
|
table: DOCUMENTS,
|