@agentshouse/mdruntime 0.1.0-c8c4b020a3ec7 → 0.1.0-c967d1ca66fee
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +94 -33
- package/README.md +10 -10
- package/dist/adapter.d.ts +92 -46
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +1 -9
- package/dist/attached-model.d.ts +11 -0
- package/dist/attached-model.d.ts.map +1 -0
- package/dist/attached-model.js +47 -0
- package/dist/bootstrap.d.ts +20 -6
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +89 -35
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +13 -7
- package/dist/change.d.ts +4 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/client.d.ts +8 -5
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +57 -24
- package/dist/collection.d.ts +6 -11
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +56 -19
- package/dist/connection.d.ts +20 -16
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +711 -587
- package/dist/conversation.d.ts +23 -11
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +252 -106
- package/dist/failure.d.ts +13 -0
- package/dist/failure.d.ts.map +1 -0
- package/dist/failure.js +19 -0
- package/dist/host.d.ts +8 -1
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +38 -38
- package/dist/identity.d.ts +1 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +7 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/memory.d.ts +12 -5
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +108 -36
- package/dist/model.d.ts +13 -12
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +6 -3
- package/dist/observation.d.ts +2 -0
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +24 -14
- package/dist/open.d.ts +2 -0
- package/dist/open.d.ts.map +1 -0
- package/dist/open.js +1 -0
- package/dist/outcome.d.ts +22 -3
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +35 -1
- package/dist/overlay.d.ts +1 -1
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +19 -15
- package/dist/paths.d.ts +0 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +0 -16
- package/dist/query.d.ts +10 -3
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +78 -36
- package/dist/reach.d.ts +40 -0
- package/dist/reach.d.ts.map +1 -0
- package/dist/reach.js +272 -0
- package/dist/react.d.ts +40 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +64 -0
- package/dist/read-side.d.ts +4 -0
- package/dist/read-side.d.ts.map +1 -1
- package/dist/read-side.js +116 -54
- package/dist/refresh.d.ts +12 -1
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +35 -22
- package/dist/replica.d.ts +6 -6
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +53 -39
- package/dist/room-draft.d.ts +11 -8
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +19 -26
- package/dist/rows.d.ts +4 -1
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +82 -39
- package/dist/save.d.ts +4 -3
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +127 -68
- package/dist/search.d.ts +3 -2
- package/dist/search.d.ts.map +1 -1
- package/dist/status.d.ts +2 -2
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +0 -8
- package/dist/store.d.ts +25 -2
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +206 -90
- package/dist/wire.d.ts +55 -19
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +62 -61
- package/package.json +14 -2
package/dist/host.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { composeRuntime, } from './connection.js';
|
|
2
|
+
import { described } from './failure.js';
|
|
2
3
|
import { removeRuntimeStore } from './store.js';
|
|
3
|
-
import { AUTHORIZATION_ENDED,
|
|
4
|
+
import { AUTHORIZATION_ENDED, request, WIRE_REACH, } from './wire.js';
|
|
5
|
+
const NARROWED = new Set(['within', 'whole']);
|
|
4
6
|
function answered(md, app, writtenBy, member, input) {
|
|
5
7
|
switch (member) {
|
|
6
8
|
case 'rooms':
|
|
@@ -71,82 +73,73 @@ export function serveMdRuntime(options) {
|
|
|
71
73
|
if (options.signal?.aborted === true)
|
|
72
74
|
close();
|
|
73
75
|
const runtime = composeRuntime({ ...options, signal: closing.signal });
|
|
74
|
-
const { md
|
|
76
|
+
const { md } = runtime;
|
|
75
77
|
const attachments = new Map();
|
|
76
78
|
let authorized = true;
|
|
77
79
|
const watchFacts = (deliver) => {
|
|
78
80
|
deliver(structuredClone(deploymentFacts));
|
|
79
81
|
return () => { };
|
|
80
82
|
};
|
|
81
|
-
function attach(port, app, release) {
|
|
83
|
+
function attach(port, app, release, reach) {
|
|
82
84
|
if (!authorized)
|
|
83
85
|
throw new Error(AUTHORIZATION_ENDED);
|
|
84
86
|
const writtenBy = release === undefined ? undefined : { app, release };
|
|
85
|
-
const
|
|
87
|
+
const view = runtime.within(reach ?? null);
|
|
88
|
+
const observations = new Map();
|
|
86
89
|
let serving = true;
|
|
87
90
|
const send = (message) => {
|
|
88
|
-
port.postMessage(
|
|
91
|
+
port.postMessage(message);
|
|
89
92
|
};
|
|
90
93
|
const detach = () => {
|
|
91
94
|
if (!serving)
|
|
92
95
|
return;
|
|
93
96
|
serving = false;
|
|
94
|
-
for (const end of
|
|
97
|
+
for (const end of observations.values())
|
|
95
98
|
end();
|
|
96
|
-
|
|
99
|
+
observations.clear();
|
|
97
100
|
attachments.delete(detach);
|
|
98
101
|
};
|
|
102
|
+
const observe = (id, topic, input) => {
|
|
103
|
+
let resolved = false;
|
|
104
|
+
const deliver = (value) => {
|
|
105
|
+
if (!serving)
|
|
106
|
+
return;
|
|
107
|
+
send(resolved ? { kind: 'event', id, value } : { kind: 'result', id, value });
|
|
108
|
+
resolved = true;
|
|
109
|
+
};
|
|
110
|
+
observations.set(id, topic === 'deployment-facts'
|
|
111
|
+
? watchFacts(deliver)
|
|
112
|
+
: (NARROWED.has(WIRE_REACH.topics[topic]) ? view : runtime).watch(topic, topic === 'presentation' ? [app] : input, deliver));
|
|
113
|
+
};
|
|
99
114
|
const serve = async (message) => {
|
|
100
115
|
if (message.kind === 'hello')
|
|
101
116
|
return;
|
|
102
117
|
if (message.kind === 'stop') {
|
|
103
|
-
|
|
104
|
-
|
|
118
|
+
observations.get(message.id)?.();
|
|
119
|
+
observations.delete(message.id);
|
|
105
120
|
return;
|
|
106
121
|
}
|
|
107
122
|
try {
|
|
108
123
|
if (message.kind !== 'observe' || message.topic !== 'room-drafts')
|
|
109
124
|
await md.loaded();
|
|
110
125
|
if (message.kind === 'observe') {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const deliver = (value) => {
|
|
114
|
-
if (!serving)
|
|
115
|
-
return;
|
|
116
|
-
send(resolved ? { kind: 'event', id, value } : { kind: 'result', id, value });
|
|
117
|
-
resolved = true;
|
|
118
|
-
};
|
|
119
|
-
subscriptions.set(id, topic === 'deployment-facts'
|
|
120
|
-
? watchFacts(deliver)
|
|
121
|
-
: watch(topic, topic === 'presentation' ? [app] : message.input, deliver));
|
|
126
|
+
if (serving)
|
|
127
|
+
observe(message.id, message.topic, message.input);
|
|
122
128
|
return;
|
|
123
129
|
}
|
|
124
|
-
const value = await answered(md, app, writtenBy, message.member, message.input);
|
|
130
|
+
const value = await answered(NARROWED.has(WIRE_REACH.members[message.member]) ? view.md : md, app, writtenBy, message.member, message.input);
|
|
125
131
|
if (serving)
|
|
126
132
|
send({ kind: 'result', id: message.id, value });
|
|
127
133
|
}
|
|
128
134
|
catch (error) {
|
|
129
|
-
if (serving)
|
|
130
|
-
send({
|
|
131
|
-
kind: 'failure',
|
|
132
|
-
id: message.id,
|
|
133
|
-
message: error instanceof Error ? error.message : String(error),
|
|
134
|
-
});
|
|
135
|
-
}
|
|
135
|
+
if (serving)
|
|
136
|
+
send({ kind: 'failure', id: message.id, ...described(error) });
|
|
136
137
|
}
|
|
137
138
|
};
|
|
138
139
|
port.addEventListener('message', (event) => {
|
|
139
140
|
if (!serving)
|
|
140
141
|
return;
|
|
141
|
-
const
|
|
142
|
-
if (wire === null)
|
|
143
|
-
return;
|
|
144
|
-
if (!wire.matching) {
|
|
145
|
-
send({ kind: 'refusal', refusal: PROTOCOL_MISMATCH });
|
|
146
|
-
detach();
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
const message = request(wire.message);
|
|
142
|
+
const message = request(event.data);
|
|
150
143
|
if (message === null)
|
|
151
144
|
return;
|
|
152
145
|
void serve(message);
|
|
@@ -154,7 +147,13 @@ export function serveMdRuntime(options) {
|
|
|
154
147
|
port.addEventListener('close', detach);
|
|
155
148
|
port.start();
|
|
156
149
|
attachments.set(detach, send);
|
|
157
|
-
return
|
|
150
|
+
return {
|
|
151
|
+
detach,
|
|
152
|
+
narrow(next) {
|
|
153
|
+
if (serving)
|
|
154
|
+
view.narrow(next);
|
|
155
|
+
},
|
|
156
|
+
};
|
|
158
157
|
}
|
|
159
158
|
return {
|
|
160
159
|
attach,
|
|
@@ -173,3 +172,4 @@ export function serveMdRuntime(options) {
|
|
|
173
172
|
},
|
|
174
173
|
};
|
|
175
174
|
}
|
|
175
|
+
export { STORE_SCHEMA } from './store.js';
|
package/dist/identity.d.ts
CHANGED
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,gBAAgB,IAAI,MAAM,CAEzC"}
|
package/dist/identity.js
CHANGED
|
@@ -10,8 +10,14 @@ 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
|
-
|
|
13
|
+
function randomIdentity() {
|
|
14
14
|
const bytes = new Uint8Array(16);
|
|
15
15
|
crypto.getRandomValues(bytes);
|
|
16
16
|
return [...bytes].map((byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
17
17
|
}
|
|
18
|
+
export function roomDraftRevision() {
|
|
19
|
+
return randomIdentity();
|
|
20
|
+
}
|
|
21
|
+
export function transferIdentity() {
|
|
22
|
+
return randomIdentity();
|
|
23
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export type { AcceptedMessage, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction,
|
|
1
|
+
export type { AcceptedMessage, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationAgents, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, HeldRoom, ListedConversation, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomAttachment, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, ServiceMode, ServiceModeSignal, TransportUncertainty, TurnContext, TurnOperation, TypedSelection, } from './adapter.js';
|
|
2
2
|
export type { Change, ChangeBatch, Precondition, WrittenBy } from './change.js';
|
|
3
|
-
export type { ChatDraft, ChatDraftSurface, ConversationEntry, ConversationOptions, ConversationSurface, ConversationView,
|
|
3
|
+
export type { ChatDraft, ChatDraftSurface, ConversationEntry, ConversationOptions, ConversationState, ConversationSurface, ConversationView, RunningTurn, } from './conversation.js';
|
|
4
4
|
export type { ChatDraftFile, FileDeclaration } from './file.js';
|
|
5
|
-
export type { AppRoom, AppTypedSelection, ConnectionRefusal,
|
|
5
|
+
export type { AppRoom, AppTypedSelection, ConnectionRefusal, ConnectionRefusalCode, HistoryQuery, MdRuntime, MdRuntimeOptions, PresentationSurface, RoomDraftSurface, RoomSchemas, SavedRoomDraft, SaveResult, } from './connection.js';
|
|
6
6
|
export type { Observation } from './observation.js';
|
|
7
|
-
export type { CallResult, QueueEntry, Submission } from './outcome.js';
|
|
7
|
+
export type { CallResult, Failure, HistoryAnswer, QueueEntry, Submission } from './outcome.js';
|
|
8
|
+
export type { RuntimeError } from './failure.js';
|
|
8
9
|
export type { ChangedPart, FieldValue, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, } from './room-draft.js';
|
|
9
10
|
export type { SaveRefusal } from './save.js';
|
|
10
11
|
export type { DocumentHit, DocumentPart, MessageHit, SearchRequest, SearchResult, } from './search.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,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,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,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,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,cAAc,EACd,UAAU,EACV,eAAe,EACf,UAAU,EACV,eAAe,EACf,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAChF,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAChE,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/F,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,YAAY,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,YAAY,EACV,WAAW,EACX,YAAY,EACZ,UAAU,EACV,aAAa,EACb,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EACV,QAAQ,EACR,SAAS,EACT,aAAa,EACb,cAAc,EACd,MAAM,EACN,UAAU,EACV,WAAW,EACX,GAAG,EACH,UAAU,EACV,YAAY,EACZ,SAAS,EACT,aAAa,EACb,UAAU,EACV,WAAW,EACX,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/memory.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ModelResult } from './model.js';
|
|
2
|
-
import { type AcceptedMessage, type ActionResult, type Adapter, type Capability, type ConversationAction, type ConversationEvent, type DiscoveredRoom, type HeadChange, type
|
|
2
|
+
import { type AcceptedMessage, type ActionResult, type Adapter, type Capability, type ConversationAction, type ConversationEvent, type DiscoveredRoom, type HeadChange, type ListedConversation, type Member, type ProviderLimit, type Retention, type RoomAttachment, type ServiceMode } from './adapter.js';
|
|
3
3
|
export type MemoryRoom = DiscoveredRoom & {
|
|
4
4
|
model?: ModelResult;
|
|
5
5
|
selectionModel?: ModelResult;
|
|
@@ -11,6 +11,7 @@ export type MemoryRoom = DiscoveredRoom & {
|
|
|
11
11
|
};
|
|
12
12
|
export type MemoryConversation = {
|
|
13
13
|
conversation: string;
|
|
14
|
+
listed?: Omit<ListedConversation, 'conversation'>;
|
|
14
15
|
messages?: readonly AcceptedMessage[];
|
|
15
16
|
outcomes?: Partial<Record<ConversationAction, ActionResult>>;
|
|
16
17
|
};
|
|
@@ -19,20 +20,26 @@ export type MemoryAdapterOptions = {
|
|
|
19
20
|
conversations?: readonly MemoryConversation[];
|
|
20
21
|
historyPageSize?: number;
|
|
21
22
|
pageSize?: number;
|
|
22
|
-
mdModel?: MdModelIdentity;
|
|
23
|
-
supportedVersions?: readonly number[];
|
|
24
23
|
capabilities?: readonly Capability[];
|
|
25
24
|
providerLimits?: readonly ProviderLimit[];
|
|
26
25
|
retention?: Retention;
|
|
26
|
+
member?: Member;
|
|
27
|
+
unopened?: boolean;
|
|
27
28
|
};
|
|
28
29
|
export type MemoryAdapter = Adapter & {
|
|
29
30
|
setRooms(rooms: readonly MemoryRoom[]): void;
|
|
30
31
|
setConversations(conversations: readonly MemoryConversation[]): void;
|
|
31
32
|
script(operation: keyof Adapter, answer: unknown): void;
|
|
32
|
-
|
|
33
|
+
open(): void;
|
|
34
|
+
close(revoked?: boolean): void;
|
|
35
|
+
expire(locators: readonly string[]): void;
|
|
36
|
+
notifyRoomVersion(notification: {
|
|
37
|
+
locator: string;
|
|
38
|
+
roomVersion: string;
|
|
39
|
+
}): void;
|
|
33
40
|
notifyConversation(event: ConversationEvent): void;
|
|
34
41
|
notifyServiceMode(mode: ServiceMode): void;
|
|
35
|
-
|
|
42
|
+
heldRooms(): readonly string[];
|
|
36
43
|
replicatedConversations(): readonly string[];
|
|
37
44
|
};
|
|
38
45
|
export declare function createMemoryAdapter(options?: MemoryAdapterOptions): MemoryAdapter;
|
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,
|
|
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,EACf,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAItB,KAAK,cAAc,EACnB,KAAK,UAAU,EAGf,KAAK,kBAAkB,EACvB,KAAK,MAAM,EAGX,KAAK,aAAa,EAGlB,KAAK,SAAS,EACd,KAAK,cAAc,EAGnB,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAkBtB,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG;IACxC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7C,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IAC/C,aAAa,CAAC,EAAE,S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AAC,YAAY,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAChF,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACnD,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C,SAAS,IAAI,SAAS,MAAM,EAAE,CAAC;IAC/B,uBAAuB,IAAI,SAAS,MAAM,EAAE,CAAC;CAC9C,CAAC;AA+CF,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,GAAG,aAAa,CAucrF"}
|
package/dist/memory.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ROOM_CONTRACT_VERSION, } from './adapter.js';
|
|
2
|
-
import { MD_MODEL } from './collection.js';
|
|
3
1
|
import { sameChange } from './overlay.js';
|
|
4
2
|
const FIXTURE_RETENTION = {
|
|
5
3
|
history: { kind: 'duration', seconds: 1 },
|
|
@@ -15,6 +13,19 @@ function declaredRetention(value) {
|
|
|
15
13
|
}
|
|
16
14
|
throw new Error('history retention duration must be a finite positive number of seconds');
|
|
17
15
|
}
|
|
16
|
+
const MODEL_ABSENT = { kind: 'model-unavailable', reason: 'not-readable' };
|
|
17
|
+
function modelsOf(room) {
|
|
18
|
+
return {
|
|
19
|
+
collection: room.model ?? MODEL_ABSENT,
|
|
20
|
+
...(room.typedSelection === undefined
|
|
21
|
+
? {}
|
|
22
|
+
: { selection: room.selectionModel ?? MODEL_ABSENT }),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function changedModels(room, from) {
|
|
26
|
+
const now = modelsOf(room);
|
|
27
|
+
return JSON.stringify(now) === JSON.stringify(modelsOf(from)) ? undefined : now;
|
|
28
|
+
}
|
|
18
29
|
function named(source, paths) {
|
|
19
30
|
const taken = {};
|
|
20
31
|
for (const path of paths) {
|
|
@@ -31,8 +42,6 @@ async function resolveScript(answer, fallback, request) {
|
|
|
31
42
|
}
|
|
32
43
|
export function createMemoryAdapter(options = {}) {
|
|
33
44
|
let rooms = options.rooms === undefined ? [] : [...options.rooms];
|
|
34
|
-
const mdModel = options.mdModel ?? MD_MODEL;
|
|
35
|
-
const supportedVersions = options.supportedVersions ?? [ROOM_CONTRACT_VERSION];
|
|
36
45
|
const capabilities = options.capabilities ?? [];
|
|
37
46
|
const providerLimits = options.providerLimits ?? [];
|
|
38
47
|
const retention = declaredRetention(options.retention);
|
|
@@ -47,7 +56,8 @@ export function createMemoryAdapter(options = {}) {
|
|
|
47
56
|
const unsealed = new Map();
|
|
48
57
|
const sealed = new Set();
|
|
49
58
|
const historyPageSize = options.historyPageSize;
|
|
50
|
-
let
|
|
59
|
+
let held = [];
|
|
60
|
+
let expiring = [];
|
|
51
61
|
let replicated = [];
|
|
52
62
|
let issued = 0;
|
|
53
63
|
function scriptConversations(entries) {
|
|
@@ -89,29 +99,32 @@ export function createMemoryAdapter(options = {}) {
|
|
|
89
99
|
return {
|
|
90
100
|
name: room.name,
|
|
91
101
|
locator: room.locator,
|
|
102
|
+
handle: room.handle,
|
|
92
103
|
roomVersion: room.roomVersion,
|
|
93
104
|
operations: room.operations,
|
|
94
105
|
replica: room.replica,
|
|
95
|
-
attachedModel: room.attachedModel,
|
|
96
106
|
...(room.typedSelection === undefined ? {} : { typedSelection: room.typedSelection }),
|
|
97
107
|
providerOwnedPaths: room.providerOwnedPaths,
|
|
98
108
|
};
|
|
99
109
|
}
|
|
100
|
-
function page(room,
|
|
110
|
+
function page(room, after) {
|
|
101
111
|
const paths = Object.keys(room.documents ?? {}).sort();
|
|
112
|
+
const opening = after === undefined;
|
|
113
|
+
const from = opening ? 0 : paths.filter((path) => path <= after).length;
|
|
102
114
|
const size = pageSize ?? paths.length;
|
|
103
115
|
const taken = paths.slice(from, from + size);
|
|
104
116
|
const next = from + taken.length;
|
|
105
|
-
const targets =
|
|
117
|
+
const targets = opening ? (room.binaryTargets ?? []) : [];
|
|
106
118
|
return {
|
|
107
119
|
kind: 'bootstrap',
|
|
108
120
|
roomVersion: room.roomVersion,
|
|
121
|
+
...(opening ? { models: modelsOf(room) } : {}),
|
|
109
122
|
documents: named(room.documents ?? {}, taken),
|
|
110
123
|
revisions: named(room.revisions ?? {}, taken),
|
|
111
124
|
changes: named(room.changes ?? {}, [...taken, ...targets]),
|
|
112
125
|
binaryTargets: targets,
|
|
113
|
-
...(
|
|
114
|
-
...(next < paths.length ? { pageToken:
|
|
126
|
+
...(opening && room.attachments !== undefined ? { attachments: room.attachments } : {}),
|
|
127
|
+
...(next < paths.length ? { pageToken: taken.at(-1) } : {}),
|
|
115
128
|
};
|
|
116
129
|
}
|
|
117
130
|
function advancement(room, from, at) {
|
|
@@ -136,9 +149,11 @@ export function createMemoryAdapter(options = {}) {
|
|
|
136
149
|
: [];
|
|
137
150
|
const attachments = room.attachments ?? [];
|
|
138
151
|
const declared = opening && JSON.stringify(attachments) !== JSON.stringify(from.attachments ?? []);
|
|
152
|
+
const models = opening ? changedModels(room, from) : undefined;
|
|
139
153
|
return {
|
|
140
154
|
kind: 'net-advancement',
|
|
141
155
|
roomVersion: room.roomVersion,
|
|
156
|
+
...(models === undefined ? {} : { models }),
|
|
142
157
|
documents: named(current, taken),
|
|
143
158
|
revisions: named(room.revisions ?? {}, taken),
|
|
144
159
|
changes: named(room.changes ?? {}, [...taken, ...targets]),
|
|
@@ -170,7 +185,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
170
185
|
function historiesOf(input) {
|
|
171
186
|
const asked = input?.conversations;
|
|
172
187
|
if (!Array.isArray(asked))
|
|
173
|
-
return { kind: 'rejected', code: 'invalid_request', fields: {} };
|
|
188
|
+
return { kind: 'rejected', code: 'invalid_request', fields: {}, retryable: false };
|
|
174
189
|
const histories = [];
|
|
175
190
|
for (const entry of asked) {
|
|
176
191
|
const conversation = typeof entry.conversation === 'string' ? scripted.get(entry.conversation) : undefined;
|
|
@@ -198,7 +213,12 @@ export function createMemoryAdapter(options = {}) {
|
|
|
198
213
|
const named = typeof input.conversation === 'string' ? input.conversation : '';
|
|
199
214
|
const conversation = scripted.get(named);
|
|
200
215
|
if (conversation === undefined) {
|
|
201
|
-
return {
|
|
216
|
+
return {
|
|
217
|
+
kind: 'rejected',
|
|
218
|
+
code: 'unknown-conversation',
|
|
219
|
+
fields: { conversation: named },
|
|
220
|
+
retryable: false,
|
|
221
|
+
};
|
|
202
222
|
}
|
|
203
223
|
const outcome = conversation.outcomes?.[name];
|
|
204
224
|
if (outcome !== undefined)
|
|
@@ -212,7 +232,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
212
232
|
if (name === 'conversation.cancel') {
|
|
213
233
|
const turn = typeof input.turn === 'string' ? input.turn : '';
|
|
214
234
|
if (sealed.has(turn) || !unsealed.has(turn)) {
|
|
215
|
-
return { kind: 'rejected', code: 'turn-sealed', fields: { turn } };
|
|
235
|
+
return { kind: 'rejected', code: 'turn-sealed', fields: { turn }, retryable: false };
|
|
216
236
|
}
|
|
217
237
|
unsealed.delete(turn);
|
|
218
238
|
return { kind: 'action', result: { turn, cancelled: true } };
|
|
@@ -221,15 +241,19 @@ export function createMemoryAdapter(options = {}) {
|
|
|
221
241
|
scripted.delete(named);
|
|
222
242
|
return { kind: 'action', result: { conversation: named } };
|
|
223
243
|
}
|
|
244
|
+
function announceList() {
|
|
245
|
+
const entries = [...scripted.values()].flatMap(({ conversation, listed }) => listed === undefined ? [] : [{ conversation, ...listed }]);
|
|
246
|
+
for (const listener of listeners)
|
|
247
|
+
listener({ kind: 'list', entries });
|
|
248
|
+
}
|
|
224
249
|
function discovery() {
|
|
225
250
|
return {
|
|
226
251
|
kind: 'discovery',
|
|
227
|
-
supportedVersions,
|
|
228
|
-
mdModel,
|
|
229
252
|
rooms: rooms.map(declared),
|
|
230
253
|
capabilities,
|
|
231
254
|
providerLimits,
|
|
232
255
|
retention,
|
|
256
|
+
...(options.member === undefined ? {} : { member: options.member }),
|
|
233
257
|
};
|
|
234
258
|
}
|
|
235
259
|
return {
|
|
@@ -240,9 +264,21 @@ export function createMemoryAdapter(options = {}) {
|
|
|
240
264
|
setConversations(next) {
|
|
241
265
|
scriptConversations(next);
|
|
242
266
|
},
|
|
243
|
-
|
|
267
|
+
open() {
|
|
268
|
+
announceList();
|
|
244
269
|
for (const observer of observers)
|
|
245
|
-
observer(
|
|
270
|
+
observer({ kind: 'opened' });
|
|
271
|
+
},
|
|
272
|
+
close(revoked = false) {
|
|
273
|
+
for (const observer of observers)
|
|
274
|
+
observer({ kind: 'closed', revoked });
|
|
275
|
+
},
|
|
276
|
+
expire(locators) {
|
|
277
|
+
expiring = [...locators];
|
|
278
|
+
},
|
|
279
|
+
notifyRoomVersion({ locator, roomVersion }) {
|
|
280
|
+
for (const observer of observers)
|
|
281
|
+
observer({ kind: 'room-version', locator, roomVersion });
|
|
246
282
|
},
|
|
247
283
|
notifyConversation(event) {
|
|
248
284
|
if (event.kind === 'accepted-message') {
|
|
@@ -256,8 +292,8 @@ export function createMemoryAdapter(options = {}) {
|
|
|
256
292
|
for (const observer of modeObservers)
|
|
257
293
|
observer(mode);
|
|
258
294
|
},
|
|
259
|
-
|
|
260
|
-
return
|
|
295
|
+
heldRooms() {
|
|
296
|
+
return held;
|
|
261
297
|
},
|
|
262
298
|
replicatedConversations() {
|
|
263
299
|
return replicated;
|
|
@@ -281,12 +317,45 @@ export function createMemoryAdapter(options = {}) {
|
|
|
281
317
|
};
|
|
282
318
|
},
|
|
283
319
|
},
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
320
|
+
roomStream: {
|
|
321
|
+
hold(asked) {
|
|
322
|
+
held = asked.map((room) => room.locator);
|
|
323
|
+
const expired = expiring.filter((locator) => held.includes(locator));
|
|
324
|
+
expiring = [];
|
|
325
|
+
const moved = asked.flatMap((room) => {
|
|
326
|
+
const current = rooms.find((entry) => entry.locator === room.locator);
|
|
327
|
+
return current === undefined ||
|
|
328
|
+
expired.includes(room.locator) ||
|
|
329
|
+
current.roomVersion === room.roomVersion
|
|
330
|
+
? []
|
|
331
|
+
: [{ locator: room.locator, roomVersion: current.roomVersion }];
|
|
332
|
+
});
|
|
333
|
+
queueMicrotask(() => {
|
|
334
|
+
for (const observer of observers) {
|
|
335
|
+
for (const room of moved)
|
|
336
|
+
observer({ kind: 'room-version', ...room });
|
|
337
|
+
observer({ kind: 'opening', expired });
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
},
|
|
341
|
+
reopen() {
|
|
342
|
+
queueMicrotask(() => {
|
|
343
|
+
for (const observer of observers)
|
|
344
|
+
observer({ kind: 'closed', revoked: false });
|
|
345
|
+
});
|
|
287
346
|
},
|
|
288
347
|
observe(notify) {
|
|
289
348
|
observers.add(notify);
|
|
349
|
+
queueMicrotask(() => {
|
|
350
|
+
if (!observers.has(notify))
|
|
351
|
+
return;
|
|
352
|
+
if (options.unopened === true) {
|
|
353
|
+
notify({ kind: 'closed', revoked: false });
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
announceList();
|
|
357
|
+
notify({ kind: 'opened' });
|
|
358
|
+
});
|
|
290
359
|
return () => {
|
|
291
360
|
observers.delete(notify);
|
|
292
361
|
};
|
|
@@ -298,13 +367,6 @@ export function createMemoryAdapter(options = {}) {
|
|
|
298
367
|
else
|
|
299
368
|
scripts[operation] = answer;
|
|
300
369
|
},
|
|
301
|
-
async model(_authorization, request) {
|
|
302
|
-
return resolveScript(scripts.model, () => {
|
|
303
|
-
const room = rooms.find((entry) => entry.locator === request.locator);
|
|
304
|
-
const answer = request.attached === 'collection' ? room?.model : room?.selectionModel;
|
|
305
|
-
return answer ?? { kind: 'model-unavailable', reason: 'not-readable' };
|
|
306
|
-
}, request);
|
|
307
|
-
},
|
|
308
370
|
async authorize() {
|
|
309
371
|
return resolveScript(scripts.authorize, () => ({}), undefined);
|
|
310
372
|
},
|
|
@@ -317,13 +379,21 @@ export function createMemoryAdapter(options = {}) {
|
|
|
317
379
|
});
|
|
318
380
|
},
|
|
319
381
|
reached,
|
|
382
|
+
follows(locator, roomVersion, next) {
|
|
383
|
+
const scripted = scripts.follows;
|
|
384
|
+
if (typeof scripted === 'boolean')
|
|
385
|
+
return scripted;
|
|
386
|
+
if (scripted !== undefined)
|
|
387
|
+
return scripted(locator, roomVersion, next);
|
|
388
|
+
return true;
|
|
389
|
+
},
|
|
320
390
|
async bootstrap(_authorization, request) {
|
|
321
391
|
return resolveScript(scripts.bootstrap, () => {
|
|
322
392
|
const room = rooms.find((entry) => entry.locator === request.locator);
|
|
323
393
|
if (room === undefined) {
|
|
324
394
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
325
395
|
}
|
|
326
|
-
return page(room, request.pageToken
|
|
396
|
+
return page(room, request.pageToken);
|
|
327
397
|
}, request).then((answer) => note(request.locator, answer));
|
|
328
398
|
},
|
|
329
399
|
async refresh(_authorization, request) {
|
|
@@ -341,10 +411,6 @@ export function createMemoryAdapter(options = {}) {
|
|
|
341
411
|
}
|
|
342
412
|
return advancement(continuation.room, continuation.from, continuation.at);
|
|
343
413
|
}
|
|
344
|
-
if (request.minPosition !== undefined &&
|
|
345
|
-
!reached(room.locator, room.roomVersion, request.minPosition)) {
|
|
346
|
-
return { kind: 'retryable-refusal', code: 'replica_behind', fields: {} };
|
|
347
|
-
}
|
|
348
414
|
if (request.fromRoomVersion === room.roomVersion) {
|
|
349
415
|
return { kind: 'still-current' };
|
|
350
416
|
}
|
|
@@ -360,7 +426,13 @@ export function createMemoryAdapter(options = {}) {
|
|
|
360
426
|
if (room === undefined) {
|
|
361
427
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
362
428
|
}
|
|
363
|
-
return {
|
|
429
|
+
return {
|
|
430
|
+
kind: 'rejected',
|
|
431
|
+
code: 'unscripted-mutation',
|
|
432
|
+
fields: {},
|
|
433
|
+
retryable: false,
|
|
434
|
+
affected: {},
|
|
435
|
+
};
|
|
364
436
|
}, request).then((answer) => note(request.locator, answer));
|
|
365
437
|
},
|
|
366
438
|
async history(_authorization, request) {
|
|
@@ -379,7 +451,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
379
451
|
return resolveScript(scripts.action, () => {
|
|
380
452
|
if (request.name.startsWith('conversation.'))
|
|
381
453
|
return conversationAction(request);
|
|
382
|
-
return { kind: 'rejected', code: 'unscripted-action', fields: {} };
|
|
454
|
+
return { kind: 'rejected', code: 'unscripted-action', fields: {}, retryable: false };
|
|
383
455
|
}, request).then((answer) => {
|
|
384
456
|
if (answer.kind === 'action' && answer.at !== undefined)
|
|
385
457
|
note(answer.at.locator, answer.at);
|
package/dist/model.d.ts
CHANGED
|
@@ -1,31 +1,27 @@
|
|
|
1
|
-
import type { Definition,
|
|
1
|
+
import type { Definition, ValueFacts, VerifiedModel } from '@agentshouse/mdmodel';
|
|
2
|
+
import type { Open } from './open.js';
|
|
2
3
|
export type ModelIdentity = {
|
|
3
4
|
identity: string;
|
|
4
5
|
version: string;
|
|
5
6
|
};
|
|
6
7
|
export type ModelSnapshot = ModelIdentity & {
|
|
7
8
|
schema: string | null;
|
|
9
|
+
revision: string | null;
|
|
8
10
|
};
|
|
9
|
-
export type ModelUnavailableReason = 'not-readable' | 'revoked' | 'not-acquired' | '
|
|
11
|
+
export type ModelUnavailableReason = Open<'not-readable' | 'revoked' | 'not-acquired' | 'invalid'>;
|
|
10
12
|
export type ModelResult = {
|
|
11
13
|
kind: 'model';
|
|
12
14
|
snapshot: ModelSnapshot;
|
|
13
15
|
} | {
|
|
14
16
|
kind: 'model-unavailable';
|
|
15
17
|
reason: ModelUnavailableReason;
|
|
16
|
-
} | {
|
|
17
|
-
kind: 'transport-uncertainty';
|
|
18
|
-
} | {
|
|
19
|
-
kind: 'revoked-authorization';
|
|
20
|
-
};
|
|
21
|
-
export type MdType = {
|
|
22
|
-
name: string;
|
|
23
|
-
fields: Readonly<Record<string, FieldSpec>>;
|
|
24
|
-
sections: Readonly<Record<string, SectionSpec>>;
|
|
25
18
|
};
|
|
19
|
+
export type MdType = Definition;
|
|
26
20
|
export type ModelState = {
|
|
27
21
|
status: 'unavailable';
|
|
28
22
|
reason: ModelUnavailableReason;
|
|
23
|
+
schema?: string | null;
|
|
24
|
+
revision?: string | null;
|
|
29
25
|
} | {
|
|
30
26
|
status: 'current' | 'cached';
|
|
31
27
|
snapshot: ModelSnapshot;
|
|
@@ -35,21 +31,26 @@ export type ModelState = {
|
|
|
35
31
|
export type TypesResult = {
|
|
36
32
|
status: 'unavailable';
|
|
37
33
|
reason: ModelUnavailableReason;
|
|
34
|
+
schema?: string | null;
|
|
35
|
+
revision?: string | null;
|
|
38
36
|
} | {
|
|
39
37
|
status: 'current' | 'cached';
|
|
40
38
|
identity: string;
|
|
41
39
|
version: string;
|
|
42
40
|
verifiedWith: ModelIdentity;
|
|
43
41
|
types: readonly MdType[];
|
|
42
|
+
schema: string | null;
|
|
43
|
+
revision: string | null;
|
|
44
44
|
};
|
|
45
45
|
export type ValidationReceipt = {
|
|
46
46
|
identity: string;
|
|
47
47
|
version: string;
|
|
48
|
-
source: 'current' | 'cached'
|
|
48
|
+
source: Open<'current' | 'cached'>;
|
|
49
49
|
};
|
|
50
50
|
export declare const NO_MODEL: ModelState;
|
|
51
51
|
export declare function definitionOf(state: ModelState, type: string | undefined): Definition | undefined;
|
|
52
52
|
export declare function modelTypes(state: ModelState): TypesResult;
|
|
53
53
|
export declare function cached(state: ModelState): ModelState;
|
|
54
54
|
export declare function sameModel(left: ModelIdentity, right: ModelIdentity): boolean;
|
|
55
|
+
export declare function referenceField(facts: ValueFacts | undefined): boolean;
|
|
55
56
|
//# sourceMappingURL=model.d.ts.map
|
package/dist/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,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