@agentshouse/mdruntime 0.1.0-c0bed82db8d73 → 0.1.0-c0c1e81da9166
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 +3 -2
- package/dist/adapter.d.ts +101 -71
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +4 -10
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +35 -46
- package/dist/bootstrap.d.ts +16 -15
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +273 -131
- 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 +15 -9
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +54 -6
- package/dist/collection.d.ts +7 -4
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +24 -19
- package/dist/compile.d.ts +6 -6
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +278 -282
- package/dist/connection.d.ts +16 -11
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +2312 -1988
- 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 +27 -18
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +489 -260
- package/dist/durability.d.ts +6 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/entry.d.ts +3 -2
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +18 -8
- package/dist/figures.d.ts +48 -0
- package/dist/figures.d.ts.map +1 -0
- package/dist/figures.js +197 -0
- package/dist/file.d.ts +2 -11
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +6 -4
- package/dist/host.d.ts +3 -7
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +26 -29
- 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 +16 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- 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 +62 -20
- package/dist/media.d.ts +8 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +218 -0
- package/dist/memory.d.ts +13 -6
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +218 -91
- 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 +8 -10
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +6 -18
- package/dist/observation.d.ts +3 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +8 -3
- package/dist/outcome.d.ts +13 -5
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +16 -2
- 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/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +4 -0
- package/dist/query.d.ts +18 -207
- 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 +18 -11
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +201 -126
- package/dist/react.d.ts +3 -1
- 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 +3 -17
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +4 -10
- package/dist/recovery.d.ts +1 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +35 -1
- package/dist/refresh.d.ts +7 -5
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +34 -10
- package/dist/replica.d.ts +10 -9
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +53 -21
- package/dist/room-draft.d.ts +21 -5
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +98 -51
- package/dist/rows.d.ts +18 -16
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +45 -153
- package/dist/save.d.ts +2 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +22 -13
- package/dist/search.d.ts +12 -63
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +9 -52
- package/dist/shared.d.ts +0 -1
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +0 -10
- 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 +4 -5
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -7
- package/dist/store.d.ts +104 -62
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +159 -161
- package/dist/stored.d.ts +66 -55
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +343 -273
- package/dist/tables.d.ts +110 -65
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +188 -99
- package/dist/tallies.d.ts +18 -0
- package/dist/tallies.d.ts.map +1 -0
- package/dist/tallies.js +129 -0
- package/dist/transfer.d.ts +0 -5
- package/dist/transfer.d.ts.map +1 -1
- package/dist/validation.d.ts +3 -4
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +42 -100
- 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 +18 -8
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +6 -2
- package/package.json +2 -3
- package/AGENTS.md +0 -312
- 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 -368
- package/dist/reads.d.ts +0 -11
- package/dist/reads.d.ts.map +0 -1
- package/dist/reads.js +0 -100
- package/dist/words.d.ts +0 -19
- package/dist/words.d.ts.map +0 -1
- package/dist/words.js +0 -150
package/dist/durability.d.ts
CHANGED
|
@@ -1,11 +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
|
-
onScreen: boolean;
|
|
6
10
|
keepGeneration(value: string): void | Promise<void>;
|
|
7
11
|
dropGeneration(): void | Promise<void>;
|
|
8
12
|
cleanUp?(): Promise<number>;
|
|
13
|
+
reset(): Promise<void>;
|
|
9
14
|
};
|
|
10
15
|
export declare function refusedForSpace(error: unknown): boolean;
|
|
11
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,
|
|
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,11 +1,12 @@
|
|
|
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;
|
|
8
8
|
documents: Readonly<Record<string, string>>;
|
|
9
|
+
revisions?: Readonly<Record<string, string>>;
|
|
9
10
|
};
|
|
10
11
|
export type EntryArguments = Readonly<Record<string, string>>;
|
|
11
12
|
export type EntryParameterKind = 'string' | 'integer' | 'number' | 'boolean';
|
package/dist/entry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"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,EAAyB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAGnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5C,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE9D,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AA0D7E,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAE3E;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAMpE;AAyCD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAQ7D;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;CACzF,CAAC;AAEF,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,UAAU,GACrB,UAAU,CAoDZ"}
|
package/dist/entry.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
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
|
-
revision: null,
|
|
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,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,eAAe,UAAU,CAAC;AAEvC,eAAO,MAAM,WAAW;;;;iBAGZ,IAAI;;CACe,CAAC;AAWhC,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;KAAE,CAAC;CAChF,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,CAAC;IAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjG,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,aAAa,CAAC;AAEpD,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,CAAA;CAAE,CAAC;AAEpF,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,KAAK,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,SAAS,EAAE,CAAC,CAAC;IACjF,aAAa,CACX,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,EACvC,KAAK,EAAE,MAAM,GACZ,OAAO,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/file.d.ts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
blob: Blob;
|
|
4
|
-
};
|
|
5
|
-
export type FileDeclaration = {
|
|
6
|
-
name: string;
|
|
7
|
-
mediaType: string;
|
|
8
|
-
byteLength: number;
|
|
9
|
-
contentHash: string;
|
|
10
|
-
};
|
|
11
|
-
export declare function declaredFile(file: ChosenFile): Promise<FileDeclaration>;
|
|
1
|
+
import type { AttachRequest } from './adapter.js';
|
|
2
|
+
export declare function attachedFile(locator: string, file: File): Promise<AttachRequest>;
|
|
12
3
|
//# sourceMappingURL=file.d.ts.map
|
package/dist/file.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,CAStF"}
|
package/dist/file.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { sha256 } from './digest.js';
|
|
2
|
-
export async function
|
|
2
|
+
export async function attachedFile(locator, file) {
|
|
3
3
|
return {
|
|
4
|
+
locator,
|
|
4
5
|
name: file.name,
|
|
5
|
-
mediaType: file.
|
|
6
|
-
byteLength: file.
|
|
7
|
-
|
|
6
|
+
mediaType: file.type,
|
|
7
|
+
byteLength: file.size,
|
|
8
|
+
sha256: await sha256(file),
|
|
9
|
+
blob: file,
|
|
8
10
|
};
|
|
9
11
|
}
|
package/dist/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,22 +11,18 @@ 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;
|
|
19
17
|
seed(entry: EntrySeed): void;
|
|
20
18
|
persisted(answer: Persistence): void;
|
|
21
|
-
shown(onScreen: boolean): void;
|
|
22
19
|
endAuthorization(holder?: string): Promise<void>;
|
|
23
|
-
lose(locators: readonly string[]): Promise<void>;
|
|
24
20
|
stop(): Promise<void>;
|
|
25
21
|
};
|
|
26
22
|
export declare function serveMdRuntime(options: MdRuntimeHostOptions): MdRuntimeHost;
|
|
27
23
|
export { entrySeedOf, type EntrySeed } from './seed.js';
|
|
28
24
|
export type { PortReach, ReachedDocument } from './reach.js';
|
|
29
|
-
export type { CodeAvailability, Persistence,
|
|
25
|
+
export type { CodeAvailability, Persistence, Space } from './readiness.js';
|
|
30
26
|
export { createRecovery, retryDelay, type Attempt, type Attempted, type AttemptOptions, type Recovery, type RecoveryOptions, } from './recovery.js';
|
|
31
27
|
export type { RuntimePort } from './wire.js';
|
|
32
28
|
//# 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,EAGtB,MAAM,iBAAiB,CAAC;AAEzB,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;AAE3C,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,MAAM,IAAI,GAAG,IAAI,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,CACJ,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,SAAS,EACjB,IAAI,CAAC,EAAE,gBAAgB,GACtB,YAAY,CAAC;IAChB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IAC7B,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IACrC,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB,CAAC;AAwIF,wBAAgB,cAAc,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAoL3E;AAED,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACxD,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7D,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EACL,cAAc,EACd,UAAU,EACV,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/host.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { queryKey } from '@agentshouse/mdmodel';
|
|
1
2
|
import { composeRuntime, } from './connection.js';
|
|
2
|
-
import {
|
|
3
|
+
import { untilAnswered } from './recovery.js';
|
|
3
4
|
import { described } from './failure.js';
|
|
4
5
|
import { AUTHORIZATION_ENDED, request, WIRE, } from './wire.js';
|
|
5
6
|
const NARROWED = new Set(['within', 'whole']);
|
|
@@ -25,6 +26,10 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
25
26
|
return md.binaryFile.read(input[0], input[1], input[2]);
|
|
26
27
|
case 'binaryFile.link':
|
|
27
28
|
return md.binaryFile.link(input[0], input[1], input[2]);
|
|
29
|
+
case 'binaryFile.show':
|
|
30
|
+
return md.binaryFile.show(input[0], input[1], input[2]);
|
|
31
|
+
case 'binaryFile.attach':
|
|
32
|
+
return md.binaryFile.attach(input[0], input[1]);
|
|
28
33
|
case 'binaryFile.part':
|
|
29
34
|
return md.binaryFile.part(input[0], input[1]);
|
|
30
35
|
case 'call':
|
|
@@ -35,6 +40,10 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
35
40
|
return md.log();
|
|
36
41
|
case 'cleanUp':
|
|
37
42
|
return md.cleanUp();
|
|
43
|
+
case 'unsent':
|
|
44
|
+
return md.unsent();
|
|
45
|
+
case 'reset':
|
|
46
|
+
return md.reset();
|
|
38
47
|
case 'persistence':
|
|
39
48
|
return md.persistence();
|
|
40
49
|
case 'retry':
|
|
@@ -63,16 +72,12 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
63
72
|
return md.conversation.create(input[0]);
|
|
64
73
|
case 'conversation.send':
|
|
65
74
|
return md.conversation.send(input[0], input[1], input[2]);
|
|
66
|
-
case 'conversation.attach':
|
|
67
|
-
return md.conversation.attach(input[0], input[1]);
|
|
68
75
|
case 'conversation.answer':
|
|
69
76
|
return md.conversation.answer(input[0], input[1]);
|
|
70
77
|
case 'conversation.interrupt':
|
|
71
78
|
return md.conversation.interrupt(input[0]);
|
|
72
79
|
case 'conversation.kill':
|
|
73
80
|
return md.conversation.kill(input[0]);
|
|
74
|
-
case 'conversation.cancel':
|
|
75
|
-
return md.conversation.cancel(input[0], input[1]);
|
|
76
81
|
case 'conversation.delete':
|
|
77
82
|
return md.conversation.delete(input[0]);
|
|
78
83
|
case 'chatDraft.write':
|
|
@@ -112,16 +117,17 @@ export function serveMdRuntime(options) {
|
|
|
112
117
|
const { md } = runtime;
|
|
113
118
|
const attachments = new Map();
|
|
114
119
|
let authorized = true;
|
|
120
|
+
let opening = null;
|
|
121
|
+
const opened = () => (opening ??= untilAnswered(() => md.loaded(), closing.signal));
|
|
115
122
|
const watchFacts = (deliver) => {
|
|
116
123
|
deliver(structuredClone(deploymentFacts));
|
|
117
124
|
return () => { };
|
|
118
125
|
};
|
|
119
|
-
function attach(port, app, release, reach, code = 'stored'
|
|
126
|
+
function attach(port, app, release, reach, code = 'stored') {
|
|
120
127
|
if (!authorized)
|
|
121
128
|
throw new Error(AUTHORIZATION_ENDED);
|
|
122
129
|
const writtenBy = release === undefined ? undefined : { app, release };
|
|
123
|
-
|
|
124
|
-
const view = runtime.within(reach ?? null, facts);
|
|
130
|
+
const view = runtime.within(reach ?? null, { target: app, code });
|
|
125
131
|
const observations = new Map();
|
|
126
132
|
const followed = new Set();
|
|
127
133
|
const answeredKeys = new Set();
|
|
@@ -159,9 +165,16 @@ export function serveMdRuntime(options) {
|
|
|
159
165
|
if (topic === 'query' && answeredMessage(value))
|
|
160
166
|
answeredQuery(input[0]);
|
|
161
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
|
+
};
|
|
162
175
|
observations.set(id, topic === 'deployment-facts'
|
|
163
176
|
? watchFacts(deliver)
|
|
164
|
-
: (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));
|
|
165
178
|
};
|
|
166
179
|
const reply = async (id, query, pending) => {
|
|
167
180
|
try {
|
|
@@ -186,8 +199,10 @@ export function serveMdRuntime(options) {
|
|
|
186
199
|
return;
|
|
187
200
|
}
|
|
188
201
|
try {
|
|
189
|
-
if (message.kind !== 'observe'
|
|
202
|
+
if (message.kind !== 'observe')
|
|
190
203
|
await md.loaded();
|
|
204
|
+
else if (message.topic !== 'room-drafts')
|
|
205
|
+
await opened();
|
|
191
206
|
if (message.kind === 'observe') {
|
|
192
207
|
if (serving)
|
|
193
208
|
observe(message.id, message.topic, message.input);
|
|
@@ -220,18 +235,6 @@ export function serveMdRuntime(options) {
|
|
|
220
235
|
if (serving)
|
|
221
236
|
view.narrow(next);
|
|
222
237
|
},
|
|
223
|
-
code(next, space) {
|
|
224
|
-
if (!serving)
|
|
225
|
-
return;
|
|
226
|
-
facts = { ...facts, code: next, space };
|
|
227
|
-
view.facts(facts);
|
|
228
|
-
},
|
|
229
|
-
search(next) {
|
|
230
|
-
if (!serving)
|
|
231
|
-
return;
|
|
232
|
-
facts = { ...facts, search: next };
|
|
233
|
-
view.facts(facts);
|
|
234
|
-
},
|
|
235
238
|
answered(queries, done) {
|
|
236
239
|
const keys = queries.map(queryKey);
|
|
237
240
|
if (keys.every((key) => answeredKeys.has(key)))
|
|
@@ -245,7 +248,7 @@ export function serveMdRuntime(options) {
|
|
|
245
248
|
const stop = view.watch('readiness', [], (value) => {
|
|
246
249
|
if (serving)
|
|
247
250
|
deliver(value);
|
|
248
|
-
});
|
|
251
|
+
}, () => { });
|
|
249
252
|
const end = () => {
|
|
250
253
|
followed.delete(end);
|
|
251
254
|
stop();
|
|
@@ -263,9 +266,6 @@ export function serveMdRuntime(options) {
|
|
|
263
266
|
persisted(answer) {
|
|
264
267
|
runtime.persisted(answer);
|
|
265
268
|
},
|
|
266
|
-
shown(onScreen) {
|
|
267
|
-
runtime.shown(onScreen);
|
|
268
|
-
},
|
|
269
269
|
async endAuthorization(holder) {
|
|
270
270
|
authorized = false;
|
|
271
271
|
for (const [detach, send] of [...attachments]) {
|
|
@@ -277,9 +277,6 @@ export function serveMdRuntime(options) {
|
|
|
277
277
|
await options.shell.dropGeneration();
|
|
278
278
|
}
|
|
279
279
|
},
|
|
280
|
-
lose(locators) {
|
|
281
|
-
return runtime.lose(locators);
|
|
282
|
-
},
|
|
283
280
|
stop() {
|
|
284
281
|
return runtime.stop();
|
|
285
282
|
},
|
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);
|