@agentshouse/mdruntime 0.1.0-ca2c50e56e0b8 → 0.1.0-ca3e1879aff32
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/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +25 -5
- package/dist/adapter.d.ts +27 -9
- 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/authored.d.ts.map +1 -1
- package/dist/authored.js +2 -0
- package/dist/binary.d.ts +2 -2
- package/dist/binary.js +1 -1
- 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 +2 -2
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +9 -9
- package/dist/collection.d.ts +1 -0
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +7 -1
- package/dist/compile.d.ts +2 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +70 -38
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +2 -0
- package/dist/conversation.d.ts +8 -2
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +5 -3
- package/dist/entry.d.ts +10 -3
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +52 -24
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +12 -12
- package/dist/house-query.d.ts +8 -2
- package/dist/house-query.d.ts.map +1 -1
- package/dist/house-query.js +52 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/live.d.ts +14 -0
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +29 -12
- package/dist/media.js +3 -3
- package/dist/memory.d.ts +2 -2
- package/dist/memory.js +5 -5
- package/dist/outcome.js +1 -1
- package/dist/overlay.d.ts +3 -3
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +54 -11
- package/dist/query.d.ts +2 -2
- package/dist/reach.js +9 -9
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +2 -1
- package/dist/reference-forms.d.ts +4 -0
- package/dist/reference-forms.d.ts.map +1 -0
- package/dist/reference-forms.js +74 -0
- package/dist/refresh.d.ts +1 -1
- package/dist/refresh.js +4 -4
- package/dist/replica.js +2 -2
- package/dist/rows.d.ts +9 -1
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +18 -4
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +6 -6
- package/dist/saves.d.ts +2 -2
- package/dist/saves.d.ts.map +1 -1
- package/dist/saves.js +14 -8
- package/dist/selector.d.ts +3 -0
- package/dist/selector.d.ts.map +1 -0
- package/dist/selector.js +22 -0
- package/dist/source.d.ts +2 -0
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +2 -0
- package/dist/store/records.d.ts +4 -2
- package/dist/store/records.d.ts.map +1 -1
- package/dist/store/records.js +8 -2
- package/dist/stored.d.ts +7 -0
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +33 -11
- package/dist/surface.d.ts +2 -2
- package/dist/surface.js +2 -2
- package/dist/sync.js +1 -1
- package/dist/tables.d.ts +14 -2
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +10 -3
- package/dist/validation.d.ts +2 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +49 -3
- package/dist/wire.d.ts +6 -6
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +6 -6
- package/package.json +3 -3
package/dist/house-query.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { invalid, known, plain } from '@agentshouse/mdmodel';
|
|
2
2
|
import { listedOrHeld } from './listing.js';
|
|
3
|
+
import { normalize } from './paths.js';
|
|
3
4
|
import { failure, OFFLINE, UNCERTAIN, undeclared } from './outcome.js';
|
|
4
5
|
import { askedOnline, offline } from './online.js';
|
|
5
6
|
import { holds, queriedOnly } from './reach.js';
|
|
7
|
+
import { documentKey } from './rows.js';
|
|
6
8
|
const HELD_ON_DEVICE = {
|
|
7
9
|
kind: 'rejected',
|
|
8
10
|
code: 'held-on-device',
|
|
@@ -20,25 +22,71 @@ function freshOf(options) {
|
|
|
20
22
|
invalid('fresh', 'expects true or false');
|
|
21
23
|
return fresh;
|
|
22
24
|
}
|
|
23
|
-
function
|
|
25
|
+
function viewOf(query) {
|
|
26
|
+
known(query, ['path', 'after'], '');
|
|
27
|
+
const { path, after } = query;
|
|
28
|
+
if (typeof path !== 'string' || path === '' || normalize(path) !== path)
|
|
29
|
+
invalid('path', 'names a View by its Path in the Room');
|
|
30
|
+
if (after === undefined)
|
|
31
|
+
return { path };
|
|
32
|
+
if (typeof after !== 'string')
|
|
33
|
+
invalid('after', 'expects the next an earlier page answered');
|
|
34
|
+
return { path, after };
|
|
35
|
+
}
|
|
36
|
+
function followedOf(reach) {
|
|
37
|
+
if (reach === null)
|
|
38
|
+
return {};
|
|
39
|
+
const whole = new Set([
|
|
40
|
+
...reach.rooms,
|
|
41
|
+
...(reach.queriesOnly ?? []).map(({ locator }) => locator),
|
|
42
|
+
]);
|
|
43
|
+
const documents = new Map(reach.documents
|
|
44
|
+
.filter(({ room }) => !whole.has(room))
|
|
45
|
+
.map(({ room, path }) => [documentKey(room, path), { room, path }]));
|
|
46
|
+
const followed = new Set([...whole, ...[...documents.values()].map(({ room }) => room)]);
|
|
47
|
+
const areas = new Map((reach.areas ?? [])
|
|
48
|
+
.filter(({ room }) => followed.has(room))
|
|
49
|
+
.map(({ room, path, open }) => [
|
|
50
|
+
documentKey(room, path),
|
|
51
|
+
{ room, path, open: [...new Set(open)].sort() },
|
|
52
|
+
]));
|
|
53
|
+
return {
|
|
54
|
+
follows: [
|
|
55
|
+
...[...whole].sort(),
|
|
56
|
+
...[...documents.keys()].sort().map((key) => documents.get(key)),
|
|
57
|
+
...[...areas.keys()].sort().map((key) => areas.get(key)),
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function houseQueryOf(input, options, reach) {
|
|
24
62
|
if (!plain(input))
|
|
25
63
|
invalid('query', 'expects a query object');
|
|
26
64
|
const { rooms, ...query } = input;
|
|
27
65
|
if (!Array.isArray(rooms) || rooms.length !== 1 || typeof rooms[0] !== 'string')
|
|
28
66
|
invalid('rooms', 'names the one Room House answers');
|
|
29
|
-
|
|
67
|
+
const asked = { room: rooms[0], fresh: freshOf(options), ...followedOf(reach) };
|
|
68
|
+
return query.path === undefined ? { ...asked, query } : { ...asked, ...viewOf(query) };
|
|
30
69
|
}
|
|
31
70
|
async function heldHere(runtime, reach, room) {
|
|
32
71
|
return holds(reach, room) && listedOrHeld(runtime, await runtime.store.rooms([room]), room);
|
|
33
72
|
}
|
|
73
|
+
async function searchListed(runtime, room) {
|
|
74
|
+
const { roomList } = await (await runtime.store.open()).facts(['roomList']);
|
|
75
|
+
return roomList?.rooms.some((one) => one.room_ref === room && one.level === 'search') === true;
|
|
76
|
+
}
|
|
77
|
+
async function queriedHere(runtime, reach, room) {
|
|
78
|
+
if (queriedOnly(reach, runtime.socket.session.now().queriesOnly, room))
|
|
79
|
+
return true;
|
|
80
|
+
return reach === null && (await searchListed(runtime, room));
|
|
81
|
+
}
|
|
34
82
|
export async function queriedHouse(runtime, input, reach, options) {
|
|
35
83
|
const { socket } = runtime;
|
|
36
|
-
const asked = houseQueryOf(input, options);
|
|
84
|
+
const asked = houseQueryOf(input, options, reach);
|
|
37
85
|
await socket.ready;
|
|
38
86
|
const query = socket.queryHouse();
|
|
39
87
|
if (query === undefined)
|
|
40
88
|
return undeclared('queryHouse');
|
|
41
|
-
if (!
|
|
89
|
+
if (!(await queriedHere(runtime, reach, asked.room))) {
|
|
42
90
|
return (await heldHere(runtime, reach, asked.room))
|
|
43
91
|
? HELD_ON_DEVICE
|
|
44
92
|
: failure({ kind: 'room-not-readable', locator: asked.room });
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export type { AcceptedMessage, AcceptedRoom, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, AttachRequest, AttachResult, AuthorityChange, Authorization, BinaryCopy,
|
|
1
|
+
export type { AcceptedMessage, AcceptedRoom, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, AttachRequest, AttachResult, AuthorityChange, Authorization, BinaryCopy, Attachment, BinaryLinkResult, BinaryRequest, BinaryResult, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, SavedFacts, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, BootstrapPart, NotReady, HeldRoom, KeyedRequest, AgentEnvironment, ListedAgent, ListedConversation, ListedOwner, ListedSpaceRef, RoomList, RoomListEntry, SpaceListEntry, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomChange, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, HouseQueryAnswer, HouseQueryAsk, HouseQueryGroups, HouseQueryRows, SearchAnswer, SearchAsk, ServiceMode, ServiceModeSignal, TransportUncertainty, TurnOperation, TypedPath, TypedSelection, } from './adapter.js';
|
|
2
2
|
export type { Change, ChangeBatch, Precondition, RoomMove, WrittenBy } from './change.js';
|
|
3
3
|
export { heldFacts } from './conversation-row.js';
|
|
4
4
|
export type { ConversationAsk, ConversationHeld, ConversationLast, ConversationStart, } from './conversation-row.js';
|
|
5
|
-
export type { ChatDraft, ChatDraftSurface, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationRead, ConversationState, ConversationSurface, ConversationView, RequestDecision, RunningTurn, } from './conversation.js';
|
|
5
|
+
export type { ChatDraft, ChatDraftSurface, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationRead, ConversationSettings, ConversationState, ConversationSurface, ConversationView, RequestDecision, RunningTurn, } from './conversation.js';
|
|
6
6
|
export type { MdRuntimeOptions } from './connection.js';
|
|
7
7
|
export { PAGE_METADATA_WORDS } from './page-metadata.js';
|
|
8
8
|
export { writeRule, type WriteRefusal } from './declaration.js';
|
|
@@ -10,14 +10,14 @@ export type { HistoryQuery } from './actions.js';
|
|
|
10
10
|
export type { AppRoom, AppTypedSelection } from './listing.js';
|
|
11
11
|
export type { ConnectionRefusal, ConnectionRefusalCode } from './socket.js';
|
|
12
12
|
export type { MdRuntime, RoomSchemas } from './surface.js';
|
|
13
|
-
export type {
|
|
13
|
+
export type { AttachmentSurface, SavedParts, SavedRoomDraft, SaveResult } from './saves.js';
|
|
14
14
|
export type { Observation } from './observation.js';
|
|
15
15
|
export type { DayFigures, Figures, FiguresResult, RoomFigures } from './figures.js';
|
|
16
16
|
export type { HeldApp, Holdings, RoomDocuments } from './holdings.js';
|
|
17
17
|
export type { PresentationSurface, RoomDraftSurface } from './room-drafts.js';
|
|
18
18
|
export type { AttachAnswer, BinaryAnswer, BinaryLinkAnswer, CallResult, ShownAnswer, ConversationAttachAnswer, DownloadAnswer, Failure, HistoryAnswer, Offline, QueueEntry, Resolution, Submission, } from './outcome.js';
|
|
19
19
|
export { blobOf, declaredType } from './outcome.js';
|
|
20
|
-
export type {
|
|
20
|
+
export type { AttachmentRecord } from './binary.js';
|
|
21
21
|
export type { RuntimeError } from './failure.js';
|
|
22
22
|
export { refusalError } from './failure.js';
|
|
23
23
|
export type { ChangedPart, FieldValue, Marks, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, TextParts, } from './room-draft.js';
|
|
@@ -38,6 +38,7 @@ export { changeBatchIdentity } from './identity.js';
|
|
|
38
38
|
export { paced, ROW_WEIGHT, stepped } from './turn.js';
|
|
39
39
|
export { authoredAt, covered } from './paths.js';
|
|
40
40
|
export { untilAnswered } from './recovery.js';
|
|
41
|
+
export { selectorRewritten } from './selector.js';
|
|
41
42
|
export { createRetries, STEPS, retrying, Unanswered, uncertainError, type RetriedFailure, type Retries, type Step, } from './retried.js';
|
|
42
43
|
export { patching } from './shared.js';
|
|
43
44
|
export { acting, type Acting, type ActingRules, type Ended, type Lane, type LaneShown, type Send, } from './act-lanes.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,YAAY,EACZ,eAAe,EACf,aAAa,EACb,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,UAAU,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,QAAQ,EACR,aAAa,EACb,cAAc,EACd,eAAe,EACf,MAAM,EACN,eAAe,EACf,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,UAAU,EACV,UAAU,EACV,eAAe,EACf,UAAU,EACV,eAAe,EACf,aAAa,EACb,gBAAgB,E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AW,EACX,SAAS,EACT,eAAe,EACf,YAAY,EACZ,eAAe,EACf,KAAK,EACL,cAAc,GACf,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EACV,SAAS,EACT,aAAa,EACb,MAAM,EACN,QAAQ,EACR,UAAU,EACV,UAAU,EACV,WAAW,EACX,GAAG,EACH,UAAU,EACV,YAAY,EACZ,SAAS,EACT,OAAO,EACP,MAAM,EACN,KAAK,EACL,KAAK,GACN,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,MAAM,EACN,QAAQ,EACR,WAAW,EACX,cAAc,EACd,WAAW,EACX,UAAU,EACV,aAAa,EACb,WAAW,EACX,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,SAAS,GACV,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,YAAY,EACZ,eAAe,EACf,aAAa,EACb,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAA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B,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export { changeBatchIdentity } from './identity.js';
|
|
|
17
17
|
export { paced, ROW_WEIGHT, stepped } from './turn.js';
|
|
18
18
|
export { authoredAt, covered } from './paths.js';
|
|
19
19
|
export { untilAnswered } from './recovery.js';
|
|
20
|
+
export { selectorRewritten } from './selector.js';
|
|
20
21
|
export { createRetries, STEPS, retrying, Unanswered, uncertainError, } from './retried.js';
|
|
21
22
|
export { patching } from './shared.js';
|
|
22
23
|
export { acting, } from './act-lanes.js';
|
package/dist/live.d.ts
CHANGED
|
@@ -3,12 +3,25 @@ import { type KeyedResult, type QueryMessage } from './observation.js';
|
|
|
3
3
|
import type { PendingResult, PendingRoom, Plan, QueryCoverage } from './query.js';
|
|
4
4
|
import type { Fail } from './reach.js';
|
|
5
5
|
import type { QueryRoom } from './tables.js';
|
|
6
|
+
export type AwaitedRoom = PendingRoom & {
|
|
7
|
+
readonly handle: string;
|
|
8
|
+
};
|
|
9
|
+
export type Follows = {
|
|
10
|
+
readonly held: readonly QueryRoom[];
|
|
11
|
+
readonly awaiting: readonly AwaitedRoom[];
|
|
12
|
+
};
|
|
13
|
+
export type Covered = {
|
|
14
|
+
coverage: QueryCoverage;
|
|
15
|
+
rooms: readonly QueryRoom[];
|
|
16
|
+
} | PendingResult;
|
|
6
17
|
export type Cover = {
|
|
7
18
|
coverage: QueryCoverage;
|
|
8
19
|
rooms: readonly QueryRoom[];
|
|
20
|
+
follows: Follows;
|
|
9
21
|
} | PendingResult;
|
|
10
22
|
export type Ran = KeyedResult & {
|
|
11
23
|
readonly current: () => boolean;
|
|
24
|
+
readonly cover: Cover;
|
|
12
25
|
};
|
|
13
26
|
export type Run = (plan: Plan, cover: () => Promise<Cover>) => Promise<Ran>;
|
|
14
27
|
export type PendingAt<H> = (held: H, rooms: readonly string[]) => ReadonlyMap<string, PendingRoom | null> | null;
|
|
@@ -20,6 +33,7 @@ export type LiveQueries<H> = {
|
|
|
20
33
|
close(): void;
|
|
21
34
|
};
|
|
22
35
|
export declare function readerOf(plan: Plan): (locator: string) => boolean;
|
|
36
|
+
export declare function hearerOf(plan: Plan): (locator: string) => boolean;
|
|
23
37
|
export declare function createLiveQueries<H>(run: Run, holding: () => Promise<H>): LiveQueries<H>;
|
|
24
38
|
export {};
|
|
25
39
|
//# sourceMappingURL=live.d.ts.map
|
package/dist/live.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../src/live.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAQL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAClF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../src/live.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAQL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAClF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG;IAAE,QAAQ,CAAC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EAAE,MAAM,EAChB,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,EACzB,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,EACvB,OAAO,EAAE,QAAQ,EACjB,MAAM,EAAE,IAAI,GACX,MAAM,IAAI,CAAC;IACd,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAWF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAQjE;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAEjE;AAyBD,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAwKxF"}
|
package/dist/live.js
CHANGED
|
@@ -15,15 +15,24 @@ export function readerOf(plan) {
|
|
|
15
15
|
(named === null || named.has(locator)) &&
|
|
16
16
|
(reached === null || reached.has(locator));
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
18
|
+
export function hearerOf(plan) {
|
|
19
|
+
return readerOf(plan.hop === null ? plan : { ...plan, rooms: null });
|
|
20
|
+
}
|
|
21
|
+
function affected({ plan, hears }, set) {
|
|
22
|
+
if (set.rooms.some(hears))
|
|
20
23
|
return true;
|
|
21
24
|
const paths = narrowed(plan) ? new Set(plan.paths) : null;
|
|
22
|
-
return set.documents.some(({ locator, path }) =>
|
|
25
|
+
return set.documents.some(({ locator, path }) => hears(locator) && (paths === null || path === null || paths.has(path)));
|
|
26
|
+
}
|
|
27
|
+
function namingMoved(entry, set) {
|
|
28
|
+
return (entry.awaitsFollowed &&
|
|
29
|
+
(set.rooms.some(entry.reads) || set.documents.some(({ locator }) => entry.reads(locator))));
|
|
30
|
+
}
|
|
31
|
+
function coverShown(cover) {
|
|
32
|
+
return JSON.stringify('pending' in cover ? cover : [cover.coverage, cover.follows]);
|
|
23
33
|
}
|
|
24
34
|
function shown(entry, held) {
|
|
25
|
-
|
|
26
|
-
return JSON.stringify('pending' in cover ? cover : cover.coverage);
|
|
35
|
+
return coverShown(entry.cover(held));
|
|
27
36
|
}
|
|
28
37
|
export function createLiveQueries(run, holding) {
|
|
29
38
|
const entries = new Map();
|
|
@@ -31,11 +40,13 @@ export function createLiveQueries(run, holding) {
|
|
|
31
40
|
let recoveringNow = false;
|
|
32
41
|
let recoveringAll = false;
|
|
33
42
|
const recovering = new Set();
|
|
34
|
-
function deliver(entry, next) {
|
|
43
|
+
function deliver(entry, next, cover) {
|
|
35
44
|
const previous = entry.digest;
|
|
36
45
|
entry.digest = digestOf(next);
|
|
37
46
|
entry.pending = 'pending' in entry.digest ? entry.digest.pending : null;
|
|
38
|
-
entry.
|
|
47
|
+
entry.awaitsFollowed =
|
|
48
|
+
'pending' in next.result && next.result.pending.some(({ room }) => !entry.reads(room));
|
|
49
|
+
entry.covered = coverShown(cover);
|
|
39
50
|
const change = previous === undefined ? null : changeOf(previous, next);
|
|
40
51
|
if (change !== null) {
|
|
41
52
|
for (const listener of entry.ready)
|
|
@@ -48,10 +59,10 @@ export function createLiveQueries(run, holding) {
|
|
|
48
59
|
entry.fresh.clear();
|
|
49
60
|
}
|
|
50
61
|
async function delivered(entry) {
|
|
51
|
-
const { current, ...next } = await run(entry.plan, async () => entry.cover(await holding()));
|
|
62
|
+
const { current, cover, ...next } = await run(entry.plan, async () => entry.cover(await holding()));
|
|
52
63
|
if (closed || entry.listeners.size === 0)
|
|
53
64
|
return null;
|
|
54
|
-
deliver(entry, next);
|
|
65
|
+
deliver(entry, next, cover);
|
|
55
66
|
return current;
|
|
56
67
|
}
|
|
57
68
|
function schedule(entry) {
|
|
@@ -89,7 +100,11 @@ export function createLiveQueries(run, holding) {
|
|
|
89
100
|
}
|
|
90
101
|
function pendingMoved(entry, held, rooms) {
|
|
91
102
|
const { pending } = entry;
|
|
92
|
-
if (pending === null ||
|
|
103
|
+
if (pending === null ||
|
|
104
|
+
pending.size === 0 ||
|
|
105
|
+
entry.running ||
|
|
106
|
+
entry.fresh.size > 0 ||
|
|
107
|
+
entry.awaitsFollowed) {
|
|
93
108
|
return false;
|
|
94
109
|
}
|
|
95
110
|
const at = entry.pendingAt(held, rooms);
|
|
@@ -120,7 +135,7 @@ export function createLiveQueries(run, holding) {
|
|
|
120
135
|
const touched = [...recovering];
|
|
121
136
|
recoveringAll = false;
|
|
122
137
|
recovering.clear();
|
|
123
|
-
const reached = [...entries.values()].filter((entry) => all || touched.some(entry.
|
|
138
|
+
const reached = [...entries.values()].filter((entry) => all || touched.some(entry.hears));
|
|
124
139
|
for (const entry of reached) {
|
|
125
140
|
if (entry.running)
|
|
126
141
|
entry.dirty = true;
|
|
@@ -154,7 +169,7 @@ export function createLiveQueries(run, holding) {
|
|
|
154
169
|
for (const entry of entries.values()) {
|
|
155
170
|
if (!affected(entry, set))
|
|
156
171
|
continue;
|
|
157
|
-
if (entry.pending === null || entry.running) {
|
|
172
|
+
if (entry.pending === null || entry.running || namingMoved(entry, set)) {
|
|
158
173
|
schedule(entry);
|
|
159
174
|
continue;
|
|
160
175
|
}
|
|
@@ -173,6 +188,7 @@ export function createLiveQueries(run, holding) {
|
|
|
173
188
|
entry = {
|
|
174
189
|
plan,
|
|
175
190
|
reads: readerOf(plan),
|
|
191
|
+
hears: hearerOf(plan),
|
|
176
192
|
cover,
|
|
177
193
|
pendingAt,
|
|
178
194
|
listeners: new Set(),
|
|
@@ -180,6 +196,7 @@ export function createLiveQueries(run, holding) {
|
|
|
180
196
|
ready: new Set(),
|
|
181
197
|
digest: undefined,
|
|
182
198
|
pending: null,
|
|
199
|
+
awaitsFollowed: false,
|
|
183
200
|
covered: '',
|
|
184
201
|
dirty: false,
|
|
185
202
|
running: false,
|
package/dist/media.js
CHANGED
|
@@ -42,7 +42,7 @@ export function mediaTag(at) {
|
|
|
42
42
|
export function downloadAt(client, at) {
|
|
43
43
|
return 'link' in at
|
|
44
44
|
? downloadAttachment(client, at.link)
|
|
45
|
-
: client.
|
|
45
|
+
: client.attachment.download(at.room, at.path, at.revision);
|
|
46
46
|
}
|
|
47
47
|
function shownAt(client, at) {
|
|
48
48
|
if (at === null)
|
|
@@ -52,7 +52,7 @@ function shownAt(client, at) {
|
|
|
52
52
|
.attachment(at.link)
|
|
53
53
|
.then((shown) => (shown.kind === 'link' ? { ...shown, copies: [] } : shown));
|
|
54
54
|
}
|
|
55
|
-
return client.
|
|
55
|
+
return client.attachment.show(at.room, at.path, at.revision);
|
|
56
56
|
}
|
|
57
57
|
function ratioOf(width, height) {
|
|
58
58
|
const across = Number(width);
|
|
@@ -62,7 +62,7 @@ function ratioOf(width, height) {
|
|
|
62
62
|
: null;
|
|
63
63
|
}
|
|
64
64
|
function ownRatio(found, at) {
|
|
65
|
-
const record = 'documents' in found ? found.documents[0]?.
|
|
65
|
+
const record = 'documents' in found ? found.documents[0]?.attachment : undefined;
|
|
66
66
|
if (record?.state !== 'accepted' ||
|
|
67
67
|
(at.revision !== undefined && record.revision !== at.revision)) {
|
|
68
68
|
return null;
|
package/dist/memory.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type VerifiedModel } from '@agentshouse/mdmodel';
|
|
2
2
|
import type { ModelResult } from './model.js';
|
|
3
|
-
import { type AcceptedMessage, type ActionResult, type Adapter, type
|
|
3
|
+
import { type AcceptedMessage, type ActionResult, type Adapter, type Attachment, type Capability, type ConversationAction, type ConversationEvent, type DiscoveredRoom, type SavedFacts, type HeadChange, type ListedAgent, type ListedConversation, type Member, type ProviderLimit, type Retention, type ServiceMode, type TypedPath, type TypedSelection } from './adapter.js';
|
|
4
4
|
export type MemoryRoom = Omit<DiscoveredRoom, 'typedSelection' | 'authoredPaths'> & {
|
|
5
5
|
typedSelection?: TypedSelection | null;
|
|
6
6
|
authoredPaths?: readonly string[];
|
|
@@ -11,7 +11,7 @@ export type MemoryRoom = Omit<DiscoveredRoom, 'typedSelection' | 'authoredPaths'
|
|
|
11
11
|
fileIds?: Readonly<Record<string, string>>;
|
|
12
12
|
created?: Readonly<Record<string, string>>;
|
|
13
13
|
changes?: Readonly<Record<string, HeadChange>>;
|
|
14
|
-
|
|
14
|
+
attachments?: Readonly<Record<string, Attachment>>;
|
|
15
15
|
folders?: readonly string[];
|
|
16
16
|
blobs?: Readonly<Record<string, Blob>>;
|
|
17
17
|
};
|
package/dist/memory.js
CHANGED
|
@@ -193,7 +193,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
193
193
|
const size = pageSize ?? paths.length;
|
|
194
194
|
const taken = paths.slice(from, from + size);
|
|
195
195
|
const next = from + taken.length;
|
|
196
|
-
const targets = opening ? Object.keys(room.
|
|
196
|
+
const targets = opening ? Object.keys(room.attachments ?? {}) : [];
|
|
197
197
|
return {
|
|
198
198
|
kind: 'bootstrap',
|
|
199
199
|
roomVersion: room.roomVersion,
|
|
@@ -208,7 +208,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
208
208
|
? {}
|
|
209
209
|
: { created: named(room.created, [...taken, ...targets]) }),
|
|
210
210
|
changes: named(room.changes ?? {}, [...taken, ...targets]),
|
|
211
|
-
|
|
211
|
+
attachments: named(room.attachments ?? {}, targets),
|
|
212
212
|
...(opening && room.folders !== undefined ? { folders: room.folders } : {}),
|
|
213
213
|
...(next < paths.length ? { pageToken: taken.at(-1) } : {}),
|
|
214
214
|
};
|
|
@@ -226,8 +226,8 @@ export function createMemoryAdapter(options = {}) {
|
|
|
226
226
|
function advancement(room, from, at, whole = false) {
|
|
227
227
|
const current = room.documents ?? {};
|
|
228
228
|
const previous = from.documents ?? {};
|
|
229
|
-
const currentTargets = new Set(Object.keys(room.
|
|
230
|
-
const previousTargets = new Set(Object.keys(from.
|
|
229
|
+
const currentTargets = new Set(Object.keys(room.attachments ?? {}));
|
|
230
|
+
const previousTargets = new Set(Object.keys(from.attachments ?? {}));
|
|
231
231
|
const headMoved = (path) => room.revisions?.[path] !== from.revisions?.[path] ||
|
|
232
232
|
room.fileIds?.[path] !== from.fileIds?.[path] ||
|
|
233
233
|
room.created?.[path] !== from.created?.[path] ||
|
|
@@ -260,7 +260,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
260
260
|
? {}
|
|
261
261
|
: { created: named(room.created, [...taken, ...targets]) }),
|
|
262
262
|
changes: named(room.changes ?? {}, [...taken, ...targets]),
|
|
263
|
-
|
|
263
|
+
attachments: named(room.attachments ?? {}, targets),
|
|
264
264
|
...(opening ? foldersMoved(room, from) : {}),
|
|
265
265
|
removals: opening
|
|
266
266
|
? [
|
package/dist/outcome.js
CHANGED
|
@@ -19,7 +19,7 @@ export const ABSENT_TARGET = {
|
|
|
19
19
|
retryable: false,
|
|
20
20
|
};
|
|
21
21
|
export function absentBinary(path) {
|
|
22
|
-
return { kind: 'absent', code: '
|
|
22
|
+
return { kind: 'absent', code: 'attachment-absent', fields: { path }, retryable: false };
|
|
23
23
|
}
|
|
24
24
|
export function declaredType(blob) {
|
|
25
25
|
return blob.type === '' ? MEDIA_TYPES.octetStream : blob.type;
|
package/dist/overlay.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ApplyResult } from '@agentshouse/mdmodel';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Attachment, HeadChange } from './adapter.js';
|
|
3
3
|
import { type Composition } from './collection.js';
|
|
4
4
|
import { type ChangeBatch } from './change.js';
|
|
5
5
|
export type Heads = {
|
|
@@ -10,7 +10,7 @@ export type Heads = {
|
|
|
10
10
|
};
|
|
11
11
|
export type HeldBinary = ({
|
|
12
12
|
readonly state: 'accepted';
|
|
13
|
-
} &
|
|
13
|
+
} & Attachment) | {
|
|
14
14
|
readonly state: 'pending';
|
|
15
15
|
readonly localId: string;
|
|
16
16
|
readonly byteLength: number;
|
|
@@ -21,7 +21,7 @@ export type Layer = Heads & {
|
|
|
21
21
|
documents: Readonly<Record<string, string>>;
|
|
22
22
|
binaries: Readonly<Record<string, HeldBinary>>;
|
|
23
23
|
};
|
|
24
|
-
export declare function acceptedBinaries(files: Readonly<Record<string,
|
|
24
|
+
export declare function acceptedBinaries(files: Readonly<Record<string, Attachment>>): Generator<readonly [string, HeldBinary]>;
|
|
25
25
|
export declare function sameBinary(left: HeldBinary | undefined, right: HeldBinary | undefined): boolean;
|
|
26
26
|
export declare function sameChange(left: HeadChange | undefined, right: HeadChange | undefined): boolean;
|
|
27
27
|
export declare function composed(path: string, fields: Readonly<Record<string, unknown>>, sections: Readonly<Record<string, string>>, composition: Composition): ApplyResult;
|
package/dist/queries.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAIL,KAAK,KAAK,EAGV,KAAK,GAAG,EACT,MAAM,WAAW,CAAC;AAMnB,OAAO,EAKL,KAAK,IAAI,EACT,KAAK,WAAW,EAEjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAa,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAEhF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,KAAK,EAAa,SAAS,EAAgB,MAAM,YAAY,CAAC;AA4IrE,wBAAsB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CAa1E;AAqID,wBAAsB,YAAY,CAChC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,GAC1B,OAAO,CAAC,GAAG,CAAC,CAWd;AAQD,wBAAsB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAWlF;AAED,wBAAsB,OAAO,CAC3B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,SAAS,GAAG,IAAI,GACtB,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,KAAK,EAAE,MAAM,wDAO7F;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,IAAI,CAmBhG;AAED,wBAAgB,YAAY,CAC1B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,EACvB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,GACT,MAAM,IAAI,CAeZ;AAED,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,SAAS,GAAG,IAAI,GACtB,OAAO,CAAC,YAAY,CAAC,CA4BvB"}
|
package/dist/queries.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { identityOf } from '@agentshouse/mdmodel';
|
|
2
2
|
import { ROOM_TOTALS } from './figures.js';
|
|
3
3
|
import { roomInFlight } from './install.js';
|
|
4
|
-
import { readerOf } from './live.js';
|
|
4
|
+
import { hearerOf, readerOf, } from './live.js';
|
|
5
5
|
import { compositionFor, roomFacts } from './listing.js';
|
|
6
6
|
import { lockedRooms } from './locks.js';
|
|
7
7
|
import { askedOnline, offline } from './online.js';
|
|
@@ -77,8 +77,31 @@ function coveredRooms(runtime, locators, whole, held) {
|
|
|
77
77
|
return { pending };
|
|
78
78
|
return { coverage: { rooms: coverage, overlay }, rooms: read };
|
|
79
79
|
}
|
|
80
|
+
const UNFOLLOWED = { held: [], awaiting: [] };
|
|
81
|
+
function followsOf(runtime, plan, held) {
|
|
82
|
+
if (plan.hop === null)
|
|
83
|
+
return UNFOLLOWED;
|
|
84
|
+
const reached = plan.reach === null ? everyRoom(runtime, held) : roomsOfReach(plan.reach);
|
|
85
|
+
const reads = hearerOf(plan);
|
|
86
|
+
const follows = [];
|
|
87
|
+
const awaiting = [];
|
|
88
|
+
for (const locator of [...new Set(reached)].filter(reads).sort()) {
|
|
89
|
+
const replica = held.rooms.get(locator);
|
|
90
|
+
const awaits = awaitsOf(runtime, locator, held);
|
|
91
|
+
if (awaits === null) {
|
|
92
|
+
if (replica !== undefined)
|
|
93
|
+
follows.push({ locator, key: replica.key });
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const handle = replica?.handle ?? runtime.presence.room(locator)?.handle;
|
|
97
|
+
if (handle !== undefined)
|
|
98
|
+
awaiting.push({ room: locator, awaits, handle });
|
|
99
|
+
}
|
|
100
|
+
return { held: follows, awaiting };
|
|
101
|
+
}
|
|
80
102
|
function covered(runtime, plan, held) {
|
|
81
|
-
|
|
103
|
+
const cover = coveredRooms(runtime, reachedRooms(runtime, plan, held), anyRoom(plan), held);
|
|
104
|
+
return 'pending' in cover ? cover : { ...cover, follows: followsOf(runtime, plan, held) };
|
|
82
105
|
}
|
|
83
106
|
function pendingAt(runtime, plan, reads, held, rooms) {
|
|
84
107
|
const reached = reaching(runtime, plan, reads, held);
|
|
@@ -112,8 +135,8 @@ export async function figuresCover(runtime) {
|
|
|
112
135
|
function sameCover(left, right) {
|
|
113
136
|
return JSON.stringify(left) === JSON.stringify(right);
|
|
114
137
|
}
|
|
115
|
-
async function windowRows(local, plan, rooms, unchanged) {
|
|
116
|
-
const first = await local.query(plan, rooms, QUERY_BYTES);
|
|
138
|
+
async function windowRows(local, plan, rooms, follows, unchanged) {
|
|
139
|
+
const first = await local.query(plan, rooms, follows, QUERY_BYTES);
|
|
117
140
|
if (first.more === undefined || !('documents' in first)) {
|
|
118
141
|
const { more: _more, ...rows } = first;
|
|
119
142
|
return rows;
|
|
@@ -127,7 +150,7 @@ async function windowRows(local, plan, rooms, unchanged) {
|
|
|
127
150
|
after: { text: more, values: JSON.parse(more) },
|
|
128
151
|
limit: plan.limit === null ? null : plan.limit - documents.length,
|
|
129
152
|
total: false,
|
|
130
|
-
}, rooms, QUERY_BYTES);
|
|
153
|
+
}, rooms, follows, QUERY_BYTES);
|
|
131
154
|
if (!('documents' in page))
|
|
132
155
|
return null;
|
|
133
156
|
documents.push(...page.documents);
|
|
@@ -156,17 +179,34 @@ async function composedRooms(runtime, plan, rooms) {
|
|
|
156
179
|
: { ...room, composition: compositionFor(runtime, stored.record) };
|
|
157
180
|
});
|
|
158
181
|
}
|
|
182
|
+
async function awaitedFollows(runtime, local, plan, cover) {
|
|
183
|
+
const { awaiting } = cover.follows;
|
|
184
|
+
if (awaiting.length === 0)
|
|
185
|
+
return [];
|
|
186
|
+
const named = new Set(await local.named(plan, cover.rooms, awaiting.map(({ handle }) => handle)));
|
|
187
|
+
const pending = awaiting
|
|
188
|
+
.filter(({ handle }) => named.has(handle))
|
|
189
|
+
.map(({ room, awaits }) => ({ room, awaits }));
|
|
190
|
+
awaitPreparation(runtime, { pending });
|
|
191
|
+
return pending;
|
|
192
|
+
}
|
|
159
193
|
async function coveredRows(runtime, plan, cover) {
|
|
160
194
|
const { store } = runtime;
|
|
161
195
|
for (;;) {
|
|
162
196
|
const before = await cover();
|
|
163
197
|
if ('pending' in before)
|
|
164
|
-
return { pending: before };
|
|
198
|
+
return { pending: before, cover: before };
|
|
165
199
|
const local = await store.open();
|
|
166
|
-
const
|
|
200
|
+
const awaited = await awaitedFollows(runtime, local, plan, before);
|
|
201
|
+
if (awaited.length > 0) {
|
|
202
|
+
if (sameCover(before, await cover()))
|
|
203
|
+
return { pending: { pending: awaited }, cover: before };
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
const keys = [...before.rooms, ...before.follows.held].map(({ key }) => key);
|
|
167
207
|
const changes = local.changes(keys);
|
|
168
208
|
const current = () => local.changes(keys) === changes;
|
|
169
|
-
const rows = await windowRows(local, plan, await composedRooms(runtime, plan, before.rooms), current);
|
|
209
|
+
const rows = await windowRows(local, plan, await composedRooms(runtime, plan, before.rooms), before.follows.held, current);
|
|
170
210
|
const after = await cover();
|
|
171
211
|
if (rows !== null && sameCover(before, after))
|
|
172
212
|
return { rows, cover: before, current };
|
|
@@ -187,11 +227,14 @@ function keyedOf(rows, coverage) {
|
|
|
187
227
|
export async function answeredPlan(runtime, plan, cover) {
|
|
188
228
|
const answered = await coveredRows(runtime, plan, cover);
|
|
189
229
|
if ('pending' in answered) {
|
|
190
|
-
|
|
191
|
-
return { result: pending, keys: [], current: () => true };
|
|
230
|
+
return { result: answered.pending, keys: [], current: () => true, cover: answered.cover };
|
|
192
231
|
}
|
|
193
232
|
const held = answered.cover;
|
|
194
|
-
return {
|
|
233
|
+
return {
|
|
234
|
+
...keyedOf(answered.rows, held.coverage),
|
|
235
|
+
current: answered.current,
|
|
236
|
+
cover: answered.cover,
|
|
237
|
+
};
|
|
195
238
|
}
|
|
196
239
|
async function coverNow(runtime, plan) {
|
|
197
240
|
const cover = covered(runtime, plan, await runtime.store.covering());
|
package/dist/query.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type HeldRooms, type QueryPlan } from '@agentshouse/mdmodel';
|
|
2
2
|
import type { HeadChange } from './adapter.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AttachmentRecord } from './binary.js';
|
|
4
4
|
import type { Open } from './open.js';
|
|
5
5
|
export type Backlink = {
|
|
6
6
|
path: string;
|
|
@@ -19,7 +19,7 @@ export type QueryDocument = {
|
|
|
19
19
|
change?: HeadChange | null;
|
|
20
20
|
fileId?: string | null;
|
|
21
21
|
revision?: string | null;
|
|
22
|
-
|
|
22
|
+
attachment?: AttachmentRecord;
|
|
23
23
|
size?: number | null;
|
|
24
24
|
created?: string | null;
|
|
25
25
|
};
|
package/dist/reach.js
CHANGED
|
@@ -25,7 +25,7 @@ const NO_CONVERSATION = {
|
|
|
25
25
|
takeOut: unconversed('conversations/take-out'),
|
|
26
26
|
decide: unconversed('agent-functions/decide'),
|
|
27
27
|
rename: unconversed('conversations/rename'),
|
|
28
|
-
|
|
28
|
+
set: unconversed('conversations/set'),
|
|
29
29
|
retry: unconversed('conversations/retry'),
|
|
30
30
|
pin: () => Promise.resolve(),
|
|
31
31
|
openTurn: () => Promise.resolve(),
|
|
@@ -239,7 +239,7 @@ function queriesOnlyError(room) {
|
|
|
239
239
|
return runtimeError(QUERIES_ONLY, `${room} answers through queryHouse`);
|
|
240
240
|
}
|
|
241
241
|
function attachRequired() {
|
|
242
|
-
return runtimeError(ATTACH_REQUIRED, 'App code takes a file in with
|
|
242
|
+
return runtimeError(ATTACH_REQUIRED, 'App code takes a file in with attachment.attach');
|
|
243
243
|
}
|
|
244
244
|
function carriesFile(parts) {
|
|
245
245
|
return parts !== null && typeof parts === 'object' && Object.hasOwn(parts, 'file');
|
|
@@ -525,32 +525,32 @@ export function narrowed(runtime, given, attached) {
|
|
|
525
525
|
: (await runtime.locked(room))
|
|
526
526
|
? lockedRoom(room)
|
|
527
527
|
: md.history(room, path, query),
|
|
528
|
-
|
|
528
|
+
attachment: {
|
|
529
529
|
read: async (room, path, revision) => !covers(reach, room, path)
|
|
530
530
|
? failure({ kind: 'room-not-readable', locator: room })
|
|
531
531
|
: (await runtime.locked(room))
|
|
532
532
|
? lockedRoom(room)
|
|
533
|
-
: hand(md.
|
|
533
|
+
: hand(md.attachment.read(room, path, revision)),
|
|
534
534
|
link: async (room, path, revision) => !covers(reach, room, path)
|
|
535
535
|
? failure({ kind: 'room-not-readable', locator: room })
|
|
536
536
|
: (await runtime.locked(room))
|
|
537
537
|
? lockedRoom(room)
|
|
538
|
-
: md.
|
|
538
|
+
: md.attachment.link(room, path, revision),
|
|
539
539
|
show: async (room, path, revision) => !covers(reach, room, path)
|
|
540
540
|
? failure({ kind: 'room-not-readable', locator: room })
|
|
541
541
|
: (await runtime.locked(room))
|
|
542
542
|
? lockedRoom(room)
|
|
543
|
-
: hand(md.
|
|
543
|
+
: hand(md.attachment.show(room, path, revision)),
|
|
544
544
|
attach: async (room, file) => !wholly(reach, room)
|
|
545
545
|
? failure({ kind: 'room-not-readable', locator: room })
|
|
546
546
|
: (await runtime.locked(room))
|
|
547
547
|
? lockedRoom(room)
|
|
548
|
-
: md.
|
|
548
|
+
: md.attachment.attach(room, file),
|
|
549
549
|
async part(file, part) {
|
|
550
550
|
const key = files.get(file);
|
|
551
551
|
if (key === undefined)
|
|
552
552
|
return null;
|
|
553
|
-
const bytes = await md.
|
|
553
|
+
const bytes = await md.attachment.part(key, part);
|
|
554
554
|
if (bytes === null)
|
|
555
555
|
files.delete(file);
|
|
556
556
|
return bytes;
|
|
@@ -605,7 +605,7 @@ export function narrowed(runtime, given, attached) {
|
|
|
605
605
|
takeOut: (id, message, operation) => conversation().takeOut(id, message, operation),
|
|
606
606
|
decide: (request, decision, operation) => conversation().decide(request, decision, operation),
|
|
607
607
|
rename: (id, name, operation) => conversation().rename(id, name, operation),
|
|
608
|
-
|
|
608
|
+
set: (id, settings, operation) => conversation().set(id, settings, operation),
|
|
609
609
|
retry: (id, message, operation) => conversation().retry(id, message, operation),
|
|
610
610
|
pin: (figures) => conversation().pin(figures),
|
|
611
611
|
openTurn: (id, turn) => conversation().openTurn(id, turn),
|