@agentshouse/mdruntime 0.1.0-c03e7b79830dd → 0.1.0-c069136dcb4e8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -8
- package/dist/adapter.d.ts +47 -48
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +2 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +28 -4
- package/dist/binary.d.ts +0 -5
- package/dist/binary.d.ts.map +1 -1
- package/dist/binary.js +1 -1
- package/dist/bootstrap.d.ts +16 -8
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +142 -94
- package/dist/change-set.d.ts +1 -7
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +1 -4
- package/dist/client.d.ts +6 -7
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +54 -7
- package/dist/collection.d.ts +5 -3
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +24 -19
- package/dist/compile.d.ts +6 -1
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +94 -33
- package/dist/connection.d.ts +8 -7
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +1160 -1174
- package/dist/conversation.d.ts +6 -9
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +191 -121
- package/dist/durability.d.ts +1 -5
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +5 -0
- package/dist/entry.d.ts +1 -0
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +1 -1
- package/dist/file.d.ts +2 -11
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +6 -4
- package/dist/fulltext.d.ts +27 -0
- package/dist/fulltext.d.ts.map +1 -0
- package/dist/fulltext.js +370 -0
- package/dist/host.d.ts +3 -4
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +42 -18
- 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 +10 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +2 -1
- package/dist/media.d.ts +8 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +218 -0
- package/dist/memory.d.ts +5 -3
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +96 -38
- package/dist/messages.d.ts +28 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/messages.js +90 -0
- package/dist/model.d.ts +6 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +7 -10
- package/dist/observation.d.ts +1 -0
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +1 -1
- package/dist/outcome.d.ts +13 -6
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +16 -5
- package/dist/overlay.js +1 -1
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +4 -0
- package/dist/query.d.ts +10 -1
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +12 -1
- package/dist/reach.d.ts +8 -3
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +69 -46
- package/dist/readiness.d.ts +14 -15
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +2 -8
- package/dist/recovery.d.ts +1 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +26 -0
- package/dist/refresh.d.ts +9 -4
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +64 -30
- package/dist/replica.d.ts +5 -5
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +4 -7
- package/dist/room-draft.d.ts +18 -2
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +73 -6
- package/dist/rows.d.ts +15 -6
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +102 -74
- package/dist/save.d.ts +2 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +13 -7
- package/dist/search.d.ts +11 -43
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +0 -296
- package/dist/shared.d.ts +0 -1
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +0 -10
- package/dist/status.d.ts +4 -3
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -1
- package/dist/store.d.ts +23 -58
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +37 -272
- package/dist/stored.d.ts +10 -23
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +217 -218
- package/dist/tables.d.ts +51 -46
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +94 -53
- 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 +35 -96
- package/dist/wire.d.ts +5 -5
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +2 -2
- package/dist/words.d.ts +19 -0
- package/dist/words.d.ts.map +1 -0
- package/dist/words.js +156 -0
- package/package.json +11 -19
- package/AGENTS.md +0 -312
- package/dist/chat/acts.d.ts +0 -33
- package/dist/chat/acts.d.ts.map +0 -1
- package/dist/chat/acts.js +0 -36
- package/dist/chat/context.d.ts +0 -3
- package/dist/chat/context.d.ts.map +0 -1
- package/dist/chat/context.js +0 -10
- package/dist/chat/earlier.d.ts +0 -10
- package/dist/chat/earlier.d.ts.map +0 -1
- package/dist/chat/earlier.js +0 -54
- package/dist/chat/house.d.ts +0 -25
- package/dist/chat/house.d.ts.map +0 -1
- package/dist/chat/house.js +0 -38
- package/dist/chat/input.d.ts +0 -11
- package/dist/chat/input.d.ts.map +0 -1
- package/dist/chat/input.js +0 -92
- package/dist/chat/kit.d.ts +0 -61
- package/dist/chat/kit.d.ts.map +0 -1
- package/dist/chat/kit.js +0 -123
- package/dist/chat/lasting.d.ts +0 -6
- package/dist/chat/lasting.d.ts.map +0 -1
- package/dist/chat/lasting.js +0 -19
- package/dist/chat/list.d.ts +0 -28
- package/dist/chat/list.d.ts.map +0 -1
- package/dist/chat/list.js +0 -103
- package/dist/chat/markdown.d.ts +0 -21
- package/dist/chat/markdown.d.ts.map +0 -1
- package/dist/chat/markdown.js +0 -246
- package/dist/chat/message.d.ts +0 -7
- package/dist/chat/message.d.ts.map +0 -1
- package/dist/chat/message.js +0 -244
- package/dist/chat/messages.d.ts +0 -30
- package/dist/chat/messages.d.ts.map +0 -1
- package/dist/chat/messages.js +0 -198
- package/dist/chat/name.d.ts +0 -7
- package/dist/chat/name.d.ts.map +0 -1
- package/dist/chat/name.js +0 -37
- package/dist/chat/opened.d.ts +0 -12
- package/dist/chat/opened.d.ts.map +0 -1
- package/dist/chat/opened.js +0 -19
- package/dist/chat/overlay.d.ts +0 -32
- package/dist/chat/overlay.d.ts.map +0 -1
- package/dist/chat/overlay.js +0 -103
- package/dist/chat/parts.d.ts +0 -58
- package/dist/chat/parts.d.ts.map +0 -1
- package/dist/chat/parts.js +0 -120
- package/dist/chat/pieces.d.ts +0 -62
- package/dist/chat/pieces.d.ts.map +0 -1
- package/dist/chat/pieces.js +0 -1110
- package/dist/chat/process.d.ts +0 -20
- package/dist/chat/process.d.ts.map +0 -1
- package/dist/chat/process.js +0 -32
- package/dist/chat/provider.d.ts +0 -70
- package/dist/chat/provider.d.ts.map +0 -1
- package/dist/chat/provider.js +0 -635
- package/dist/chat/question.d.ts +0 -9
- package/dist/chat/question.d.ts.map +0 -1
- package/dist/chat/question.js +0 -69
- package/dist/chat/questions.d.ts +0 -31
- package/dist/chat/questions.d.ts.map +0 -1
- package/dist/chat/questions.js +0 -111
- package/dist/chat/read.d.ts +0 -5
- package/dist/chat/read.d.ts.map +0 -1
- package/dist/chat/read.js +0 -13
- package/dist/chat/ready.d.ts +0 -37
- package/dist/chat/ready.d.ts.map +0 -1
- package/dist/chat/ready.js +0 -93
- package/dist/chat/room-file.d.ts +0 -8
- package/dist/chat/room-file.d.ts.map +0 -1
- package/dist/chat/room-file.js +0 -72
- package/dist/chat/steady.d.ts +0 -3
- package/dist/chat/steady.d.ts.map +0 -1
- package/dist/chat/steady.js +0 -26
- package/dist/chat/style.d.ts +0 -4
- package/dist/chat/style.d.ts.map +0 -1
- package/dist/chat/style.js +0 -306
- package/dist/chat.d.ts +0 -15
- package/dist/chat.d.ts.map +0 -1
- package/dist/chat.js +0 -8
- package/dist/reads.d.ts +0 -11
- package/dist/reads.d.ts.map +0 -1
- package/dist/reads.js +0 -98
package/dist/host.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { composeRuntime, } from './connection.js';
|
|
2
2
|
import { queryKey } from './query.js';
|
|
3
|
+
import { untilAnswered } from './recovery.js';
|
|
3
4
|
import { described } from './failure.js';
|
|
4
|
-
import { endRuntimeStore } from './store.js';
|
|
5
5
|
import { AUTHORIZATION_ENDED, request, WIRE, } from './wire.js';
|
|
6
6
|
const NARROWED = new Set(['within', 'whole']);
|
|
7
7
|
function answered(md, app, writtenBy, member, input) {
|
|
@@ -26,8 +26,10 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
26
26
|
return md.binaryFile.read(input[0], input[1], input[2]);
|
|
27
27
|
case 'binaryFile.link':
|
|
28
28
|
return md.binaryFile.link(input[0], input[1], input[2]);
|
|
29
|
-
case 'binaryFile.
|
|
30
|
-
return md.binaryFile.
|
|
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]);
|
|
31
33
|
case 'binaryFile.part':
|
|
32
34
|
return md.binaryFile.part(input[0], input[1]);
|
|
33
35
|
case 'call':
|
|
@@ -49,7 +51,7 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
49
51
|
case 'roomDraft.read':
|
|
50
52
|
return md.roomDraft.read(input[0], input[1]);
|
|
51
53
|
case 'roomDraft.write':
|
|
52
|
-
return md.roomDraft.write(input[0], input[1], input[2], input[3]);
|
|
54
|
+
return md.roomDraft.write(input[0], input[1], input[2], input[3], input[4]);
|
|
53
55
|
case 'roomDraft.discard':
|
|
54
56
|
return md.roomDraft.discard(input[0], input[1], input[2]);
|
|
55
57
|
case 'presentation.read':
|
|
@@ -66,8 +68,6 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
66
68
|
return md.conversation.create(input[0]);
|
|
67
69
|
case 'conversation.send':
|
|
68
70
|
return md.conversation.send(input[0], input[1], input[2]);
|
|
69
|
-
case 'conversation.attach':
|
|
70
|
-
return md.conversation.attach(input[0], input[1]);
|
|
71
71
|
case 'conversation.answer':
|
|
72
72
|
return md.conversation.answer(input[0], input[1]);
|
|
73
73
|
case 'conversation.interrupt':
|
|
@@ -86,6 +86,14 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
86
86
|
return md.chatDraft.discard(input[0]);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
+
function attempted(work) {
|
|
90
|
+
try {
|
|
91
|
+
return Promise.resolve(work());
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
return Promise.reject(error);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
89
97
|
function answeredResult(value) {
|
|
90
98
|
return typeof value === 'object' && value !== null && !('pending' in value);
|
|
91
99
|
}
|
|
@@ -107,6 +115,8 @@ export function serveMdRuntime(options) {
|
|
|
107
115
|
const { md } = runtime;
|
|
108
116
|
const attachments = new Map();
|
|
109
117
|
let authorized = true;
|
|
118
|
+
let opening = null;
|
|
119
|
+
const opened = () => (opening ??= untilAnswered(() => md.loaded(), closing.signal));
|
|
110
120
|
const watchFacts = (deliver) => {
|
|
111
121
|
deliver(structuredClone(deploymentFacts));
|
|
112
122
|
return () => { };
|
|
@@ -115,7 +125,7 @@ export function serveMdRuntime(options) {
|
|
|
115
125
|
if (!authorized)
|
|
116
126
|
throw new Error(AUTHORIZATION_ENDED);
|
|
117
127
|
const writtenBy = release === undefined ? undefined : { app, release };
|
|
118
|
-
let facts = { target: app, code,
|
|
128
|
+
let facts = { target: app, code, space: null, search };
|
|
119
129
|
const view = runtime.within(reach ?? null, facts);
|
|
120
130
|
const observations = new Map();
|
|
121
131
|
const followed = new Set();
|
|
@@ -158,6 +168,20 @@ export function serveMdRuntime(options) {
|
|
|
158
168
|
? watchFacts(deliver)
|
|
159
169
|
: (NARROWED.has(WIRE.topics[topic]) ? view : runtime).watch(topic, topic === 'presentation' ? [app] : input, deliver));
|
|
160
170
|
};
|
|
171
|
+
const reply = async (id, query, pending) => {
|
|
172
|
+
try {
|
|
173
|
+
const value = await pending;
|
|
174
|
+
if (!serving)
|
|
175
|
+
return;
|
|
176
|
+
send({ kind: 'result', id, value });
|
|
177
|
+
if (query !== undefined && answeredResult(value))
|
|
178
|
+
answeredQuery(query);
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
if (serving)
|
|
182
|
+
send({ kind: 'failure', id, ...described(error) });
|
|
183
|
+
}
|
|
184
|
+
};
|
|
161
185
|
const serve = async (message) => {
|
|
162
186
|
if (message.kind === 'hello')
|
|
163
187
|
return;
|
|
@@ -167,24 +191,24 @@ export function serveMdRuntime(options) {
|
|
|
167
191
|
return;
|
|
168
192
|
}
|
|
169
193
|
try {
|
|
170
|
-
if (message.kind !== 'observe'
|
|
194
|
+
if (message.kind !== 'observe')
|
|
171
195
|
await md.loaded();
|
|
196
|
+
else if (message.topic !== 'room-drafts')
|
|
197
|
+
await opened();
|
|
172
198
|
if (message.kind === 'observe') {
|
|
173
199
|
if (serving)
|
|
174
200
|
observe(message.id, message.topic, message.input);
|
|
175
201
|
return;
|
|
176
202
|
}
|
|
177
|
-
const value = await answered(NARROWED.has(WIRE.members[message.member].reach) ? view.md : md, app, writtenBy, message.member, message.input);
|
|
178
|
-
if (!serving)
|
|
179
|
-
return;
|
|
180
|
-
send({ kind: 'result', id: message.id, value });
|
|
181
|
-
if (message.member === 'query' && answeredResult(value))
|
|
182
|
-
answeredQuery(message.input[0]);
|
|
183
203
|
}
|
|
184
204
|
catch (error) {
|
|
185
205
|
if (serving)
|
|
186
206
|
send({ kind: 'failure', id: message.id, ...described(error) });
|
|
207
|
+
return;
|
|
187
208
|
}
|
|
209
|
+
const { id, member, input } = message;
|
|
210
|
+
const pending = attempted(() => answered(NARROWED.has(WIRE.members[member].reach) ? view.md : md, app, writtenBy, member, input));
|
|
211
|
+
return reply(id, member === 'query' ? input[0] : undefined, pending);
|
|
188
212
|
};
|
|
189
213
|
port.addEventListener('message', (event) => {
|
|
190
214
|
if (!serving)
|
|
@@ -203,10 +227,10 @@ export function serveMdRuntime(options) {
|
|
|
203
227
|
if (serving)
|
|
204
228
|
view.narrow(next);
|
|
205
229
|
},
|
|
206
|
-
code(next,
|
|
230
|
+
code(next, space) {
|
|
207
231
|
if (!serving)
|
|
208
232
|
return;
|
|
209
|
-
facts = { ...facts, code: next,
|
|
233
|
+
facts = { ...facts, code: next, space };
|
|
210
234
|
view.facts(facts);
|
|
211
235
|
},
|
|
212
236
|
search(next) {
|
|
@@ -253,8 +277,9 @@ export function serveMdRuntime(options) {
|
|
|
253
277
|
detach();
|
|
254
278
|
}
|
|
255
279
|
close();
|
|
256
|
-
if (!(await
|
|
280
|
+
if (!(await options.database.ask({ kind: 'authored.end', holder: holder ?? null }))) {
|
|
257
281
|
await options.shell.dropGeneration();
|
|
282
|
+
}
|
|
258
283
|
},
|
|
259
284
|
lose(locators) {
|
|
260
285
|
return runtime.lose(locators);
|
|
@@ -266,4 +291,3 @@ export function serveMdRuntime(options) {
|
|
|
266
291
|
}
|
|
267
292
|
export { entrySeedOf } from './seed.js';
|
|
268
293
|
export { createRecovery, retryDelay, } from './recovery.js';
|
|
269
|
-
export { openDatabase, STORE_SCHEMA, transacted } from './store.js';
|
package/dist/identity.d.ts
CHANGED
|
@@ -3,6 +3,5 @@ export declare function identityTime(identity: string): number;
|
|
|
3
3
|
export declare function roomDraftRevision(): string;
|
|
4
4
|
export declare function chatDraftRevision(): string;
|
|
5
5
|
export declare function transferIdentity(): string;
|
|
6
|
-
export declare function indexGeneration(): string;
|
|
7
6
|
export declare function binaryLocalId(): string;
|
|
8
7
|
//# sourceMappingURL=identity.d.ts.map
|
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;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAErD;AAQD,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,EAAE,GAAE,MAAmB,GAAG,MAAM,CAWnE;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAErD;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
package/dist/index.d.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
export type { AcceptedMessage, AcceptedRoom, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BinaryFile, BinaryLinkResult, BinaryRequest, BinaryResult,
|
|
1
|
+
export type { AcceptedMessage, AcceptedRoom, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, AttachRequest, AttachResult, Authorization, BinaryFile, BinaryLinkResult, BinaryRequest, BinaryResult, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, DiscoveryScope, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, HeldContent, HeldFile, HeldRoom, ListedAgent, ListedConversation, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomChange, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, ServiceMode, ServiceModeSignal, TransportUncertainty, TurnContext, TurnOperation, TypedSelection, } from './adapter.js';
|
|
2
2
|
export type { Change, ChangeBatch, Precondition, RoomMove, WrittenBy } from './change.js';
|
|
3
3
|
export type { ChatDraft, ChatDraftSurface, ConversationAgent, ConversationEntry, ConversationOptions, ConversationState, ConversationSurface, ConversationView, RunningTurn, } from './conversation.js';
|
|
4
|
-
export type { ChosenFile, FileDeclaration } from './file.js';
|
|
5
4
|
export type { AppRoom, AppTypedSelection, BinaryFileSurface, ConnectionRefusal, ConnectionRefusalCode, HistoryQuery, MdRuntime, MdRuntimeOptions, PresentationSurface, RoomDraftSurface, RoomSchemas, SavedParts, SavedRoomDraft, SaveResult, } from './connection.js';
|
|
6
5
|
export type { Observation } from './observation.js';
|
|
7
|
-
export type { BinaryAnswer, BinaryLinkAnswer, CallResult, Failure, HistoryAnswer, Offline, QueueEntry, Resolution, Submission, } from './outcome.js';
|
|
8
|
-
export type { BinaryFileRecord
|
|
6
|
+
export type { AttachAnswer, BinaryAnswer, BinaryLinkAnswer, CallResult, DownloadAnswer, Failure, HistoryAnswer, Offline, QueueEntry, Resolution, Submission, } from './outcome.js';
|
|
7
|
+
export type { BinaryFileRecord } from './binary.js';
|
|
9
8
|
export type { RuntimeError } from './failure.js';
|
|
10
9
|
export type { ChangedPart, FieldValue, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, TextParts, } from './room-draft.js';
|
|
11
10
|
export type { SaveRefusal } from './save.js';
|
|
12
|
-
export type { DocumentHit, DocumentPart, MessageHit,
|
|
11
|
+
export type { DocumentHit, DocumentPart, MessageHit, MessagePart, SearchCoverage, SearchHits, SearchPending, SearchRequest, SearchResult, SearchUndeclared, Snippet, } from './search.js';
|
|
13
12
|
export { departure } from './change.js';
|
|
14
|
-
export { partsAfter } from './room-draft.js';
|
|
13
|
+
export { partsAfter, partsChanges } from './room-draft.js';
|
|
15
14
|
export { cutName, nameFrom, transliterated } from './name.js';
|
|
16
|
-
export { SESSION_STARTED } from './conversation.js';
|
|
15
|
+
export { HISTORY_CONVERSATIONS, SESSION_STARTED } from './conversation.js';
|
|
17
16
|
export { changeBatchIdentity } from './identity.js';
|
|
18
|
-
export { ROW_WEIGHT, stepped } from './turn.js';
|
|
17
|
+
export { paced, ROW_WEIGHT, stepped } from './turn.js';
|
|
18
|
+
export { untilAnswered } from './recovery.js';
|
|
19
19
|
export { entriesIn, patching, sortedKeys } from './shared.js';
|
|
20
20
|
export { attempts, identities, intentOf, type Answered, type Attempt, type Attempts, type Identities, } from './attempt.js';
|
|
21
21
|
export { expectedList, expecting, type ExpectedOf, type Expecting } from './expectation.js';
|
|
22
|
-
export type { RuntimeShell
|
|
23
|
-
export type {
|
|
22
|
+
export type { RuntimeShell } from './durability.js';
|
|
23
|
+
export type { CodeAvailability, ConnectionAvailability, ConversationCoverage, Durability, HouseOutcome, Installation, InstallationAmount, InstallationStep, Persistence, Readiness, ReadinessStatus, RoomCoverage, RoomPreparation, SearchObligation, Space, TargetCoverage, } from './readiness.js';
|
|
24
24
|
export type { AttentionEntry, SyncStatus } from './status.js';
|
|
25
25
|
export type { Awaits, Backlink, CoveredRoom, Direction, DocumentQuery, DocumentResult, Filter, GroupQuery, GroupResult, Key, LocalQuery, OrderOptions, PendingResult, PendingRoom, Predicate, QueryCoverage, QueryDocument, QueryGroup, QueryResult, QueryRows, Related, Select, Value, Where, } from './query.js';
|
|
26
26
|
export type { MdType, ModelIdentity, ModelSnapshot, ModelState, ModelResult, TypesResult, ValidationReceipt, } from './model.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,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,
|
|
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,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,cAAc,EACd,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,kBAAkB,EAClB,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,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,E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,EACV,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,EACN,KAAK,EACL,KAAK,GACN,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"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { departure } from './change.js';
|
|
2
|
-
export { partsAfter } from './room-draft.js';
|
|
2
|
+
export { partsAfter, partsChanges } from './room-draft.js';
|
|
3
3
|
export { cutName, nameFrom, transliterated } from './name.js';
|
|
4
|
-
export { SESSION_STARTED } from './conversation.js';
|
|
4
|
+
export { HISTORY_CONVERSATIONS, SESSION_STARTED } from './conversation.js';
|
|
5
5
|
export { changeBatchIdentity } from './identity.js';
|
|
6
|
-
export { ROW_WEIGHT, stepped } from './turn.js';
|
|
6
|
+
export { paced, ROW_WEIGHT, stepped } from './turn.js';
|
|
7
|
+
export { untilAnswered } from './recovery.js';
|
|
7
8
|
export { entriesIn, patching, sortedKeys } from './shared.js';
|
|
8
9
|
export { attempts, identities, intentOf, } from './attempt.js';
|
|
9
10
|
export { expectedList, expecting } from './expectation.js';
|
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,EAIL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAErE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MA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,CAAC,OAAO,EAAE,MAAM,OAAO,CAAA;CAAE,CAAC;AAEpE,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEnE,KAAK,QAAQ,GAAG,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;AAchD,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAAC;IAC9B,OAAO,IAAI,IAAI,CAAC;IAChB,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,EAAE,OAAO,EAAE,QAAQ,GAAG,MAAM,IAAI,CAAC;IACvF,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAoCF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,WAAW,CAuFvD"}
|
package/dist/live.js
CHANGED
|
@@ -14,7 +14,8 @@ function reads(plan, locator) {
|
|
|
14
14
|
if (plan.reach === null)
|
|
15
15
|
return true;
|
|
16
16
|
return (plan.reach.rooms.includes(locator) ||
|
|
17
|
-
plan.reach.documents.some((document) => roomOfKey(document) === locator)
|
|
17
|
+
plan.reach.documents.some((document) => roomOfKey(document) === locator) ||
|
|
18
|
+
plan.reach.areas.some((area) => area.room === locator && area.types.length > 0));
|
|
18
19
|
}
|
|
19
20
|
function affected(plan, set) {
|
|
20
21
|
if (set.rooms.some((locator) => reads(plan, locator)))
|
package/dist/media.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MdRuntimeClient } from './client.js';
|
|
2
|
+
import { type ShownAnswer } from './outcome.js';
|
|
3
|
+
export declare const ROOM_MEDIA = "room-media";
|
|
4
|
+
type Show = (room: string, path: string, revision?: string) => Promise<ShownAnswer>;
|
|
5
|
+
export declare function shownBy(show: Show, client: MdRuntimeClient): MdRuntimeClient;
|
|
6
|
+
export declare function defineRoomMedia(client: Promise<MdRuntimeClient> | MdRuntimeClient, registry?: CustomElementRegistry): void;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=media.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../src/media.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3D,eAAO,MAAM,UAAU,eAAe,CAAC;AAwBvC,KAAK,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;AAIpF,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,GAAG,eAAe,CAG5E;AAsBD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,EAClD,QAAQ,GAAE,qBAAsC,GAC/C,IAAI,CA0LN"}
|
package/dist/media.js
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { UNCERTAIN } from './outcome.js';
|
|
2
|
+
export const ROOM_MEDIA = 'room-media';
|
|
3
|
+
const ATTRIBUTES = ['room', 'path', 'revision', 'width', 'height', 'alt'];
|
|
4
|
+
const LOADING = new Set(['room', 'path', 'revision']);
|
|
5
|
+
const NEARING = '600px 0px';
|
|
6
|
+
const RELINKS = 2;
|
|
7
|
+
// The Room's stream brings a file seconds after the text that links it, minutes after on a first open, and a page's reach of its Rooms settles seconds after it opens, so a file not shown yet is asked for again every three seconds.
|
|
8
|
+
const UNSHOWN_MS = 3_000;
|
|
9
|
+
const SHAPE = '16 / 9';
|
|
10
|
+
const STYLE = `:host{display:block}
|
|
11
|
+
[part=box]{position:relative;overflow:hidden}
|
|
12
|
+
[part=box]>img,[part=box]>video,[part=box]>audio{display:block;width:100%;height:100%;object-fit:contain}
|
|
13
|
+
[part=box]>slot{display:flex;align-items:center;justify-content:center;width:100%;height:100%;text-align:center}`;
|
|
14
|
+
const shows = new WeakMap();
|
|
15
|
+
export function shownBy(show, client) {
|
|
16
|
+
shows.set(client, show);
|
|
17
|
+
return client;
|
|
18
|
+
}
|
|
19
|
+
function ratioOf(width, height) {
|
|
20
|
+
const across = Number(width);
|
|
21
|
+
const down = Number(height);
|
|
22
|
+
return Number.isFinite(across) && Number.isFinite(down) && across > 0 && down > 0
|
|
23
|
+
? `${across} / ${down}`
|
|
24
|
+
: SHAPE;
|
|
25
|
+
}
|
|
26
|
+
function refusedForGood(shown) {
|
|
27
|
+
if (shown.kind === 'revoked-authorization')
|
|
28
|
+
return true;
|
|
29
|
+
return (shown.kind === 'rejected' || shown.kind === 'scoped-refusal') && !shown.retryable;
|
|
30
|
+
}
|
|
31
|
+
function drawnFor(mediaType) {
|
|
32
|
+
if (mediaType.startsWith('image/'))
|
|
33
|
+
return 'img';
|
|
34
|
+
if (mediaType.startsWith('video/'))
|
|
35
|
+
return 'video';
|
|
36
|
+
if (mediaType.startsWith('audio/'))
|
|
37
|
+
return 'audio';
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
export function defineRoomMedia(client, registry = customElements) {
|
|
41
|
+
if (registry.get(ROOM_MEDIA) !== undefined)
|
|
42
|
+
return;
|
|
43
|
+
const connected = Promise.resolve(client);
|
|
44
|
+
class RoomMedia extends HTMLElement {
|
|
45
|
+
static observedAttributes = ATTRIBUTES;
|
|
46
|
+
#root = this.attachShadow({ mode: 'open' });
|
|
47
|
+
#box = document.createElement('div');
|
|
48
|
+
#fallback = document.createElement('slot');
|
|
49
|
+
#watching = null;
|
|
50
|
+
#near = false;
|
|
51
|
+
#asked = 0;
|
|
52
|
+
#shown = null;
|
|
53
|
+
#drawn = null;
|
|
54
|
+
#loaded = false;
|
|
55
|
+
#relinked = 0;
|
|
56
|
+
constructor() {
|
|
57
|
+
super();
|
|
58
|
+
this.#box.setAttribute('part', 'box');
|
|
59
|
+
this.#root.append(Object.assign(document.createElement('style'), { textContent: STYLE }), this.#box);
|
|
60
|
+
this.#shape();
|
|
61
|
+
}
|
|
62
|
+
connectedCallback() {
|
|
63
|
+
this.#label();
|
|
64
|
+
this.#watching ??= new IntersectionObserver((seen) => {
|
|
65
|
+
if (!seen.some((entry) => entry.isIntersecting) || this.#near)
|
|
66
|
+
return;
|
|
67
|
+
this.#near = true;
|
|
68
|
+
void this.#load();
|
|
69
|
+
}, { rootMargin: NEARING });
|
|
70
|
+
this.#watching.observe(this);
|
|
71
|
+
}
|
|
72
|
+
disconnectedCallback() {
|
|
73
|
+
this.#watching?.disconnect();
|
|
74
|
+
this.#watching = null;
|
|
75
|
+
this.#near = false;
|
|
76
|
+
this.#asked += 1;
|
|
77
|
+
this.#show(null);
|
|
78
|
+
}
|
|
79
|
+
attributeChangedCallback(name, before, after) {
|
|
80
|
+
if (before === after)
|
|
81
|
+
return;
|
|
82
|
+
this.#shape();
|
|
83
|
+
if (this.isConnected)
|
|
84
|
+
this.#label();
|
|
85
|
+
if (!LOADING.has(name) || !this.#near)
|
|
86
|
+
return;
|
|
87
|
+
this.#relinked = 0;
|
|
88
|
+
void this.#load();
|
|
89
|
+
}
|
|
90
|
+
#shape() {
|
|
91
|
+
this.#box.style.aspectRatio = ratioOf(this.getAttribute('width'), this.getAttribute('height'));
|
|
92
|
+
}
|
|
93
|
+
#label() {
|
|
94
|
+
const alt = this.getAttribute('alt') ?? '';
|
|
95
|
+
const drawn = this.#drawn;
|
|
96
|
+
if (drawn instanceof HTMLMediaElement) {
|
|
97
|
+
this.removeAttribute('role');
|
|
98
|
+
this.removeAttribute('aria-label');
|
|
99
|
+
drawn.setAttribute('aria-label', alt);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
this.setAttribute('role', 'img');
|
|
103
|
+
this.setAttribute('aria-label', alt);
|
|
104
|
+
if (drawn !== null)
|
|
105
|
+
drawn.alt = '';
|
|
106
|
+
}
|
|
107
|
+
async #load() {
|
|
108
|
+
const asked = (this.#asked += 1);
|
|
109
|
+
this.#loaded = false;
|
|
110
|
+
const room = this.getAttribute('room');
|
|
111
|
+
const path = this.getAttribute('path');
|
|
112
|
+
const revision = this.getAttribute('revision') ?? undefined;
|
|
113
|
+
if (room === null || path === null) {
|
|
114
|
+
this.#unreadable();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const show = shows.get(await connected);
|
|
118
|
+
const shown = show === undefined ? null : await show(room, path, revision).catch(() => UNCERTAIN);
|
|
119
|
+
if (asked !== this.#asked)
|
|
120
|
+
return;
|
|
121
|
+
if (shown?.kind === 'link') {
|
|
122
|
+
this.#draw({ url: shown.url, copy: false }, shown.mediaType);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (shown?.kind !== 'binary') {
|
|
126
|
+
if (shown === null || refusedForGood(shown))
|
|
127
|
+
this.#unreadable();
|
|
128
|
+
else
|
|
129
|
+
this.#unshown(asked);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const copy = await new Response(shown.stream, {
|
|
133
|
+
headers: { 'content-type': shown.mediaType },
|
|
134
|
+
})
|
|
135
|
+
.blob()
|
|
136
|
+
.catch(() => null);
|
|
137
|
+
if (asked !== this.#asked)
|
|
138
|
+
return;
|
|
139
|
+
if (copy === null)
|
|
140
|
+
this.#unshown(asked);
|
|
141
|
+
else
|
|
142
|
+
this.#draw({ url: URL.createObjectURL(copy), copy: true }, shown.mediaType);
|
|
143
|
+
}
|
|
144
|
+
#unshown(asked) {
|
|
145
|
+
this.#unreadable();
|
|
146
|
+
setTimeout(() => {
|
|
147
|
+
if (asked === this.#asked && this.#near)
|
|
148
|
+
void this.#load();
|
|
149
|
+
}, UNSHOWN_MS);
|
|
150
|
+
}
|
|
151
|
+
#show(shown, content = null) {
|
|
152
|
+
if (this.#shown?.copy === true)
|
|
153
|
+
URL.revokeObjectURL(this.#shown.url);
|
|
154
|
+
this.#shown = shown;
|
|
155
|
+
if (content !== this.#drawn)
|
|
156
|
+
this.#drawn = null;
|
|
157
|
+
if (content === null)
|
|
158
|
+
this.#box.replaceChildren();
|
|
159
|
+
else if (content.parentNode !== this.#box)
|
|
160
|
+
this.#box.replaceChildren(content);
|
|
161
|
+
this.#label();
|
|
162
|
+
}
|
|
163
|
+
#unreadable() {
|
|
164
|
+
this.#show(null, this.#fallback);
|
|
165
|
+
}
|
|
166
|
+
#draw(shown, mediaType) {
|
|
167
|
+
const tag = drawnFor(mediaType);
|
|
168
|
+
if (tag === null) {
|
|
169
|
+
if (shown.copy)
|
|
170
|
+
URL.revokeObjectURL(shown.url);
|
|
171
|
+
this.#unreadable();
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const kept = this.#drawn?.localName === tag ? this.#drawn : null;
|
|
175
|
+
const drawn = kept ?? document.createElement(tag);
|
|
176
|
+
if (kept === null) {
|
|
177
|
+
if (drawn instanceof HTMLImageElement)
|
|
178
|
+
drawn.decoding = 'async';
|
|
179
|
+
if (drawn instanceof HTMLMediaElement) {
|
|
180
|
+
drawn.controls = true;
|
|
181
|
+
drawn.preload = 'metadata';
|
|
182
|
+
if (drawn instanceof HTMLVideoElement)
|
|
183
|
+
drawn.playsInline = true;
|
|
184
|
+
}
|
|
185
|
+
drawn.addEventListener(drawn instanceof HTMLImageElement ? 'load' : 'loadedmetadata', () => {
|
|
186
|
+
if (drawn !== this.#drawn)
|
|
187
|
+
return;
|
|
188
|
+
this.#loaded = true;
|
|
189
|
+
this.#relinked = 0;
|
|
190
|
+
});
|
|
191
|
+
drawn.addEventListener('error', () => this.#failed(drawn));
|
|
192
|
+
}
|
|
193
|
+
this.#drawn = drawn;
|
|
194
|
+
this.#show(shown, drawn);
|
|
195
|
+
drawn.src = shown.url;
|
|
196
|
+
}
|
|
197
|
+
#failed(drawn) {
|
|
198
|
+
if (drawn !== this.#drawn)
|
|
199
|
+
return;
|
|
200
|
+
if (this.#shown?.copy !== false || !this.#loaded || this.#relinked >= RELINKS) {
|
|
201
|
+
this.#unreadable();
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
this.#relinked += 1;
|
|
205
|
+
if (drawn instanceof HTMLMediaElement) {
|
|
206
|
+
const at = drawn.currentTime;
|
|
207
|
+
const playing = !drawn.paused;
|
|
208
|
+
drawn.addEventListener('loadedmetadata', () => {
|
|
209
|
+
drawn.currentTime = at;
|
|
210
|
+
if (playing)
|
|
211
|
+
void drawn.play().catch(() => undefined);
|
|
212
|
+
}, { once: true });
|
|
213
|
+
}
|
|
214
|
+
void this.#load();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
registry.define(ROOM_MEDIA, RoomMedia);
|
|
218
|
+
}
|
package/dist/memory.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { ModelResult } from './model.js';
|
|
2
|
-
import { type AcceptedMessage, type ActionResult, type Adapter, type BinaryFile, type Capability, type ConversationAction, type ConversationEvent, type DiscoveryScope, type DiscoveredRoom, type HeadChange, type ListedConversation, type Member, type ProviderLimit, type Retention, type ServiceMode } from './adapter.js';
|
|
2
|
+
import { type AcceptedMessage, type ActionResult, type Adapter, type BinaryFile, type Capability, type ConversationAction, type ConversationEvent, type DiscoveryScope, type DiscoveredRoom, type HeadChange, type ListedAgent, type ListedConversation, type Member, type ProviderLimit, type Retention, type ServiceMode } from './adapter.js';
|
|
3
3
|
export type MemoryRoom = DiscoveredRoom & {
|
|
4
4
|
model?: ModelResult;
|
|
5
|
-
selectionModel?: ModelResult;
|
|
6
5
|
documents?: Readonly<Record<string, string>>;
|
|
7
6
|
revisions?: Readonly<Record<string, string>>;
|
|
8
7
|
fileIds?: Readonly<Record<string, string>>;
|
|
@@ -13,13 +12,14 @@ export type MemoryRoom = DiscoveredRoom & {
|
|
|
13
12
|
};
|
|
14
13
|
export type MemoryConversation = {
|
|
15
14
|
conversation: string;
|
|
16
|
-
listed?: Omit<ListedConversation, 'conversation'>;
|
|
15
|
+
listed?: Omit<ListedConversation, 'conversation' | 'newest'>;
|
|
17
16
|
messages?: readonly AcceptedMessage[];
|
|
18
17
|
outcomes?: Partial<Record<ConversationAction, ActionResult>>;
|
|
19
18
|
};
|
|
20
19
|
export type MemoryAdapterOptions = {
|
|
21
20
|
rooms?: readonly MemoryRoom[];
|
|
22
21
|
conversations?: readonly MemoryConversation[];
|
|
22
|
+
agents?: readonly ListedAgent[];
|
|
23
23
|
historyPageSize?: number;
|
|
24
24
|
pageSize?: number;
|
|
25
25
|
capabilities?: readonly Capability[];
|
|
@@ -28,8 +28,10 @@ export type MemoryAdapterOptions = {
|
|
|
28
28
|
member?: Member;
|
|
29
29
|
unopened?: boolean;
|
|
30
30
|
exhaustiveDiscovery?: true;
|
|
31
|
+
roomTypes?: string;
|
|
31
32
|
};
|
|
32
33
|
export type MemoryAdapter = Adapter & {
|
|
34
|
+
refresh: NonNullable<Adapter['refresh']>;
|
|
33
35
|
setRooms(rooms: readonly MemoryRoom[]): void;
|
|
34
36
|
setConversations(conversations: readonly MemoryConversation[]): void;
|
|
35
37
|
script(operation: keyof Adapter, answer: unknown): void;
|
package/dist/memory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,OAAO,EAIZ,KAAK,UAAU,EAMf,KAA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