@agentshouse/mdruntime 0.1.0-ce5c5bb29be5a → 0.1.0-ce6bc9239a3ee
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 +2 -2
- package/dist/acceptance.d.ts +26 -0
- package/dist/acceptance.d.ts.map +1 -0
- package/dist/acceptance.js +384 -0
- package/dist/adapter.d.ts +81 -49
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +3 -10
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +21 -56
- package/dist/bootstrap.d.ts +9 -5
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +209 -75
- package/dist/chain.d.ts +2 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/change.d.ts +1 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/chat-types.d.ts +3 -0
- package/dist/chat-types.d.ts.map +1 -0
- package/dist/chat-types.js +2 -0
- package/dist/client.d.ts +16 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +3 -1
- package/dist/collection.d.ts +2 -1
- package/dist/collection.d.ts.map +1 -1
- package/dist/compile.d.ts +6 -6
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +262 -318
- package/dist/connection.d.ts +20 -44
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +1438 -3393
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +7 -0
- package/dist/conversation-row.d.ts +33 -0
- package/dist/conversation-row.d.ts.map +1 -0
- package/dist/conversation-row.js +47 -0
- package/dist/conversation.d.ts +26 -17
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +441 -307
- package/dist/durability.d.ts +6 -0
- package/dist/durability.d.ts.map +1 -1
- package/dist/entry.d.ts +2 -2
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +17 -7
- package/dist/figures.d.ts +48 -0
- package/dist/figures.d.ts.map +1 -0
- package/dist/figures.js +197 -0
- package/dist/host.d.ts +4 -6
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +22 -26
- package/dist/identity.d.ts +0 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +0 -3
- package/dist/index.d.ts +18 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/install.d.ts +86 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +537 -0
- package/dist/job.d.ts +33 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +54 -0
- package/dist/live.d.ts +5 -4
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +63 -22
- package/dist/log.d.ts +1 -0
- package/dist/log.d.ts.map +1 -1
- package/dist/memory.d.ts +11 -4
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +171 -81
- package/dist/messages.d.ts +27 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +97 -19
- package/dist/model.d.ts +2 -9
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +0 -9
- package/dist/observation.d.ts +2 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +7 -2
- package/dist/outcome.d.ts +1 -0
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +3 -0
- package/dist/overlay.d.ts +1 -0
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +11 -0
- package/dist/parts.d.ts +59 -0
- package/dist/parts.d.ts.map +1 -0
- package/dist/parts.js +118 -0
- package/dist/query.d.ts +14 -209
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -505
- package/dist/questions.d.ts +32 -0
- package/dist/questions.d.ts.map +1 -0
- package/dist/questions.js +118 -0
- package/dist/reach.d.ts +12 -12
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +182 -136
- package/dist/react.d.ts +5 -2
- package/dist/react.d.ts.map +1 -1
- package/dist/read.d.ts +7 -0
- package/dist/read.d.ts.map +1 -0
- package/dist/read.js +17 -0
- package/dist/readiness.d.ts +0 -2
- package/dist/readiness.d.ts.map +1 -1
- package/dist/reads.d.ts +36 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +136 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +9 -1
- package/dist/refresh.d.ts +6 -4
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +32 -4
- package/dist/replica.d.ts +8 -8
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +50 -15
- package/dist/room-draft.d.ts +4 -3
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +65 -52
- package/dist/room-drafts.d.ts +29 -0
- package/dist/room-drafts.d.ts.map +1 -0
- package/dist/room-drafts.js +216 -0
- package/dist/rows.d.ts +14 -21
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +48 -184
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +11 -8
- package/dist/saves.d.ts +96 -0
- package/dist/saves.d.ts.map +1 -0
- package/dist/saves.js +999 -0
- package/dist/search.d.ts +12 -63
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +9 -52
- package/dist/seed.d.ts +16 -2
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +66 -0
- package/dist/socket/admission.d.ts +7 -0
- package/dist/socket/admission.d.ts.map +1 -0
- package/dist/socket/admission.js +39 -0
- package/dist/socket/answers.d.ts +6 -0
- package/dist/socket/answers.d.ts.map +1 -0
- package/dist/socket/answers.js +20 -0
- package/dist/socket/reads.d.ts +10 -0
- package/dist/socket/reads.d.ts.map +1 -0
- package/dist/socket/reads.js +31 -0
- package/dist/socket.d.ts +43 -0
- package/dist/socket.d.ts.map +1 -0
- package/dist/socket.js +96 -0
- package/dist/source.d.ts +61 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +81 -0
- package/dist/status.d.ts +0 -2
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +0 -6
- package/dist/store/fences.d.ts +16 -0
- package/dist/store/fences.d.ts.map +1 -0
- package/dist/store/fences.js +26 -0
- package/dist/store/installs.d.ts +30 -0
- package/dist/store/installs.d.ts.map +1 -0
- package/dist/store/installs.js +34 -0
- package/dist/store/records.d.ts +212 -0
- package/dist/store/records.d.ts.map +1 -0
- package/dist/store/records.js +408 -0
- package/dist/store/room-held.d.ts +8 -0
- package/dist/store/room-held.d.ts.map +1 -0
- package/dist/store/room-held.js +17 -0
- package/dist/store/watchers.d.ts +15 -0
- package/dist/store/watchers.d.ts.map +1 -0
- package/dist/store/watchers.js +36 -0
- package/dist/store/writes.d.ts +24 -0
- package/dist/store/writes.d.ts.map +1 -0
- package/dist/store/writes.js +125 -0
- package/dist/store.d.ts +78 -145
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +117 -367
- package/dist/stored.d.ts +58 -32
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +264 -187
- package/dist/tables.d.ts +107 -25
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +193 -47
- package/dist/tallies.d.ts +18 -0
- package/dist/tallies.d.ts.map +1 -0
- package/dist/tallies.js +129 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +7 -4
- package/dist/windows.d.ts +1 -12
- package/dist/windows.d.ts.map +1 -1
- package/dist/windows.js +2 -75
- package/dist/wire.d.ts +15 -4
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +6 -1
- package/package.json +2 -2
- package/dist/fence.d.ts +0 -6
- package/dist/fence.d.ts.map +0 -1
- package/dist/fence.js +0 -10
- package/dist/fulltext.d.ts +0 -27
- package/dist/fulltext.d.ts.map +0 -1
- package/dist/fulltext.js +0 -370
- package/dist/words.d.ts +0 -19
- package/dist/words.d.ts.map +0 -1
- package/dist/words.js +0 -156
package/dist/durability.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { Persistence } from './readiness.js';
|
|
2
|
+
export type UnsentKind = 'pending-change' | 'call' | 'room-draft' | 'chat-draft';
|
|
3
|
+
export type UnsentWork = {
|
|
4
|
+
readonly kind: UnsentKind;
|
|
5
|
+
readonly count: number;
|
|
6
|
+
};
|
|
2
7
|
export type RuntimeShell = {
|
|
3
8
|
persistence: Persistence;
|
|
4
9
|
generation: string | null;
|
|
5
10
|
keepGeneration(value: string): void | Promise<void>;
|
|
6
11
|
dropGeneration(): void | Promise<void>;
|
|
7
12
|
cleanUp?(): Promise<number>;
|
|
13
|
+
reset(): Promise<void>;
|
|
8
14
|
};
|
|
9
15
|
export declare function refusedForSpace(error: unknown): boolean;
|
|
10
16
|
export declare function detectStorageLoss(stored: string | null, reported: string | null): string | null;
|
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,YAAY,GAAG;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,cAAc,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;
|
|
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,UAAU,GAAG,gBAAgB,GAAG,MAAM,GAAG,YAAY,GAAG,YAAY,CAAC;AAEjF,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/E,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,cAAc,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB,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/entry.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type VerifiedModel } from '@agentshouse/mdmodel';
|
|
2
2
|
import { type QueryRows } from './query.js';
|
|
3
3
|
import type { Connection } from './tables.js';
|
|
4
|
-
export { QueryError } from '
|
|
4
|
+
export { QueryError } from '@agentshouse/mdmodel';
|
|
5
5
|
export type EntryRoom = {
|
|
6
6
|
locator: string;
|
|
7
7
|
schema: string | null;
|
package/dist/entry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,E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import { invalid, plain, QueryError, } from '@agentshouse/mdmodel';
|
|
1
2
|
import { attachedModel } from './attached-model.js';
|
|
2
3
|
import { answerQuery } from './compile.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
4
|
+
import { planWithin } from './query.js';
|
|
5
|
+
import { writtenFacts } from './rows.js';
|
|
5
6
|
import { entered, REPLICA_TABLES } from './stored.js';
|
|
6
|
-
export { QueryError } from '
|
|
7
|
+
export { QueryError } from '@agentshouse/mdmodel';
|
|
7
8
|
const PARAMETER = '$param';
|
|
8
9
|
const KIND = 'as';
|
|
9
10
|
const INTEGER = /^-?(?:0|[1-9][0-9]*)$/u;
|
|
@@ -83,6 +84,7 @@ const SAMPLED = {
|
|
|
83
84
|
$all: 'entry',
|
|
84
85
|
$size: 0,
|
|
85
86
|
$exists: true,
|
|
87
|
+
$prefix: 'entry',
|
|
86
88
|
$gt: 0,
|
|
87
89
|
$gte: 0,
|
|
88
90
|
$lt: 0,
|
|
@@ -98,9 +100,15 @@ function sampled(template, key) {
|
|
|
98
100
|
}
|
|
99
101
|
return template;
|
|
100
102
|
}
|
|
103
|
+
function entryPlan(query, facts) {
|
|
104
|
+
const plan = planWithin(query, facts);
|
|
105
|
+
if (plan.fileIds !== null)
|
|
106
|
+
invalid('fileIds', 'an entry Room holds no file IDs');
|
|
107
|
+
return plan;
|
|
108
|
+
}
|
|
101
109
|
export function entryRefusal(template) {
|
|
102
110
|
try {
|
|
103
|
-
|
|
111
|
+
entryPlan(sampled(template, ''), { listed: false, rooms: [] });
|
|
104
112
|
return null;
|
|
105
113
|
}
|
|
106
114
|
catch (error) {
|
|
@@ -117,21 +125,23 @@ export function entryScope(rooms, roomTypes, connection) {
|
|
|
117
125
|
const model = attachedModel({
|
|
118
126
|
kind: 'model',
|
|
119
127
|
snapshot: { identity: room.locator, version: '', schema: room.schema, revision: null },
|
|
120
|
-
},
|
|
128
|
+
}, roomTypes);
|
|
121
129
|
held.push({
|
|
122
130
|
locator: room.locator,
|
|
123
131
|
available: model.status !== 'unavailable',
|
|
124
132
|
types: model.status === 'unavailable' ? [] : Object.values(model.types),
|
|
125
133
|
});
|
|
126
|
-
const composition = { model, selection: null };
|
|
134
|
+
const composition = { model, selection: null, typedPaths: [] };
|
|
127
135
|
const key = entered(connection, room.locator, composition, Object.keys(room.documents)
|
|
128
136
|
.sort()
|
|
129
137
|
.map((path) => ({
|
|
130
138
|
path,
|
|
131
139
|
content: room.documents[path],
|
|
140
|
+
facts: writtenFacts(path, room.documents[path], composition),
|
|
132
141
|
binary: null,
|
|
133
142
|
revision: room.revisions?.[path] ?? null,
|
|
134
143
|
fileId: null,
|
|
144
|
+
created: null,
|
|
135
145
|
change: null,
|
|
136
146
|
written: null,
|
|
137
147
|
})));
|
|
@@ -142,7 +152,7 @@ export function entryScope(rooms, roomTypes, connection) {
|
|
|
142
152
|
async results(queries) {
|
|
143
153
|
const results = {};
|
|
144
154
|
for (const [name, query] of Object.entries(queries)) {
|
|
145
|
-
const plan =
|
|
155
|
+
const plan = entryPlan(query, planned);
|
|
146
156
|
results[name] = answerQuery(connection, plan, keys.filter(({ locator }) => plan.rooms === null || plan.rooms.includes(locator)));
|
|
147
157
|
}
|
|
148
158
|
return results;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ChangeSet } from './change-set.js';
|
|
2
|
+
import type { GroupTotal, PendingResult } from './query.js';
|
|
3
|
+
import type { Deliver, Fail } from './reach.js';
|
|
4
|
+
import type { ConversationTally, RoomTally } from './tallies.js';
|
|
5
|
+
import type { QueryRoom } from './tables.js';
|
|
6
|
+
export declare const HOUSE_DIRECTORY = "house";
|
|
7
|
+
export declare const ROOM_TOTALS: {
|
|
8
|
+
readonly outside: readonly ["house"];
|
|
9
|
+
readonly groupBy: readonly ["room"];
|
|
10
|
+
readonly select: {
|
|
11
|
+
readonly size: true;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export type DayFigures = {
|
|
15
|
+
readonly created: number;
|
|
16
|
+
readonly changed: number;
|
|
17
|
+
readonly chats: number;
|
|
18
|
+
readonly messages: number;
|
|
19
|
+
};
|
|
20
|
+
export type RoomFigures = {
|
|
21
|
+
readonly room: string;
|
|
22
|
+
readonly day: DayFigures;
|
|
23
|
+
readonly total: {
|
|
24
|
+
readonly documents: GroupTotal;
|
|
25
|
+
readonly files: GroupTotal;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export type Figures = {
|
|
29
|
+
readonly rooms: readonly RoomFigures[];
|
|
30
|
+
readonly agentMessages: number;
|
|
31
|
+
};
|
|
32
|
+
export type FiguresResult = Figures | PendingResult;
|
|
33
|
+
export type FiguresCover = PendingResult | {
|
|
34
|
+
readonly rooms: readonly QueryRoom[];
|
|
35
|
+
};
|
|
36
|
+
export type FiguresSources = {
|
|
37
|
+
cover(): Promise<FiguresCover>;
|
|
38
|
+
rooms(rooms: readonly QueryRoom[], since: string): Promise<readonly RoomTally[]>;
|
|
39
|
+
conversations(conversations: readonly string[] | null, since: string): Promise<readonly ConversationTally[]>;
|
|
40
|
+
};
|
|
41
|
+
export type FiguresRead = {
|
|
42
|
+
watch(deliver: Deliver, fail: Fail): () => void;
|
|
43
|
+
touched(set: ChangeSet): void;
|
|
44
|
+
recover(): void;
|
|
45
|
+
close(): void;
|
|
46
|
+
};
|
|
47
|
+
export declare function createFigures(sources: FiguresSources): FiguresRead;
|
|
48
|
+
//# sourceMappingURL=figures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figures.d.ts","sourceRoot":"","sources":["../src/figures.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,cAAc,C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,CAAC,SAAS,iBAAiB,EAAE,CAAC,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,IAAI,CAAC;IAChD,OAAO,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC;IAC9B,OAAO,IAAI,IAAI,CAAC;IAChB,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAgDF,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,WAAW,CAsIlE"}
|
package/dist/figures.js
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { instantKey } from '@agentshouse/mdmodel';
|
|
2
|
+
export const HOUSE_DIRECTORY = 'house';
|
|
3
|
+
export const ROOM_TOTALS = {
|
|
4
|
+
outside: [HOUSE_DIRECTORY],
|
|
5
|
+
groupBy: ['room'],
|
|
6
|
+
select: { size: true },
|
|
7
|
+
};
|
|
8
|
+
// Today's Last 24 hours is the day that ends as the read answers.
|
|
9
|
+
const DAY_MS = 86_400_000;
|
|
10
|
+
// An install or a catch-up commits many times a second, so the figures answer again once changes rest this long, never per commit.
|
|
11
|
+
const SETTLED_MS = 1_000;
|
|
12
|
+
// Changes that never rest, such as an Agent writing all afternoon, still reach the figures this long after the first of them.
|
|
13
|
+
const LONGEST_UNSETTLED_MS = 5_000;
|
|
14
|
+
function dayOf(tally, since) {
|
|
15
|
+
const after = (at) => at !== null && at >= since;
|
|
16
|
+
return {
|
|
17
|
+
created: tally.documentTimes.filter(([created]) => after(created)).length,
|
|
18
|
+
changed: tally.documentTimes.filter(([created, changed]) => !after(created) && after(changed))
|
|
19
|
+
.length,
|
|
20
|
+
chats: tally.chatTimes.filter(after).length,
|
|
21
|
+
messages: tally.messageTimes.filter(after).length,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function figuresOf(rooms, held, since) {
|
|
25
|
+
return {
|
|
26
|
+
rooms: rooms.map(({ locator }) => {
|
|
27
|
+
const tally = held.rooms.get(locator);
|
|
28
|
+
return {
|
|
29
|
+
room: locator,
|
|
30
|
+
day: dayOf(tally, since),
|
|
31
|
+
total: { documents: tally.documents, files: tally.files },
|
|
32
|
+
};
|
|
33
|
+
}),
|
|
34
|
+
agentMessages: [...held.said.values()].reduce((sum, said) => sum + said.filter((at) => at >= since).length, 0),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function unheld() {
|
|
38
|
+
return {
|
|
39
|
+
rooms: new Map(),
|
|
40
|
+
said: new Map(),
|
|
41
|
+
staleRooms: new Set(),
|
|
42
|
+
staleConversations: new Set(),
|
|
43
|
+
everyConversation: true,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export function createFigures(sources) {
|
|
47
|
+
const listeners = new Map();
|
|
48
|
+
const answered = new Set();
|
|
49
|
+
let held = unheld();
|
|
50
|
+
let shown = null;
|
|
51
|
+
let running = false;
|
|
52
|
+
let again = false;
|
|
53
|
+
let quiet = null;
|
|
54
|
+
let longest = null;
|
|
55
|
+
let closed = false;
|
|
56
|
+
function unscheduled() {
|
|
57
|
+
if (quiet !== null)
|
|
58
|
+
clearTimeout(quiet);
|
|
59
|
+
if (longest !== null)
|
|
60
|
+
clearTimeout(longest);
|
|
61
|
+
quiet = null;
|
|
62
|
+
longest = null;
|
|
63
|
+
}
|
|
64
|
+
function deliver(answer) {
|
|
65
|
+
const text = JSON.stringify(answer);
|
|
66
|
+
const changed = text !== shown;
|
|
67
|
+
shown = text;
|
|
68
|
+
for (const listener of listeners.keys()) {
|
|
69
|
+
if (changed || !answered.has(listener))
|
|
70
|
+
listener(structuredClone(answer));
|
|
71
|
+
answered.add(listener);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async function tallied(rooms, since) {
|
|
75
|
+
for (const locator of held.rooms.keys()) {
|
|
76
|
+
if (!rooms.some((room) => room.locator === locator))
|
|
77
|
+
held.rooms.delete(locator);
|
|
78
|
+
}
|
|
79
|
+
const asked = rooms.filter(({ locator, key }) => held.staleRooms.has(locator) || held.rooms.get(locator)?.key !== key);
|
|
80
|
+
for (const { locator } of asked)
|
|
81
|
+
held.staleRooms.delete(locator);
|
|
82
|
+
const every = held.everyConversation;
|
|
83
|
+
const conversations = every ? null : [...held.staleConversations];
|
|
84
|
+
held.everyConversation = false;
|
|
85
|
+
held.staleConversations.clear();
|
|
86
|
+
const kept = held;
|
|
87
|
+
const [roomTallies, said] = await Promise.all([
|
|
88
|
+
asked.length === 0 ? [] : sources.rooms(asked, since),
|
|
89
|
+
conversations?.length === 0 ? [] : sources.conversations(conversations, since),
|
|
90
|
+
]);
|
|
91
|
+
if (kept !== held)
|
|
92
|
+
return false;
|
|
93
|
+
for (const tally of roomTallies) {
|
|
94
|
+
const room = asked.find(({ key }) => key === tally.key);
|
|
95
|
+
if (room !== undefined)
|
|
96
|
+
held.rooms.set(room.locator, tally);
|
|
97
|
+
}
|
|
98
|
+
if (every)
|
|
99
|
+
held.said.clear();
|
|
100
|
+
for (const { conversation, said: times } of said) {
|
|
101
|
+
if (times.length === 0)
|
|
102
|
+
held.said.delete(conversation);
|
|
103
|
+
else
|
|
104
|
+
held.said.set(conversation, times);
|
|
105
|
+
}
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
async function answer() {
|
|
109
|
+
const window = new Date(Date.now() - DAY_MS).toISOString();
|
|
110
|
+
const cover = await sources.cover();
|
|
111
|
+
if ('pending' in cover)
|
|
112
|
+
return cover;
|
|
113
|
+
if (!(await tallied(cover.rooms, window)))
|
|
114
|
+
return null;
|
|
115
|
+
return figuresOf(cover.rooms, held, instantKey(window));
|
|
116
|
+
}
|
|
117
|
+
async function run() {
|
|
118
|
+
if (running) {
|
|
119
|
+
again = true;
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
running = true;
|
|
123
|
+
try {
|
|
124
|
+
do {
|
|
125
|
+
again = false;
|
|
126
|
+
const result = await answer();
|
|
127
|
+
if (closed || listeners.size === 0)
|
|
128
|
+
return;
|
|
129
|
+
if (result === null)
|
|
130
|
+
again = true;
|
|
131
|
+
else
|
|
132
|
+
deliver(result);
|
|
133
|
+
} while (again && !closed && listeners.size > 0);
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
for (const [listener, failed] of listeners) {
|
|
137
|
+
if (!answered.has(listener))
|
|
138
|
+
failed(error);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
finally {
|
|
142
|
+
running = false;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function stop(listener) {
|
|
146
|
+
return () => {
|
|
147
|
+
listeners.delete(listener);
|
|
148
|
+
answered.delete(listener);
|
|
149
|
+
if (listeners.size > 0)
|
|
150
|
+
return;
|
|
151
|
+
unscheduled();
|
|
152
|
+
held = unheld();
|
|
153
|
+
shown = null;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function settle() {
|
|
157
|
+
if (closed || listeners.size === 0)
|
|
158
|
+
return;
|
|
159
|
+
const now = () => {
|
|
160
|
+
unscheduled();
|
|
161
|
+
void run();
|
|
162
|
+
};
|
|
163
|
+
if (quiet !== null)
|
|
164
|
+
clearTimeout(quiet);
|
|
165
|
+
quiet = setTimeout(now, SETTLED_MS);
|
|
166
|
+
longest ??= setTimeout(now, LONGEST_UNSETTLED_MS);
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
watch(listener, failed) {
|
|
170
|
+
listeners.set(listener, failed);
|
|
171
|
+
void run();
|
|
172
|
+
return stop(listener);
|
|
173
|
+
},
|
|
174
|
+
touched(set) {
|
|
175
|
+
if (listeners.size === 0)
|
|
176
|
+
return;
|
|
177
|
+
for (const { locator } of set.documents)
|
|
178
|
+
held.staleRooms.add(locator);
|
|
179
|
+
for (const locator of set.rooms)
|
|
180
|
+
held.staleRooms.add(locator);
|
|
181
|
+
for (const conversation of set.conversations)
|
|
182
|
+
held.staleConversations.add(conversation);
|
|
183
|
+
if (set.documents.length + set.rooms.length + set.conversations.length > 0)
|
|
184
|
+
settle();
|
|
185
|
+
},
|
|
186
|
+
recover() {
|
|
187
|
+
if (listeners.size > 0)
|
|
188
|
+
settle();
|
|
189
|
+
},
|
|
190
|
+
close() {
|
|
191
|
+
closed = true;
|
|
192
|
+
unscheduled();
|
|
193
|
+
listeners.clear();
|
|
194
|
+
answered.clear();
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
}
|
package/dist/host.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type MdRuntimeOptions } from './connection.js';
|
|
2
2
|
import type { PortReach } from './reach.js';
|
|
3
|
-
import type { CodeAvailability, Persistence, Readiness
|
|
3
|
+
import type { CodeAvailability, Persistence, Readiness } from './readiness.js';
|
|
4
4
|
import type { EntrySeed } from './seed.js';
|
|
5
5
|
import { type RuntimePort } from './wire.js';
|
|
6
6
|
export type MdRuntimeHostOptions = MdRuntimeOptions & {
|
|
@@ -11,21 +11,19 @@ export type AttachedPort = {
|
|
|
11
11
|
narrow(reach: PortReach): void;
|
|
12
12
|
readiness(deliver: (readiness: Readiness) => void): () => void;
|
|
13
13
|
answered(queries: readonly unknown[], done: () => void): void;
|
|
14
|
-
code(code: CodeAvailability, space: Space | null): void;
|
|
15
|
-
search(search: SearchObligation): void;
|
|
16
14
|
};
|
|
17
15
|
export type MdRuntimeHost = {
|
|
18
|
-
attach(port: RuntimePort, app: string, release?: string, reach?: PortReach, code?: CodeAvailability
|
|
16
|
+
attach(port: RuntimePort, app: string, release?: string, reach?: PortReach, code?: CodeAvailability): AttachedPort;
|
|
17
|
+
present(app: string, members: Readonly<Record<string, unknown>>): Promise<void>;
|
|
19
18
|
seed(entry: EntrySeed): void;
|
|
20
19
|
persisted(answer: Persistence): void;
|
|
21
20
|
endAuthorization(holder?: string): Promise<void>;
|
|
22
|
-
lose(locators: readonly string[]): Promise<void>;
|
|
23
21
|
stop(): Promise<void>;
|
|
24
22
|
};
|
|
25
23
|
export declare function serveMdRuntime(options: MdRuntimeHostOptions): MdRuntimeHost;
|
|
26
24
|
export { entrySeedOf, type EntrySeed } from './seed.js';
|
|
27
25
|
export type { PortReach, ReachedDocument } from './reach.js';
|
|
28
|
-
export type { CodeAvailability, Persistence,
|
|
26
|
+
export type { CodeAvailability, Persistence, Space } from './readiness.js';
|
|
29
27
|
export { createRecovery, retryDelay, type Attempt, type Attempted, type AttemptOptions, type Recovery, type RecoveryOptions, } from './recovery.js';
|
|
30
28
|
export type { RuntimePort } from './wire.js';
|
|
31
29
|
//# sourceMappingURL=host.d.ts.map
|
package/dist/host.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,EAGL,KAAK,WAAW,EAOjB,MAAM,WAAW,CAAC;AAInB,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpF,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,IAAI,IAAI,CAAC;IACf,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,OAAO,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC/D,QAAQ,CAAC,OAAO,EAAE,SAAS,OAAO,EAAE,EAAE,IAAI,EAAE,MA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|
-
import { queryKey } from './query.js';
|
|
3
3
|
import { untilAnswered } from './recovery.js';
|
|
4
4
|
import { described } from './failure.js';
|
|
5
|
+
import { answeredResult } from './outcome.js';
|
|
5
6
|
import { AUTHORIZATION_ENDED, request, WIRE, } from './wire.js';
|
|
6
7
|
const NARROWED = new Set(['within', 'whole']);
|
|
7
8
|
function answered(md, app, writtenBy, member, input) {
|
|
@@ -40,6 +41,12 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
40
41
|
return md.log();
|
|
41
42
|
case 'cleanUp':
|
|
42
43
|
return md.cleanUp();
|
|
44
|
+
case 'unsent':
|
|
45
|
+
return md.unsent();
|
|
46
|
+
case 'reset':
|
|
47
|
+
return md.reset();
|
|
48
|
+
case 'readAgain':
|
|
49
|
+
return md.readAgain();
|
|
43
50
|
case 'persistence':
|
|
44
51
|
return md.persistence();
|
|
45
52
|
case 'retry':
|
|
@@ -74,8 +81,6 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
74
81
|
return md.conversation.interrupt(input[0]);
|
|
75
82
|
case 'conversation.kill':
|
|
76
83
|
return md.conversation.kill(input[0]);
|
|
77
|
-
case 'conversation.cancel':
|
|
78
|
-
return md.conversation.cancel(input[0], input[1]);
|
|
79
84
|
case 'conversation.delete':
|
|
80
85
|
return md.conversation.delete(input[0]);
|
|
81
86
|
case 'chatDraft.write':
|
|
@@ -94,9 +99,6 @@ function attempted(work) {
|
|
|
94
99
|
return Promise.reject(error);
|
|
95
100
|
}
|
|
96
101
|
}
|
|
97
|
-
function answeredResult(value) {
|
|
98
|
-
return typeof value === 'object' && value !== null && !('pending' in value);
|
|
99
|
-
}
|
|
100
102
|
function answeredMessage(value) {
|
|
101
103
|
if (typeof value !== 'object' || value === null)
|
|
102
104
|
return false;
|
|
@@ -121,12 +123,11 @@ export function serveMdRuntime(options) {
|
|
|
121
123
|
deliver(structuredClone(deploymentFacts));
|
|
122
124
|
return () => { };
|
|
123
125
|
};
|
|
124
|
-
function attach(port, app, release, reach, code = 'stored'
|
|
126
|
+
function attach(port, app, release, reach, code = 'stored') {
|
|
125
127
|
if (!authorized)
|
|
126
128
|
throw new Error(AUTHORIZATION_ENDED);
|
|
127
129
|
const writtenBy = release === undefined ? undefined : { app, release };
|
|
128
|
-
|
|
129
|
-
const view = runtime.within(reach ?? null, facts);
|
|
130
|
+
const view = runtime.within(reach ?? null, { target: app, code });
|
|
130
131
|
const observations = new Map();
|
|
131
132
|
const followed = new Set();
|
|
132
133
|
const answeredKeys = new Set();
|
|
@@ -164,9 +165,16 @@ export function serveMdRuntime(options) {
|
|
|
164
165
|
if (topic === 'query' && answeredMessage(value))
|
|
165
166
|
answeredQuery(input[0]);
|
|
166
167
|
};
|
|
168
|
+
const fail = (error) => {
|
|
169
|
+
if (!serving || resolved)
|
|
170
|
+
return;
|
|
171
|
+
observations.get(id)?.();
|
|
172
|
+
observations.delete(id);
|
|
173
|
+
send({ kind: 'failure', id, ...described(error) });
|
|
174
|
+
};
|
|
167
175
|
observations.set(id, topic === 'deployment-facts'
|
|
168
176
|
? watchFacts(deliver)
|
|
169
|
-
: (NARROWED.has(WIRE.topics[topic]) ? view : runtime).watch(topic, topic === 'presentation' ? [app] : input, deliver));
|
|
177
|
+
: (NARROWED.has(WIRE.topics[topic]) ? view : runtime).watch(topic, topic === 'presentation' ? [app] : input, deliver, fail));
|
|
170
178
|
};
|
|
171
179
|
const reply = async (id, query, pending) => {
|
|
172
180
|
try {
|
|
@@ -227,18 +235,6 @@ export function serveMdRuntime(options) {
|
|
|
227
235
|
if (serving)
|
|
228
236
|
view.narrow(next);
|
|
229
237
|
},
|
|
230
|
-
code(next, space) {
|
|
231
|
-
if (!serving)
|
|
232
|
-
return;
|
|
233
|
-
facts = { ...facts, code: next, space };
|
|
234
|
-
view.facts(facts);
|
|
235
|
-
},
|
|
236
|
-
search(next) {
|
|
237
|
-
if (!serving)
|
|
238
|
-
return;
|
|
239
|
-
facts = { ...facts, search: next };
|
|
240
|
-
view.facts(facts);
|
|
241
|
-
},
|
|
242
238
|
answered(queries, done) {
|
|
243
239
|
const keys = queries.map(queryKey);
|
|
244
240
|
if (keys.every((key) => answeredKeys.has(key)))
|
|
@@ -252,7 +248,7 @@ export function serveMdRuntime(options) {
|
|
|
252
248
|
const stop = view.watch('readiness', [], (value) => {
|
|
253
249
|
if (serving)
|
|
254
250
|
deliver(value);
|
|
255
|
-
});
|
|
251
|
+
}, () => { });
|
|
256
252
|
const end = () => {
|
|
257
253
|
followed.delete(end);
|
|
258
254
|
stop();
|
|
@@ -264,6 +260,9 @@ export function serveMdRuntime(options) {
|
|
|
264
260
|
}
|
|
265
261
|
return {
|
|
266
262
|
attach,
|
|
263
|
+
present(app, members) {
|
|
264
|
+
return md.presentation.edit(app, members);
|
|
265
|
+
},
|
|
267
266
|
seed(entry) {
|
|
268
267
|
runtime.seed(entry);
|
|
269
268
|
},
|
|
@@ -281,9 +280,6 @@ export function serveMdRuntime(options) {
|
|
|
281
280
|
await options.shell.dropGeneration();
|
|
282
281
|
}
|
|
283
282
|
},
|
|
284
|
-
lose(locators) {
|
|
285
|
-
return runtime.lose(locators);
|
|
286
|
-
},
|
|
287
283
|
stop() {
|
|
288
284
|
return runtime.stop();
|
|
289
285
|
},
|
package/dist/identity.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare function changeBatchIdentity(at?: number): string;
|
|
2
|
-
export declare function identityTime(identity: string): number;
|
|
3
2
|
export declare function roomDraftRevision(): string;
|
|
4
3
|
export declare function chatDraftRevision(): string;
|
|
5
4
|
export declare function transferIdentity(): string;
|
package/dist/identity.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,EAAE,GAAE,MAAmB,GAAG,MAAM,CAWnE;
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,EAAE,GAAE,MAAmB,GAAG,MAAM,CAWnE;AAQD,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
|
package/dist/identity.js
CHANGED
|
@@ -10,9 +10,6 @@ export function changeBatchIdentity(at = Date.now()) {
|
|
|
10
10
|
const hex = [...bytes].map((byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
11
11
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
12
12
|
}
|
|
13
|
-
export function identityTime(identity) {
|
|
14
|
-
return Number.parseInt(identity.replaceAll('-', '').slice(0, 12), 16);
|
|
15
|
-
}
|
|
16
13
|
function randomIdentity() {
|
|
17
14
|
const bytes = new Uint8Array(16);
|
|
18
15
|
crypto.getRandomValues(bytes);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,38 @@
|
|
|
1
|
-
export type { AcceptedMessage, AcceptedRoom, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, AttachRequest, AttachResult, Authorization, BinaryFile, BinaryLinkResult, BinaryRequest, BinaryResult, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction,
|
|
1
|
+
export type { AcceptedMessage, AcceptedRoom, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, AttachRequest, AttachResult, AuthorityChange, Authorization, BinaryFile, 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, ListedAgent, ListedConversation, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomChange, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, SearchAnswer, SearchAsk, ServiceMode, ServiceModeSignal, TransportUncertainty, TurnContext, TurnOperation, TypedPath, TypedSelection, } from './adapter.js';
|
|
2
2
|
export type { Change, ChangeBatch, Precondition, RoomMove, WrittenBy } from './change.js';
|
|
3
|
-
export
|
|
4
|
-
export type {
|
|
3
|
+
export { heldFacts } from './conversation-row.js';
|
|
4
|
+
export type { ConversationAsk, ConversationHeld, ConversationLast, ConversationStart, } from './conversation-row.js';
|
|
5
|
+
export type { ChatDraft, ChatDraftSurface, ConversationAgent, ConversationAnswer, ConversationEntry, ConversationOptions, ConversationRead, ConversationState, ConversationSurface, ConversationView, RunningTurn, } from './conversation.js';
|
|
6
|
+
export type { AppRoom, AppTypedSelection, ConnectionRefusal, ConnectionRefusalCode, HistoryQuery, MdRuntime, MdRuntimeOptions, RoomSchemas, } from './connection.js';
|
|
7
|
+
export type { BinaryFileSurface, SavedParts, SavedRoomDraft, SaveResult } from './saves.js';
|
|
5
8
|
export type { Observation } from './observation.js';
|
|
9
|
+
export type { DayFigures, Figures, FiguresResult, RoomFigures } from './figures.js';
|
|
10
|
+
export type { PresentationSurface, RoomDraftSurface } from './room-drafts.js';
|
|
6
11
|
export type { AttachAnswer, BinaryAnswer, BinaryLinkAnswer, CallResult, DownloadAnswer, Failure, HistoryAnswer, Offline, QueueEntry, Resolution, Submission, } from './outcome.js';
|
|
7
12
|
export type { BinaryFileRecord } from './binary.js';
|
|
8
13
|
export type { RuntimeError } from './failure.js';
|
|
9
14
|
export type { ChangedPart, FieldValue, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, TextParts, } from './room-draft.js';
|
|
10
15
|
export type { SaveRefusal } from './save.js';
|
|
11
|
-
export type {
|
|
16
|
+
export type { SearchFound, SearchHit, SearchRequest, SearchResult } from './search.js';
|
|
17
|
+
export { CHAT_MESSAGE_TYPE, CHAT_TYPE } from './chat-types.js';
|
|
12
18
|
export { departure } from './change.js';
|
|
13
|
-
export { partsAfter, partsChanges } from './room-draft.js';
|
|
19
|
+
export { lineEnded, partsAfter, partsChanges } from './room-draft.js';
|
|
14
20
|
export { cutName, nameFrom, transliterated } from './name.js';
|
|
15
21
|
export { HISTORY_CONVERSATIONS, SESSION_STARTED } from './conversation.js';
|
|
22
|
+
export { contextFigure } from './context.js';
|
|
23
|
+
export { jobsRunning, openJobs, sessionEnded, type OpenJob, type RunningJob } from './job.js';
|
|
16
24
|
export { changeBatchIdentity } from './identity.js';
|
|
17
25
|
export { paced, ROW_WEIGHT, stepped } from './turn.js';
|
|
18
26
|
export { untilAnswered } from './recovery.js';
|
|
19
27
|
export { entriesIn, patching, sortedKeys } from './shared.js';
|
|
20
28
|
export { attempts, identities, intentOf, type Answered, type Attempt, type Attempts, type Identities, } from './attempt.js';
|
|
21
29
|
export { expectedList, expecting, type ExpectedOf, type Expecting } from './expectation.js';
|
|
22
|
-
export type { RuntimeShell } from './durability.js';
|
|
23
|
-
export type { CodeAvailability, ConnectionAvailability, ConversationCoverage, Durability, HouseOutcome, Installation, InstallationAmount, InstallationStep, Persistence, Readiness, ReadinessStatus, RoomCoverage, RoomPreparation,
|
|
30
|
+
export type { RuntimeShell, UnsentKind, UnsentWork } from './durability.js';
|
|
31
|
+
export type { CodeAvailability, ConnectionAvailability, ConversationCoverage, Durability, HouseOutcome, Installation, InstallationAmount, InstallationStep, Persistence, Readiness, ReadinessStatus, RoomCoverage, RoomPreparation, Space, TargetCoverage, } from './readiness.js';
|
|
32
|
+
export type { ObservedRead } from './reads.js';
|
|
24
33
|
export type { AttentionEntry, SyncStatus } from './status.js';
|
|
25
|
-
export type {
|
|
34
|
+
export type { Direction, DocumentQuery, Filter, GroupKey, GroupOrder, GroupQuery, GroupSelect, Key, LocalQuery, OrderOptions, Predicate, Related, Select, Value, Where, } from '@agentshouse/mdmodel';
|
|
35
|
+
export type { Awaits, Backlink, CoveredRoom, DocumentResult, GroupResult, GroupTotal, PendingResult, PendingRoom, QueryCoverage, QueryDocument, QueryGroup, QueryResult, QueryRows, } from './query.js';
|
|
26
36
|
export type { MdType, ModelIdentity, ModelSnapshot, ModelState, ModelResult, TypesResult, ValidationReceipt, } from './model.js';
|
|
27
37
|
export type { OperationScopes, ReplicaAdmission, ScopedRefusal } from './adapter.js';
|
|
28
38
|
//# sourceMappingURL=index.d.ts.map
|
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,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,
|
|
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,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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AAY,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"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
export { heldFacts } from './conversation-row.js';
|
|
2
|
+
export { CHAT_MESSAGE_TYPE, CHAT_TYPE } from './chat-types.js';
|
|
1
3
|
export { departure } from './change.js';
|
|
2
|
-
export { partsAfter, partsChanges } from './room-draft.js';
|
|
4
|
+
export { lineEnded, partsAfter, partsChanges } from './room-draft.js';
|
|
3
5
|
export { cutName, nameFrom, transliterated } from './name.js';
|
|
4
6
|
export { HISTORY_CONVERSATIONS, SESSION_STARTED } from './conversation.js';
|
|
7
|
+
export { contextFigure } from './context.js';
|
|
8
|
+
export { jobsRunning, openJobs, sessionEnded } from './job.js';
|
|
5
9
|
export { changeBatchIdentity } from './identity.js';
|
|
6
10
|
export { paced, ROW_WEIGHT, stepped } from './turn.js';
|
|
7
11
|
export { untilAnswered } from './recovery.js';
|