@agentshouse/mdruntime 0.1.0-c3903a68dcbbf → 0.1.0-c7b0ab1aa40a3
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 +51 -29
- package/README.md +11 -11
- package/dist/adapter.d.ts +78 -51
- 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 +34 -0
- package/dist/bootstrap.d.ts +5 -3
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +2 -3
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +2 -6
- package/dist/client.d.ts +4 -9
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +3 -16
- package/dist/collection.d.ts +0 -2
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +2 -12
- package/dist/connection.d.ts +10 -28
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +516 -639
- package/dist/conversation.d.ts +22 -11
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +250 -105
- package/dist/host.d.ts +7 -2
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +37 -57
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/memory.d.ts +11 -5
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +77 -27
- package/dist/model.d.ts +4 -11
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +4 -3
- package/dist/observation.d.ts +2 -0
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +24 -14
- package/dist/outcome.d.ts +5 -21
- package/dist/outcome.d.ts.map +1 -1
- package/dist/query.d.ts +7 -2
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +29 -20
- package/dist/reach.d.ts +40 -0
- package/dist/reach.d.ts.map +1 -0
- package/dist/reach.js +270 -0
- package/dist/react.d.ts +31 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +62 -0
- package/dist/read-side.d.ts +4 -0
- package/dist/read-side.d.ts.map +1 -1
- package/dist/read-side.js +16 -10
- package/dist/refresh.d.ts +2 -1
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +7 -3
- package/dist/replica.d.ts +4 -4
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +14 -19
- package/dist/room-draft.d.ts +3 -0
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +6 -4
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +1 -4
- package/dist/save.d.ts +0 -2
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +5 -11
- package/dist/store.d.ts +5 -16
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +10 -32
- package/dist/wire.d.ts +51 -16
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +50 -65
- package/package.json +14 -2
package/dist/store.js
CHANGED
|
@@ -5,7 +5,6 @@ const DOCUMENTS = 'documents';
|
|
|
5
5
|
const BINARY_TARGETS = 'binaryTargets';
|
|
6
6
|
const ATTACHMENTS = 'attachments';
|
|
7
7
|
const PENDING_CHANGES = 'pendingChanges';
|
|
8
|
-
const OUTCOMES = 'outcomes';
|
|
9
8
|
const DECLARATIONS = 'declarations';
|
|
10
9
|
const ROOM_DRAFTS = 'roomDrafts';
|
|
11
10
|
const PRESENTATION = 'presentation';
|
|
@@ -13,7 +12,7 @@ const CONVERSATIONS = 'conversations';
|
|
|
13
12
|
const MESSAGES = 'messages';
|
|
14
13
|
const CHAT_DRAFTS = 'chatDrafts';
|
|
15
14
|
const CURRENT = 'current';
|
|
16
|
-
const SCHEMA =
|
|
15
|
+
const SCHEMA = 20;
|
|
17
16
|
function settled(request) {
|
|
18
17
|
return new Promise((resolve, reject) => {
|
|
19
18
|
request.onsuccess = () => resolve(request.result);
|
|
@@ -32,7 +31,6 @@ const EMPTY_DECLARATIONS = {
|
|
|
32
31
|
generation: null,
|
|
33
32
|
providerLimits: [],
|
|
34
33
|
capabilities: [],
|
|
35
|
-
slots: [],
|
|
36
34
|
};
|
|
37
35
|
function declaration(database) {
|
|
38
36
|
const transaction = database.transaction(DECLARATIONS, 'readonly');
|
|
@@ -89,8 +87,6 @@ export async function openRuntimeStore() {
|
|
|
89
87
|
database.createObjectStore(BINARY_TARGETS, { keyPath: ['locator', 'path'] });
|
|
90
88
|
database.createObjectStore(ATTACHMENTS, { keyPath: ['locator', 'reference'] });
|
|
91
89
|
database.createObjectStore(PENDING_CHANGES, { keyPath: ['locator', 'id'] });
|
|
92
|
-
const outcomes = database.createObjectStore(OUTCOMES, { keyPath: 'id' });
|
|
93
|
-
outcomes.createIndex('locator', 'locator');
|
|
94
90
|
database.createObjectStore(DECLARATIONS);
|
|
95
91
|
database.createObjectStore(ROOM_DRAFTS, { keyPath: ['locator', 'path'] });
|
|
96
92
|
database.createObjectStore(PRESENTATION, { keyPath: 'app' });
|
|
@@ -156,8 +152,8 @@ export async function openRuntimeStore() {
|
|
|
156
152
|
}
|
|
157
153
|
return [...byRoom.values()];
|
|
158
154
|
},
|
|
159
|
-
async write({ next, previous, queue, previousQueue, saved,
|
|
160
|
-
const transaction = database.transaction([ROOMS, DOCUMENTS, BINARY_TARGETS, ATTACHMENTS, PENDING_CHANGES,
|
|
155
|
+
async write({ next, previous, queue, previousQueue, saved, roomDrafts, consumedRoomDrafts }) {
|
|
156
|
+
const transaction = database.transaction([ROOMS, DOCUMENTS, BINARY_TARGETS, ATTACHMENTS, PENDING_CHANGES, ROOM_DRAFTS], 'readwrite');
|
|
161
157
|
transaction.objectStore(ROOMS).put(roomRecord(next, queue));
|
|
162
158
|
const documents = transaction.objectStore(DOCUMENTS);
|
|
163
159
|
for (const path of Object.keys(previous?.documents ?? {})) {
|
|
@@ -231,13 +227,6 @@ export async function openRuntimeStore() {
|
|
|
231
227
|
}
|
|
232
228
|
}
|
|
233
229
|
}
|
|
234
|
-
const outcomeStore = transaction.objectStore(OUTCOMES);
|
|
235
|
-
for (const entry of outcomes ?? []) {
|
|
236
|
-
if (entry.outcome === null)
|
|
237
|
-
outcomeStore.delete(entry.id);
|
|
238
|
-
else
|
|
239
|
-
outcomeStore.put({ locator: next.locator, id: entry.id, outcome: entry.outcome });
|
|
240
|
-
}
|
|
241
230
|
const draftStore = transaction.objectStore(ROOM_DRAFTS);
|
|
242
231
|
for (const path of consumedRoomDrafts ?? [])
|
|
243
232
|
draftStore.delete([next.locator, path]);
|
|
@@ -266,15 +255,11 @@ export async function openRuntimeStore() {
|
|
|
266
255
|
async capabilities() {
|
|
267
256
|
return (await declaration(database)).capabilities;
|
|
268
257
|
},
|
|
269
|
-
|
|
270
|
-
return (await declaration(database)).slots;
|
|
271
|
-
},
|
|
272
|
-
declare(limits, capabilities, slots) {
|
|
258
|
+
declare(limits, capabilities) {
|
|
273
259
|
return updateDeclaration(database, (record) => ({
|
|
274
260
|
...record,
|
|
275
261
|
providerLimits: limits,
|
|
276
262
|
capabilities,
|
|
277
|
-
slots,
|
|
278
263
|
}));
|
|
279
264
|
},
|
|
280
265
|
async queues() {
|
|
@@ -290,18 +275,17 @@ export async function openRuntimeStore() {
|
|
|
290
275
|
const record = byId.get(`${room.locator}\0${id}`);
|
|
291
276
|
if (record === undefined)
|
|
292
277
|
throw new Error(`Missing Pending Change ${room.locator}/${id}`);
|
|
293
|
-
const { batch, drafts, submission, lost, upload } = record;
|
|
294
|
-
return { batch, state: { drafts, submission, lost, upload } };
|
|
278
|
+
const { batch, drafts, submission, lost, upload, accepted } = record;
|
|
279
|
+
return { batch, state: { drafts, submission, lost, upload, accepted } };
|
|
295
280
|
}),
|
|
296
281
|
}));
|
|
297
282
|
},
|
|
298
|
-
async outcomes() {
|
|
299
|
-
const transaction = database.transaction(OUTCOMES, 'readonly');
|
|
300
|
-
return settled(transaction.objectStore(OUTCOMES).getAll());
|
|
301
|
-
},
|
|
302
283
|
submit(locator, id, submission, lost) {
|
|
303
284
|
return amendPending(database, locator, id, { submission, lost });
|
|
304
285
|
},
|
|
286
|
+
accept(locator, id, roomVersion) {
|
|
287
|
+
return amendPending(database, locator, id, { accepted: roomVersion });
|
|
288
|
+
},
|
|
305
289
|
keepUpload(locator, id, upload) {
|
|
306
290
|
return amendPending(database, locator, id, { upload });
|
|
307
291
|
},
|
|
@@ -389,18 +373,12 @@ export async function openRuntimeStore() {
|
|
|
389
373
|
await completed(transaction);
|
|
390
374
|
},
|
|
391
375
|
async dropRooms(locators) {
|
|
392
|
-
const transaction = database.transaction([ROOMS, DOCUMENTS, BINARY_TARGETS, ATTACHMENTS, PENDING_CHANGES,
|
|
376
|
+
const transaction = database.transaction([ROOMS, DOCUMENTS, BINARY_TARGETS, ATTACHMENTS, PENDING_CHANGES, ROOM_DRAFTS], 'readwrite');
|
|
393
377
|
for (const locator of locators) {
|
|
394
378
|
transaction.objectStore(ROOMS).delete(locator);
|
|
395
379
|
for (const name of [DOCUMENTS, BINARY_TARGETS, ATTACHMENTS, PENDING_CHANGES, ROOM_DRAFTS]) {
|
|
396
380
|
removeRoomEntries(transaction.objectStore(name), locator);
|
|
397
381
|
}
|
|
398
|
-
const outcomes = transaction.objectStore(OUTCOMES);
|
|
399
|
-
const ids = outcomes.index('locator').getAllKeys(locator);
|
|
400
|
-
ids.onsuccess = () => {
|
|
401
|
-
for (const id of ids.result)
|
|
402
|
-
outcomes.delete(id);
|
|
403
|
-
};
|
|
404
382
|
}
|
|
405
383
|
await completed(transaction);
|
|
406
384
|
},
|
package/dist/wire.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { ConnectionRefusal } from './connection.js';
|
|
2
|
-
export declare const RUNTIME_WIRE_PROTOCOL = 8;
|
|
3
|
-
export declare const PROTOCOL_MISMATCH: ConnectionRefusal;
|
|
4
2
|
export type RuntimePort = {
|
|
5
3
|
postMessage(message: unknown): void;
|
|
6
4
|
addEventListener(type: 'message' | 'close', listener: (event: {
|
|
@@ -8,10 +6,57 @@ export type RuntimePort = {
|
|
|
8
6
|
}) => void): void;
|
|
9
7
|
start(): void;
|
|
10
8
|
};
|
|
11
|
-
|
|
12
|
-
declare const
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
export type WireReach = 'within' | 'app' | 'runtime' | 'actions' | 'whole';
|
|
10
|
+
declare const MEMBERS: {
|
|
11
|
+
readonly rooms: 'within';
|
|
12
|
+
readonly query: 'within';
|
|
13
|
+
readonly search: 'within';
|
|
14
|
+
readonly types: 'within';
|
|
15
|
+
readonly save: 'within';
|
|
16
|
+
readonly history: 'within';
|
|
17
|
+
readonly call: 'actions';
|
|
18
|
+
readonly reached: 'within';
|
|
19
|
+
readonly log: 'whole';
|
|
20
|
+
readonly persistence: 'runtime';
|
|
21
|
+
readonly reauthorize: 'runtime';
|
|
22
|
+
readonly 'roomDraft.list': 'within';
|
|
23
|
+
readonly 'roomDraft.read': 'within';
|
|
24
|
+
readonly 'roomDraft.write': 'within';
|
|
25
|
+
readonly 'roomDraft.discard': 'within';
|
|
26
|
+
readonly 'presentation.read': 'app';
|
|
27
|
+
readonly 'presentation.write': 'app';
|
|
28
|
+
readonly 'conversation.list': 'within';
|
|
29
|
+
readonly 'conversation.read': 'within';
|
|
30
|
+
readonly 'conversation.create': 'within';
|
|
31
|
+
readonly 'conversation.send': 'within';
|
|
32
|
+
readonly 'conversation.answer': 'within';
|
|
33
|
+
readonly 'conversation.interrupt': 'within';
|
|
34
|
+
readonly 'conversation.kill': 'within';
|
|
35
|
+
readonly 'conversation.cancel': 'within';
|
|
36
|
+
readonly 'conversation.delete': 'within';
|
|
37
|
+
readonly 'chatDraft.write': 'within';
|
|
38
|
+
readonly 'chatDraft.discard': 'within';
|
|
39
|
+
};
|
|
40
|
+
declare const TOPICS: {
|
|
41
|
+
readonly rooms: 'within';
|
|
42
|
+
readonly 'connection-refusal': 'runtime';
|
|
43
|
+
readonly 'storage-loss': 'runtime';
|
|
44
|
+
readonly 'deployment-facts': 'runtime';
|
|
45
|
+
readonly 'sync-status': 'within';
|
|
46
|
+
readonly 'service-mode': 'runtime';
|
|
47
|
+
readonly query: 'within';
|
|
48
|
+
readonly queue: 'within';
|
|
49
|
+
readonly 'room-drafts': 'within';
|
|
50
|
+
readonly presentation: 'app';
|
|
51
|
+
readonly conversation: 'within';
|
|
52
|
+
readonly conversations: 'within';
|
|
53
|
+
};
|
|
54
|
+
export declare const WIRE_REACH: {
|
|
55
|
+
readonly members: Readonly<Record<string, WireReach>>;
|
|
56
|
+
readonly topics: Readonly<Record<string, WireReach>>;
|
|
57
|
+
};
|
|
58
|
+
export type WireMember = keyof typeof MEMBERS;
|
|
59
|
+
export type WireTopic = keyof typeof TOPICS;
|
|
15
60
|
export type WireRequest = {
|
|
16
61
|
kind: 'hello';
|
|
17
62
|
} | {
|
|
@@ -48,16 +93,6 @@ export type WireAnswer = {
|
|
|
48
93
|
};
|
|
49
94
|
export declare const AUTHORIZATION_ENDED = "the host authorization ended";
|
|
50
95
|
export declare const PORT_CLOSED = "the port closed";
|
|
51
|
-
export type WireEnvelope = {
|
|
52
|
-
mdRuntime: number;
|
|
53
|
-
message: WireRequest | WireAnswer;
|
|
54
|
-
};
|
|
55
|
-
export type Carried = {
|
|
56
|
-
matching: boolean;
|
|
57
|
-
message: unknown;
|
|
58
|
-
};
|
|
59
|
-
export declare function envelope(message: WireRequest | WireAnswer): WireEnvelope;
|
|
60
|
-
export declare function carried(data: unknown): Carried | null;
|
|
61
96
|
export declare function request(message: unknown): WireRequest | null;
|
|
62
97
|
export declare function answer(message: unknown): WireAnswer | null;
|
|
63
98
|
export {};
|
package/dist/wire.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../src/wire.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,
|
|
1
|
+
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../src/wire.ts"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CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAe1D"}
|
package/dist/wire.js
CHANGED
|
@@ -1,69 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
const MEMBERS = {
|
|
2
|
+
rooms: 'within',
|
|
3
|
+
query: 'within',
|
|
4
|
+
search: 'within',
|
|
5
|
+
types: 'within',
|
|
6
|
+
save: 'within',
|
|
7
|
+
history: 'within',
|
|
8
|
+
call: 'actions',
|
|
9
|
+
reached: 'within',
|
|
10
|
+
log: 'whole',
|
|
11
|
+
persistence: 'runtime',
|
|
12
|
+
reauthorize: 'runtime',
|
|
13
|
+
'roomDraft.list': 'within',
|
|
14
|
+
'roomDraft.read': 'within',
|
|
15
|
+
'roomDraft.write': 'within',
|
|
16
|
+
'roomDraft.discard': 'within',
|
|
17
|
+
'presentation.read': 'app',
|
|
18
|
+
'presentation.write': 'app',
|
|
19
|
+
'conversation.list': 'within',
|
|
20
|
+
'conversation.read': 'within',
|
|
21
|
+
'conversation.create': 'within',
|
|
22
|
+
'conversation.send': 'within',
|
|
23
|
+
'conversation.answer': 'within',
|
|
24
|
+
'conversation.interrupt': 'within',
|
|
25
|
+
'conversation.kill': 'within',
|
|
26
|
+
'conversation.cancel': 'within',
|
|
27
|
+
'conversation.delete': 'within',
|
|
28
|
+
'chatDraft.write': 'within',
|
|
29
|
+
'chatDraft.discard': 'within',
|
|
6
30
|
};
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'
|
|
14
|
-
'
|
|
15
|
-
'
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
'persistence',
|
|
23
|
-
'deploymentFacts',
|
|
24
|
-
'reauthorize',
|
|
25
|
-
'roomDraft.list',
|
|
26
|
-
'roomDraft.read',
|
|
27
|
-
'roomDraft.write',
|
|
28
|
-
'roomDraft.discard',
|
|
29
|
-
'presentation.read',
|
|
30
|
-
'presentation.write',
|
|
31
|
-
'conversation.list',
|
|
32
|
-
'conversation.read',
|
|
33
|
-
'conversation.create',
|
|
34
|
-
'conversation.send',
|
|
35
|
-
'conversation.answer',
|
|
36
|
-
'conversation.interrupt',
|
|
37
|
-
'conversation.kill',
|
|
38
|
-
'conversation.cancel',
|
|
39
|
-
'conversation.delete',
|
|
40
|
-
'chatDraft.write',
|
|
41
|
-
'chatDraft.discard',
|
|
42
|
-
];
|
|
43
|
-
const TOPICS = [
|
|
44
|
-
'rooms',
|
|
45
|
-
'connection-refusal',
|
|
46
|
-
'storage-loss',
|
|
47
|
-
'deployment-facts',
|
|
48
|
-
'sync-status',
|
|
49
|
-
'service-mode',
|
|
50
|
-
'query',
|
|
51
|
-
'queue',
|
|
52
|
-
'room-drafts',
|
|
53
|
-
'presentation',
|
|
54
|
-
'conversation',
|
|
55
|
-
];
|
|
31
|
+
const TOPICS = {
|
|
32
|
+
rooms: 'within',
|
|
33
|
+
'connection-refusal': 'runtime',
|
|
34
|
+
'storage-loss': 'runtime',
|
|
35
|
+
'deployment-facts': 'runtime',
|
|
36
|
+
'sync-status': 'within',
|
|
37
|
+
'service-mode': 'runtime',
|
|
38
|
+
query: 'within',
|
|
39
|
+
queue: 'within',
|
|
40
|
+
'room-drafts': 'within',
|
|
41
|
+
presentation: 'app',
|
|
42
|
+
conversation: 'within',
|
|
43
|
+
conversations: 'within',
|
|
44
|
+
};
|
|
45
|
+
export const WIRE_REACH = { members: MEMBERS, topics: TOPICS };
|
|
56
46
|
export const AUTHORIZATION_ENDED = 'the host authorization ended';
|
|
57
47
|
export const PORT_CLOSED = 'the port closed';
|
|
58
|
-
export function envelope(message) {
|
|
59
|
-
return { mdRuntime: RUNTIME_WIRE_PROTOCOL, message };
|
|
60
|
-
}
|
|
61
|
-
export function carried(data) {
|
|
62
|
-
if (typeof data !== 'object' || data === null || !('mdRuntime' in data))
|
|
63
|
-
return null;
|
|
64
|
-
const record = data;
|
|
65
|
-
return { matching: record.mdRuntime === RUNTIME_WIRE_PROTOCOL, message: record.message };
|
|
66
|
-
}
|
|
67
48
|
function body(message) {
|
|
68
49
|
if (typeof message !== 'object' || message === null)
|
|
69
50
|
return null;
|
|
@@ -83,7 +64,9 @@ export function request(message) {
|
|
|
83
64
|
return { kind: 'stop', id: shape.id };
|
|
84
65
|
if (!Array.isArray(record.input))
|
|
85
66
|
return null;
|
|
86
|
-
if (shape.kind === 'call' &&
|
|
67
|
+
if (shape.kind === 'call' &&
|
|
68
|
+
typeof record.member === 'string' &&
|
|
69
|
+
Object.hasOwn(MEMBERS, record.member)) {
|
|
87
70
|
return {
|
|
88
71
|
kind: 'call',
|
|
89
72
|
id: shape.id,
|
|
@@ -91,7 +74,9 @@ export function request(message) {
|
|
|
91
74
|
input: record.input,
|
|
92
75
|
};
|
|
93
76
|
}
|
|
94
|
-
if (shape.kind === 'observe' &&
|
|
77
|
+
if (shape.kind === 'observe' &&
|
|
78
|
+
typeof record.topic === 'string' &&
|
|
79
|
+
Object.hasOwn(TOPICS, record.topic)) {
|
|
95
80
|
return {
|
|
96
81
|
kind: 'observe',
|
|
97
82
|
id: shape.id,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentshouse/mdruntime",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-c7b0ab1aa40a3",
|
|
4
4
|
"description": "The headless core of MD App",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
"types": "./dist/memory.d.ts",
|
|
29
29
|
"import": "./dist/memory.js"
|
|
30
30
|
},
|
|
31
|
+
"./react": {
|
|
32
|
+
"types": "./dist/react.d.ts",
|
|
33
|
+
"import": "./dist/react.js"
|
|
34
|
+
},
|
|
31
35
|
"./package.json": "./package.json"
|
|
32
36
|
},
|
|
33
37
|
"files": [
|
|
@@ -37,8 +41,16 @@
|
|
|
37
41
|
"LICENSE"
|
|
38
42
|
],
|
|
39
43
|
"dependencies": {
|
|
40
|
-
"@agentshouse/mdmodel": "0.1.0-
|
|
44
|
+
"@agentshouse/mdmodel": "0.1.0-c68e2039f1ca8",
|
|
41
45
|
"@tanstack/db": "0.9.2",
|
|
42
46
|
"minisearch": "7.2.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"react": ">=18"
|
|
50
|
+
},
|
|
51
|
+
"peerDependenciesMeta": {
|
|
52
|
+
"react": {
|
|
53
|
+
"optional": true
|
|
54
|
+
}
|
|
43
55
|
}
|
|
44
56
|
}
|