@agentshouse/mdruntime 0.1.0-c93103f5357ff → 0.1.0-c94cfdbdb6f68
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/AGENTS.md +194 -194
- package/README.md +8 -8
- package/dist/adapter.d.ts +20 -6
- package/dist/adapter.d.ts.map +1 -1
- package/dist/bootstrap.d.ts +2 -1
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/chat/earlier.d.ts +10 -0
- package/dist/chat/earlier.d.ts.map +1 -0
- package/dist/chat/earlier.js +54 -0
- package/dist/chat/list.d.ts.map +1 -1
- package/dist/chat/list.js +39 -3
- package/dist/chat/provider.d.ts.map +1 -1
- package/dist/chat/provider.js +11 -12
- package/dist/chat/question.d.ts +1 -1
- package/dist/chat/question.d.ts.map +1 -1
- package/dist/chat/question.js +7 -18
- package/dist/chat/style.js +1 -1
- package/dist/client.d.ts +6 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +7 -3
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +64 -34
- package/dist/connection.d.ts +9 -4
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +312 -154
- package/dist/conversation.d.ts +6 -0
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +161 -41
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +2 -1
- package/dist/host.d.ts +0 -3
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +8 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/memory.d.ts +6 -3
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +17 -11
- package/dist/observation.d.ts +2 -0
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +9 -3
- package/dist/outcome.d.ts +8 -2
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +3 -0
- package/dist/query.d.ts +21 -1
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +28 -5
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +13 -0
- package/dist/react.d.ts +1 -2
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +2 -14
- package/dist/read-side.d.ts +3 -1
- package/dist/read-side.d.ts.map +1 -1
- package/dist/read-side.js +251 -69
- package/dist/reads.d.ts +11 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +98 -0
- package/dist/refresh.d.ts +4 -4
- package/dist/refresh.d.ts.map +1 -1
- package/dist/replica.d.ts +5 -1
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +19 -3
- package/dist/rows.d.ts +1 -0
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +5 -0
- package/dist/save.d.ts +1 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +22 -8
- package/dist/search.d.ts +15 -2
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +76 -17
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +18 -4
- package/dist/store.d.ts +16 -2
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +48 -14
- package/dist/turn.d.ts +3 -3
- package/dist/turn.d.ts.map +1 -1
- package/dist/turn.js +11 -5
- package/dist/windows.d.ts +26 -0
- package/dist/windows.d.ts.map +1 -0
- package/dist/windows.js +93 -0
- package/dist/wire.d.ts +16 -0
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +4 -0
- package/package.json +2 -2
- package/dist/acquisition.d.ts +0 -14
- package/dist/acquisition.d.ts.map +0 -1
- package/dist/acquisition.js +0 -24
package/dist/store.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { sameBinary, sameChange } from './overlay.js';
|
|
2
2
|
import { differing } from './shared.js';
|
|
3
|
+
import { precedes } from './windows.js';
|
|
3
4
|
const DATABASE = 'mdruntime';
|
|
4
5
|
const AUTHORED = 'mdruntime-authored';
|
|
5
6
|
const FENCES = 'fences';
|
|
@@ -16,6 +17,7 @@ const PRESENTATION = 'presentation';
|
|
|
16
17
|
const CONVERSATIONS = 'conversations';
|
|
17
18
|
const MESSAGES = 'messages';
|
|
18
19
|
const CHAT_DRAFTS = 'chatDrafts';
|
|
20
|
+
const CALLS = 'calls';
|
|
19
21
|
const QUEUES = 'queues';
|
|
20
22
|
const FACTS = 'facts';
|
|
21
23
|
const CURRENT = 'current';
|
|
@@ -26,12 +28,13 @@ const HOLDER = 'holder';
|
|
|
26
28
|
const BINDING = 'binding';
|
|
27
29
|
export const STORE_SCHEMA = 25;
|
|
28
30
|
const REPLICA_SHAPE = 23;
|
|
29
|
-
export const AUTHORED_SCHEMA =
|
|
31
|
+
export const AUTHORED_SCHEMA = 3;
|
|
30
32
|
const AUTHORED_STORES = [
|
|
31
33
|
[QUEUES, { keyPath: 'locator' }],
|
|
32
34
|
[PENDING_CHANGES, { keyPath: ['locator', 'id'] }],
|
|
33
35
|
[ROOM_DRAFTS, { keyPath: ['locator', 'path'] }],
|
|
34
36
|
[CHAT_DRAFTS, { keyPath: 'conversation' }],
|
|
37
|
+
[CALLS, { keyPath: 'operation' }],
|
|
35
38
|
[FACTS, undefined],
|
|
36
39
|
[FENCES, { keyPath: 'locator' }],
|
|
37
40
|
];
|
|
@@ -338,7 +341,7 @@ export async function openRuntimeStore(fenced) {
|
|
|
338
341
|
}
|
|
339
342
|
return records;
|
|
340
343
|
},
|
|
341
|
-
async keepAuthored({ locator, queue, saved, roomDrafts, consumedRoomDrafts }) {
|
|
344
|
+
async keepAuthored({ locator, queue, founded, saved, roomDrafts, consumedRoomDrafts }) {
|
|
342
345
|
if (fenced(locator))
|
|
343
346
|
return;
|
|
344
347
|
const transaction = authored.transaction([QUEUES, PENDING_CHANGES, ROOM_DRAFTS], 'readwrite');
|
|
@@ -368,6 +371,16 @@ export async function openRuntimeStore(fenced) {
|
|
|
368
371
|
});
|
|
369
372
|
}
|
|
370
373
|
}
|
|
374
|
+
for (const batch of founded ?? []) {
|
|
375
|
+
if (!before.has(batch.id))
|
|
376
|
+
continue;
|
|
377
|
+
const stored = pending.get([locator, batch.id]);
|
|
378
|
+
stored.onsuccess = () => {
|
|
379
|
+
const record = stored.result;
|
|
380
|
+
if (record !== undefined)
|
|
381
|
+
pending.put({ ...record, batch });
|
|
382
|
+
};
|
|
383
|
+
}
|
|
371
384
|
};
|
|
372
385
|
const draftStore = transaction.objectStore(ROOM_DRAFTS);
|
|
373
386
|
for (const path of consumedRoomDrafts ?? [])
|
|
@@ -529,16 +542,12 @@ export async function openRuntimeStore(fenced) {
|
|
|
529
542
|
}
|
|
530
543
|
await completed(transaction);
|
|
531
544
|
},
|
|
532
|
-
async messageWindow(conversation, limit) {
|
|
545
|
+
async messageWindow(conversation, limit, before) {
|
|
533
546
|
const transaction = database.transaction(MESSAGES, 'readonly');
|
|
534
547
|
const index = transaction.objectStore(MESSAGES).index('position');
|
|
535
|
-
const range = IDBKeyRange.bound([conversation], [conversation, []]);
|
|
536
|
-
if (limit === undefined) {
|
|
537
|
-
return (await settled(index.getAll(range))).map(accepted);
|
|
538
|
-
}
|
|
548
|
+
const range = IDBKeyRange.bound([conversation], [conversation, before?.[0] ?? []]);
|
|
539
549
|
const latest = [];
|
|
540
|
-
|
|
541
|
-
return latest;
|
|
550
|
+
let more = false;
|
|
542
551
|
await new Promise((resolve, reject) => {
|
|
543
552
|
const cursor = index.openCursor(range, 'prev');
|
|
544
553
|
cursor.onerror = () => reject(cursor.error);
|
|
@@ -548,14 +557,25 @@ export async function openRuntimeStore(fenced) {
|
|
|
548
557
|
resolve();
|
|
549
558
|
return;
|
|
550
559
|
}
|
|
551
|
-
|
|
552
|
-
if (
|
|
553
|
-
resolve();
|
|
554
|
-
else
|
|
560
|
+
const record = at.value;
|
|
561
|
+
if (!precedes(record, before)) {
|
|
555
562
|
at.continue();
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
if (latest.length === limit) {
|
|
566
|
+
more = true;
|
|
567
|
+
resolve();
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
latest.push(accepted(record));
|
|
571
|
+
at.continue();
|
|
556
572
|
};
|
|
557
573
|
});
|
|
558
|
-
return latest.reverse();
|
|
574
|
+
return { messages: latest.reverse(), more };
|
|
575
|
+
},
|
|
576
|
+
async messageCount(conversation) {
|
|
577
|
+
const transaction = database.transaction(MESSAGES, 'readonly');
|
|
578
|
+
return settled(transaction.objectStore(MESSAGES).index('conversation').count(conversation));
|
|
559
579
|
},
|
|
560
580
|
async messagesAfter(conversation, identity) {
|
|
561
581
|
const transaction = database.transaction(MESSAGES, 'readonly');
|
|
@@ -608,6 +628,20 @@ export async function openRuntimeStore(fenced) {
|
|
|
608
628
|
transaction.objectStore(CHAT_DRAFTS).delete(conversation);
|
|
609
629
|
await completed(transaction);
|
|
610
630
|
},
|
|
631
|
+
async calls() {
|
|
632
|
+
const transaction = authored.transaction(CALLS, 'readonly');
|
|
633
|
+
return settled(transaction.objectStore(CALLS).getAll());
|
|
634
|
+
},
|
|
635
|
+
async keepCall(record) {
|
|
636
|
+
const transaction = authored.transaction(CALLS, 'readwrite');
|
|
637
|
+
transaction.objectStore(CALLS).put(record);
|
|
638
|
+
await completed(transaction);
|
|
639
|
+
},
|
|
640
|
+
async dropCall(operation) {
|
|
641
|
+
const transaction = authored.transaction(CALLS, 'readwrite');
|
|
642
|
+
transaction.objectStore(CALLS).delete(operation);
|
|
643
|
+
await completed(transaction);
|
|
644
|
+
},
|
|
611
645
|
async keepRoomDraft(record) {
|
|
612
646
|
if (fenced(record.locator))
|
|
613
647
|
return;
|
package/dist/turn.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare function yielded(): Promise<void>;
|
|
2
2
|
export declare const ROW_WEIGHT = 256;
|
|
3
3
|
export type Later<T> = T | Promise<T>;
|
|
4
|
-
export declare function after<T, R>(value: Later<T>, next: (value: T) => R): Later<R>;
|
|
5
|
-
export declare function inUnits<T>(items: Iterable<T>, each: (item: T) => number): Later<void>;
|
|
6
|
-
export declare function inChunks<T>(items: readonly T[], weigh: (item: T) => number, each: (chunk: readonly T[]) => void): Promise<void>;
|
|
4
|
+
export declare function after<T, R>(value: Later<T>, next: (value: T) => Later<R>): Later<R>;
|
|
5
|
+
export declare function inUnits<T>(items: Iterable<T>, each: (item: T) => number, ended?: () => void): Later<void>;
|
|
6
|
+
export declare function inChunks<T>(items: readonly T[], weigh: (item: T) => number, each: (chunk: readonly T[]) => Later<void>): Promise<void>;
|
|
7
7
|
//# sourceMappingURL=turn.d.ts.map
|
package/dist/turn.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turn.d.ts","sourceRoot":"","sources":["../src/turn.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CASvC;AAID,eAAO,MAAM,UAAU,MAAM,CAAC;AAE9B,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAEtC,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"turn.d.ts","sourceRoot":"","sources":["../src/turn.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CASvC;AAID,eAAO,MAAM,UAAU,MAAM,CAAC;AAE9B,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAEtC,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAEnF;AAmBD,wBAAgB,OAAO,CAAC,CAAC,EACvB,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAClB,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,EACzB,KAAK,GAAE,MAAM,IAAe,GAC3B,KAAK,CAAC,IAAI,CAAC,CAWb;AAED,wBAAsB,QAAQ,CAAC,CAAC,EAC9B,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,EAC1B,IAAI,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,KAAK,KAAK,CAAC,IAAI,CAAC,GACzC,OAAO,CAAC,IAAI,CAAC,CAUf"}
|
package/dist/turn.js
CHANGED
|
@@ -13,7 +13,7 @@ export const ROW_WEIGHT = 256;
|
|
|
13
13
|
export function after(value, next) {
|
|
14
14
|
return value instanceof Promise ? value.then(next) : next(value);
|
|
15
15
|
}
|
|
16
|
-
async function resumed(iterator, each) {
|
|
16
|
+
async function resumed(iterator, each, ended) {
|
|
17
17
|
let spent = UNIT;
|
|
18
18
|
for (let next = iterator.next(); next.done !== true; next = iterator.next()) {
|
|
19
19
|
if (spent >= UNIT) {
|
|
@@ -21,16 +21,22 @@ async function resumed(iterator, each) {
|
|
|
21
21
|
spent = 0;
|
|
22
22
|
}
|
|
23
23
|
spent += each(next.value);
|
|
24
|
+
if (spent >= UNIT)
|
|
25
|
+
ended();
|
|
24
26
|
}
|
|
27
|
+
ended();
|
|
25
28
|
}
|
|
26
|
-
export function inUnits(items, each) {
|
|
29
|
+
export function inUnits(items, each, ended = () => { }) {
|
|
27
30
|
const iterator = items[Symbol.iterator]();
|
|
28
31
|
let spent = 0;
|
|
29
32
|
for (let next = iterator.next(); next.done !== true; next = iterator.next()) {
|
|
30
33
|
spent += each(next.value);
|
|
31
|
-
if (spent >= UNIT)
|
|
32
|
-
|
|
34
|
+
if (spent >= UNIT) {
|
|
35
|
+
ended();
|
|
36
|
+
return resumed(iterator, each, ended);
|
|
37
|
+
}
|
|
33
38
|
}
|
|
39
|
+
ended();
|
|
34
40
|
}
|
|
35
41
|
export async function inChunks(items, weigh, each) {
|
|
36
42
|
for (let at = 0; at < items.length;) {
|
|
@@ -40,6 +46,6 @@ export async function inChunks(items, weigh, each) {
|
|
|
40
46
|
chunk.push(items[at]);
|
|
41
47
|
spent += weigh(items[at]);
|
|
42
48
|
}
|
|
43
|
-
each(chunk);
|
|
49
|
+
await each(chunk);
|
|
44
50
|
}
|
|
45
51
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const MAXIMUM_WINDOW = 1000;
|
|
2
|
+
export declare const FROM_START = "[]";
|
|
3
|
+
export declare function capped(limit: number | null | undefined): number;
|
|
4
|
+
export type Ordering = {
|
|
5
|
+
readonly direction: 'asc' | 'desc';
|
|
6
|
+
readonly nulls: 'first' | 'last';
|
|
7
|
+
readonly stringSort: 'lexical' | 'locale';
|
|
8
|
+
readonly locale: string | undefined;
|
|
9
|
+
readonly localeOptions: Intl.CollatorOptions | undefined;
|
|
10
|
+
};
|
|
11
|
+
export type Windowed<T> = {
|
|
12
|
+
readonly kept: readonly T[];
|
|
13
|
+
readonly next: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
interface Placed {
|
|
16
|
+
readonly position: string;
|
|
17
|
+
readonly identity: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function messageOrder(left: Placed, right: Placed): number;
|
|
20
|
+
export declare function precedes(message: Placed, before: readonly [string, string] | null): boolean;
|
|
21
|
+
export declare function beyond(values: readonly unknown[], cursor: readonly unknown[], orderings: readonly Ordering[]): boolean;
|
|
22
|
+
export declare function cursorOf(values: readonly unknown[]): string;
|
|
23
|
+
export declare function decodedCursor(text: string): readonly unknown[] | null;
|
|
24
|
+
export declare function windowed<T>(entries: readonly T[], limit: number | null, after: string | undefined, cursor: (entry: T) => string): Windowed<T>;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=windows.d.ts.map
|
|
@@ -0,0 +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AED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,GAAG,MAAM,CAE3D;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,OAAO,EAAE,GAAG,IAAI,CAOrE;AAED,wBAAgB,QAAQ,CAAC,CAAC,EACxB,OAAO,EAAE,SAAS,CAAC,EAAE,EACrB,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,GAC3B,QAAQ,CAAC,CAAC,CAAC,CAOb"}
|
package/dist/windows.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export const MAXIMUM_WINDOW = 1000;
|
|
2
|
+
export const FROM_START = '[]';
|
|
3
|
+
export function capped(limit) {
|
|
4
|
+
return limit == null ? MAXIMUM_WINDOW : Math.min(limit, MAXIMUM_WINDOW);
|
|
5
|
+
}
|
|
6
|
+
export function messageOrder(left, right) {
|
|
7
|
+
if (left.position !== right.position)
|
|
8
|
+
return left.position < right.position ? -1 : 1;
|
|
9
|
+
if (left.identity !== right.identity)
|
|
10
|
+
return left.identity < right.identity ? -1 : 1;
|
|
11
|
+
return 0;
|
|
12
|
+
}
|
|
13
|
+
export function precedes(message, before) {
|
|
14
|
+
return before === null || messageOrder(message, { position: before[0], identity: before[1] }) < 0;
|
|
15
|
+
}
|
|
16
|
+
function ascending(left, right, ordering) {
|
|
17
|
+
if (left == null && right == null)
|
|
18
|
+
return 0;
|
|
19
|
+
if (left == null)
|
|
20
|
+
return ordering.nulls === 'first' ? -1 : 1;
|
|
21
|
+
if (right == null)
|
|
22
|
+
return ordering.nulls === 'first' ? 1 : -1;
|
|
23
|
+
if (typeof left === 'string' && typeof right === 'string' && ordering.stringSort === 'locale') {
|
|
24
|
+
return left.localeCompare(right, ordering.locale, ordering.localeOptions);
|
|
25
|
+
}
|
|
26
|
+
if (Array.isArray(left) && Array.isArray(right)) {
|
|
27
|
+
for (let at = 0; at < Math.min(left.length, right.length); at += 1) {
|
|
28
|
+
const result = ascending(left[at], right[at], ordering);
|
|
29
|
+
if (result !== 0)
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
return left.length - right.length;
|
|
33
|
+
}
|
|
34
|
+
if (typeof left === 'object')
|
|
35
|
+
return typeof right === 'object' ? 0 : 1;
|
|
36
|
+
if (typeof right === 'object')
|
|
37
|
+
return -1;
|
|
38
|
+
const held = left;
|
|
39
|
+
const other = right;
|
|
40
|
+
if (held < other)
|
|
41
|
+
return -1;
|
|
42
|
+
if (held > other)
|
|
43
|
+
return 1;
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
function compared(left, right, ordering) {
|
|
47
|
+
if (ordering.direction === 'asc')
|
|
48
|
+
return ascending(left, right, ordering);
|
|
49
|
+
return ascending(right, left, {
|
|
50
|
+
...ordering,
|
|
51
|
+
nulls: ordering.nulls === 'first' ? 'last' : 'first',
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function keyCompared(left, right) {
|
|
55
|
+
if (typeof left !== typeof right)
|
|
56
|
+
return typeof left === 'string' ? -1 : 1;
|
|
57
|
+
const held = left;
|
|
58
|
+
const other = right;
|
|
59
|
+
if (held < other)
|
|
60
|
+
return -1;
|
|
61
|
+
if (held > other)
|
|
62
|
+
return 1;
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
export function beyond(values, cursor, orderings) {
|
|
66
|
+
for (let at = 0; at < orderings.length; at += 1) {
|
|
67
|
+
const result = compared(values[at], cursor[at], orderings[at]);
|
|
68
|
+
if (result !== 0)
|
|
69
|
+
return result > 0;
|
|
70
|
+
}
|
|
71
|
+
return keyCompared(values[orderings.length], cursor[orderings.length]) > 0;
|
|
72
|
+
}
|
|
73
|
+
export function cursorOf(values) {
|
|
74
|
+
return JSON.stringify(values);
|
|
75
|
+
}
|
|
76
|
+
export function decodedCursor(text) {
|
|
77
|
+
try {
|
|
78
|
+
const decoded = JSON.parse(text);
|
|
79
|
+
return Array.isArray(decoded) ? decoded : null;
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export function windowed(entries, limit, after, cursor) {
|
|
86
|
+
if (limit === null || entries.length <= limit)
|
|
87
|
+
return { kept: entries, next: undefined };
|
|
88
|
+
const kept = entries.slice(0, limit);
|
|
89
|
+
return {
|
|
90
|
+
kept,
|
|
91
|
+
next: kept.length === 0 ? (after ?? FROM_START) : cursor(kept[kept.length - 1]),
|
|
92
|
+
};
|
|
93
|
+
}
|
package/dist/wire.d.ts
CHANGED
|
@@ -34,6 +34,10 @@ declare const MEMBERS: {
|
|
|
34
34
|
readonly reach: 'within';
|
|
35
35
|
readonly effect: 'write';
|
|
36
36
|
};
|
|
37
|
+
readonly saveParts: {
|
|
38
|
+
readonly reach: 'within';
|
|
39
|
+
readonly effect: 'write';
|
|
40
|
+
};
|
|
37
41
|
readonly history: {
|
|
38
42
|
readonly reach: 'within';
|
|
39
43
|
readonly effect: 'read';
|
|
@@ -42,6 +46,10 @@ declare const MEMBERS: {
|
|
|
42
46
|
readonly reach: 'within';
|
|
43
47
|
readonly effect: 'read';
|
|
44
48
|
};
|
|
49
|
+
readonly 'binaryFile.link': {
|
|
50
|
+
readonly reach: 'within';
|
|
51
|
+
readonly effect: 'read';
|
|
52
|
+
};
|
|
45
53
|
readonly 'binaryFile.readReference': {
|
|
46
54
|
readonly reach: 'within';
|
|
47
55
|
readonly effect: 'read';
|
|
@@ -94,6 +102,10 @@ declare const MEMBERS: {
|
|
|
94
102
|
readonly reach: 'app';
|
|
95
103
|
readonly effect: 'write';
|
|
96
104
|
};
|
|
105
|
+
readonly 'presentation.edit': {
|
|
106
|
+
readonly reach: 'app';
|
|
107
|
+
readonly effect: 'write';
|
|
108
|
+
};
|
|
97
109
|
readonly 'conversation.list': {
|
|
98
110
|
readonly reach: 'within';
|
|
99
111
|
readonly effect: 'read';
|
|
@@ -134,6 +146,10 @@ declare const MEMBERS: {
|
|
|
134
146
|
readonly reach: 'within';
|
|
135
147
|
readonly effect: 'write';
|
|
136
148
|
};
|
|
149
|
+
readonly 'chatDraft.prepend': {
|
|
150
|
+
readonly reach: 'within';
|
|
151
|
+
readonly effect: 'write';
|
|
152
|
+
};
|
|
137
153
|
readonly 'chatDraft.discard': {
|
|
138
154
|
readonly reach: 'within';
|
|
139
155
|
readonly effect: 'write';
|
package/dist/wire.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../src/wire.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACpC,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,GAAG,IAAI,CAAC;IACjG,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAE3E,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAErD,MAAM,MAAM,QAAQ,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC;AAElF,QAAA,MAAM,OAAO;;iBACF,KAAK,EAAE,QAAQ;iBAAE,MAAM,EAAE,MAAM;;;iBAC/B,KAAK,EAAE,QAAQ;iBAAE,M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
8
|
+
saveParts: { reach: 'within', effect: 'write' },
|
|
8
9
|
history: { reach: 'within', effect: 'read' },
|
|
9
10
|
'binaryFile.read': { reach: 'within', effect: 'read' },
|
|
11
|
+
'binaryFile.link': { reach: 'within', effect: 'read' },
|
|
10
12
|
'binaryFile.readReference': { reach: 'within', effect: 'read' },
|
|
11
13
|
call: { reach: 'actions', effect: 'action' },
|
|
12
14
|
reached: { reach: 'within', effect: 'read' },
|
|
@@ -20,6 +22,7 @@ const MEMBERS = {
|
|
|
20
22
|
'roomDraft.discard': { reach: 'within', effect: 'write' },
|
|
21
23
|
'presentation.read': { reach: 'app', effect: 'read' },
|
|
22
24
|
'presentation.write': { reach: 'app', effect: 'write' },
|
|
25
|
+
'presentation.edit': { reach: 'app', effect: 'write' },
|
|
23
26
|
'conversation.list': { reach: 'within', effect: 'read' },
|
|
24
27
|
'conversation.read': { reach: 'within', effect: 'read' },
|
|
25
28
|
'conversation.create': { reach: 'within', effect: 'action' },
|
|
@@ -30,6 +33,7 @@ const MEMBERS = {
|
|
|
30
33
|
'conversation.cancel': { reach: 'within', effect: 'action' },
|
|
31
34
|
'conversation.delete': { reach: 'within', effect: 'action' },
|
|
32
35
|
'chatDraft.write': { reach: 'within', effect: 'write' },
|
|
36
|
+
'chatDraft.prepend': { reach: 'within', effect: 'write' },
|
|
33
37
|
'chatDraft.discard': { reach: 'within', effect: 'write' },
|
|
34
38
|
};
|
|
35
39
|
const TOPICS = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentshouse/mdruntime",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-c94cfdbdb6f68",
|
|
4
4
|
"description": "The headless core of MD App",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"LICENSE"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@agentshouse/mdmodel": "0.1.0-
|
|
52
|
+
"@agentshouse/mdmodel": "0.1.0-ccf1367190878",
|
|
53
53
|
"@assistant-ui/react-markdown": "0.14.20",
|
|
54
54
|
"@tanstack/db": "0.9.2",
|
|
55
55
|
"lucide-react": "1.47.0",
|
package/dist/acquisition.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export type RuntimeDemand = {
|
|
2
|
-
readonly whole: boolean;
|
|
3
|
-
readonly rooms: readonly string[];
|
|
4
|
-
readonly handles: readonly string[];
|
|
5
|
-
readonly conversations: boolean;
|
|
6
|
-
};
|
|
7
|
-
export declare const WHOLE_DEMAND: RuntimeDemand;
|
|
8
|
-
export declare function demanded(demand: RuntimeDemand, room: {
|
|
9
|
-
readonly locator: string;
|
|
10
|
-
readonly handle: string;
|
|
11
|
-
}): boolean;
|
|
12
|
-
export declare function wider(next: RuntimeDemand, current: RuntimeDemand): boolean;
|
|
13
|
-
export declare function narrower(next: RuntimeDemand, current: RuntimeDemand): boolean;
|
|
14
|
-
//# sourceMappingURL=acquisition.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acquisition.d.ts","sourceRoot":"","sources":["../src/acquisition.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,aAK1B,CAAC;AAEF,wBAAgB,QAAQ,CACtB,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC1D,OAAO,CAIT;AAYD,wBAAgB,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAE1E;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAE7E"}
|
package/dist/acquisition.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export const WHOLE_DEMAND = {
|
|
2
|
-
whole: true,
|
|
3
|
-
rooms: [],
|
|
4
|
-
handles: [],
|
|
5
|
-
conversations: true,
|
|
6
|
-
};
|
|
7
|
-
export function demanded(demand, room) {
|
|
8
|
-
return (demand.whole || demand.rooms.includes(room.locator) || demand.handles.includes(room.handle));
|
|
9
|
-
}
|
|
10
|
-
function adds(next, current) {
|
|
11
|
-
if (current.whole)
|
|
12
|
-
return false;
|
|
13
|
-
if (next.whole)
|
|
14
|
-
return true;
|
|
15
|
-
return ((next.conversations && !current.conversations) ||
|
|
16
|
-
next.rooms.some((room) => !current.rooms.includes(room)) ||
|
|
17
|
-
next.handles.some((handle) => !current.handles.includes(handle)));
|
|
18
|
-
}
|
|
19
|
-
export function wider(next, current) {
|
|
20
|
-
return adds(next, current);
|
|
21
|
-
}
|
|
22
|
-
export function narrower(next, current) {
|
|
23
|
-
return adds(current, next);
|
|
24
|
-
}
|