@agentshouse/mdruntime 0.1.0-c44866799613e → 0.1.0-c44d5cc00aee5
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 +18 -17
- package/dist/acceptance.d.ts +3 -0
- package/dist/acceptance.d.ts.map +1 -0
- package/dist/acceptance.js +299 -0
- package/dist/act-lanes.d.ts +30 -0
- package/dist/act-lanes.d.ts.map +1 -0
- package/dist/act-lanes.js +225 -0
- package/dist/actions.d.ts +26 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +302 -0
- package/dist/adapter.d.ts +110 -112
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +3 -11
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +28 -51
- package/dist/bootstrap.d.ts +15 -18
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +252 -158
- package/dist/cell.d.ts +6 -0
- package/dist/cell.d.ts.map +1 -0
- package/dist/cell.js +9 -0
- package/dist/chain.d.ts +2 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/change-set.d.ts +4 -0
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +6 -0
- package/dist/change.d.ts +1 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +4 -2
- package/dist/chat-types.d.ts +3 -0
- package/dist/chat-types.d.ts.map +1 -0
- package/dist/chat-types.js +11 -0
- package/dist/client.d.ts +27 -21
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +36 -17
- package/dist/collection.d.ts +23 -7
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +13 -19
- package/dist/compile.d.ts +8 -6
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +288 -329
- package/dist/connection.d.ts +5 -143
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +109 -5104
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +7 -0
- package/dist/conversation-live.d.ts +143 -0
- package/dist/conversation-live.d.ts.map +1 -0
- package/dist/conversation-live.js +254 -0
- package/dist/conversation-row.d.ts +33 -0
- package/dist/conversation-row.d.ts.map +1 -0
- package/dist/conversation-row.js +53 -0
- package/dist/conversation.d.ts +65 -48
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +987 -838
- package/dist/declaration.d.ts +10 -0
- package/dist/declaration.d.ts.map +1 -0
- package/dist/declaration.js +24 -0
- package/dist/discovery.d.ts +10 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +150 -0
- package/dist/durability.d.ts +19 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/durability.js +4 -0
- package/dist/entry.d.ts +3 -2
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +19 -9
- package/dist/expectation.d.ts +26 -13
- package/dist/expectation.d.ts.map +1 -1
- package/dist/expectation.js +72 -19
- package/dist/failure.d.ts +3 -0
- package/dist/failure.d.ts.map +1 -1
- package/dist/failure.js +6 -0
- package/dist/figures.d.ts +49 -0
- package/dist/figures.d.ts.map +1 -0
- package/dist/figures.js +197 -0
- package/dist/holdings.d.ts +29 -0
- package/dist/holdings.d.ts.map +1 -0
- package/dist/holdings.js +95 -0
- package/dist/host.d.ts +21 -8
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +73 -40
- 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 +34 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -5
- package/dist/install.d.ts +54 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +530 -0
- package/dist/lifecycle.d.ts +7 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +277 -0
- package/dist/listing.d.ts +48 -0
- package/dist/listing.d.ts.map +1 -0
- package/dist/listing.js +139 -0
- package/dist/live.d.ts +5 -4
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +64 -23
- package/dist/locks.d.ts +7 -0
- package/dist/locks.d.ts.map +1 -0
- package/dist/locks.js +32 -0
- package/dist/lost.d.ts +5 -0
- package/dist/lost.d.ts.map +1 -0
- package/dist/lost.js +49 -0
- package/dist/media.d.ts +2 -2
- package/dist/media.d.ts.map +1 -1
- package/dist/media.js +23 -13
- package/dist/memory.d.ts +17 -7
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +210 -97
- package/dist/messages.d.ts +33 -5
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +104 -36
- package/dist/model.d.ts +2 -11
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +0 -23
- package/dist/models.d.ts +10 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +153 -0
- package/dist/observation.d.ts +4 -3
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +23 -17
- package/dist/opened.d.ts +1 -1
- package/dist/opened.d.ts.map +1 -1
- package/dist/opened.js +5 -5
- package/dist/opening.d.ts +4 -0
- package/dist/opening.d.ts.map +1 -0
- package/dist/opening.js +53 -0
- package/dist/outcome.d.ts +7 -4
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +18 -0
- package/dist/overlay.d.ts +6 -1
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +47 -21
- package/dist/page-metadata.d.ts +8 -0
- package/dist/page-metadata.d.ts.map +1 -0
- package/dist/page-metadata.js +19 -0
- package/dist/parts.d.ts +4 -0
- package/dist/parts.d.ts.map +1 -0
- package/dist/parts.js +13 -0
- package/dist/paths.d.ts +2 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +26 -0
- package/dist/preparation.d.ts +20 -0
- package/dist/preparation.d.ts.map +1 -0
- package/dist/preparation.js +227 -0
- package/dist/presence.d.ts +52 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +220 -0
- package/dist/queries.d.ts +16 -0
- package/dist/queries.d.ts.map +1 -0
- package/dist/queries.js +282 -0
- package/dist/query.d.ts +14 -210
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -505
- package/dist/questions.d.ts +29 -0
- package/dist/questions.d.ts.map +1 -0
- package/dist/questions.js +115 -0
- package/dist/queue.d.ts +40 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/queue.js +450 -0
- package/dist/reach.d.ts +15 -12
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +240 -149
- package/dist/react.d.ts +15 -2
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +33 -1
- package/dist/read.d.ts +7 -0
- package/dist/read.d.ts.map +1 -0
- package/dist/read.js +17 -0
- package/dist/readiness.d.ts +4 -19
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +4 -10
- package/dist/reads.d.ts +38 -10
- package/dist/reads.d.ts.map +1 -1
- package/dist/reads.js +163 -85
- package/dist/recovery.d.ts +3 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +57 -1
- package/dist/refresh.d.ts +7 -5
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +35 -7
- package/dist/refusal.d.ts +5 -0
- package/dist/refusal.d.ts.map +1 -0
- package/dist/refusal.js +55 -0
- package/dist/replica.d.ts +12 -18
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +64 -34
- package/dist/retried.d.ts +30 -0
- package/dist/retried.d.ts.map +1 -0
- package/dist/retried.js +72 -0
- package/dist/room-draft.d.ts +24 -10
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +142 -106
- package/dist/room-drafts.d.ts +24 -0
- package/dist/room-drafts.d.ts.map +1 -0
- package/dist/room-drafts.js +217 -0
- package/dist/rows.d.ts +14 -21
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +49 -186
- package/dist/runtime.d.ts +34 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +1 -0
- package/dist/save.d.ts +42 -84
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +349 -170
- package/dist/saves.d.ts +32 -0
- package/dist/saves.d.ts.map +1 -0
- package/dist/saves.js +410 -0
- package/dist/search.d.ts +12 -63
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +9 -52
- package/dist/seed.d.ts +11 -2
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +71 -1
- package/dist/shared.d.ts +1 -7
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +13 -105
- package/dist/shown.d.ts +33 -0
- package/dist/shown.d.ts.map +1 -0
- package/dist/shown.js +302 -0
- package/dist/socket/admission.d.ts +7 -0
- package/dist/socket/admission.d.ts.map +1 -0
- package/dist/socket/admission.js +39 -0
- package/dist/socket/answers.d.ts +6 -0
- package/dist/socket/answers.d.ts.map +1 -0
- package/dist/socket/answers.js +20 -0
- package/dist/socket/lanes.d.ts +28 -0
- package/dist/socket/lanes.d.ts.map +1 -0
- package/dist/socket/lanes.js +103 -0
- package/dist/socket/reads.d.ts +10 -0
- package/dist/socket/reads.d.ts.map +1 -0
- package/dist/socket/reads.js +31 -0
- package/dist/socket/session.d.ts +38 -0
- package/dist/socket/session.d.ts.map +1 -0
- package/dist/socket/session.js +23 -0
- package/dist/socket.d.ts +67 -0
- package/dist/socket.d.ts.map +1 -0
- package/dist/socket.js +164 -0
- package/dist/source.d.ts +54 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +82 -0
- package/dist/status.d.ts +4 -5
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -7
- package/dist/store/installs.d.ts +30 -0
- package/dist/store/installs.d.ts.map +1 -0
- package/dist/store/installs.js +34 -0
- package/dist/store/readiness.d.ts +10 -0
- package/dist/store/readiness.d.ts.map +1 -0
- package/dist/store/readiness.js +52 -0
- package/dist/store/records.d.ts +214 -0
- package/dist/store/records.d.ts.map +1 -0
- package/dist/store/records.js +438 -0
- package/dist/store/room-held.d.ts +8 -0
- package/dist/store/room-held.d.ts.map +1 -0
- package/dist/store/room-held.js +17 -0
- package/dist/store/space.d.ts +11 -0
- package/dist/store/space.d.ts.map +1 -0
- package/dist/store/space.js +41 -0
- package/dist/store/watchers.d.ts +17 -0
- package/dist/store/watchers.d.ts.map +1 -0
- package/dist/store/watchers.js +56 -0
- package/dist/store/writes.d.ts +24 -0
- package/dist/store/writes.d.ts.map +1 -0
- package/dist/store/writes.js +125 -0
- package/dist/store.d.ts +120 -171
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +166 -414
- package/dist/stored.d.ts +62 -57
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +317 -239
- package/dist/surface.d.ts +88 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +220 -0
- package/dist/sync.d.ts +19 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +535 -0
- package/dist/tables.d.ts +126 -65
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +250 -113
- package/dist/tallies.d.ts +18 -0
- package/dist/tallies.d.ts.map +1 -0
- package/dist/tallies.js +128 -0
- package/dist/transfer.d.ts +0 -5
- package/dist/transfer.d.ts.map +1 -1
- package/dist/validation.d.ts +3 -4
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +42 -100
- package/dist/windows.d.ts +1 -12
- package/dist/windows.d.ts.map +1 -1
- package/dist/windows.js +2 -75
- package/dist/wire.d.ts +65 -9
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +22 -5
- package/package.json +3 -2
- package/dist/attempt.d.ts +0 -16
- package/dist/attempt.d.ts.map +0 -1
- package/dist/attempt.js +0 -70
- package/dist/fence.d.ts +0 -6
- package/dist/fence.d.ts.map +0 -1
- package/dist/fence.js +0 -10
- package/dist/fulltext.d.ts +0 -27
- package/dist/fulltext.d.ts.map +0 -1
- package/dist/fulltext.js +0 -368
- package/dist/log.d.ts +0 -5
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js +0 -14
- package/dist/words.d.ts +0 -19
- package/dist/words.d.ts.map +0 -1
- package/dist/words.js +0 -150
package/dist/opening.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { conversationsOpened } from './conversation.js';
|
|
2
|
+
import { detectStorageLoss, nextGeneration, refusedForSpace } from './durability.js';
|
|
3
|
+
import { uncaught } from './failure.js';
|
|
4
|
+
import { sweep } from './install.js';
|
|
5
|
+
import { eraseFenced } from './lost.js';
|
|
6
|
+
import { prepare } from './preparation.js';
|
|
7
|
+
import { unpair } from './queue.js';
|
|
8
|
+
import { emitRooms, emitStorageLoss, statusShown } from './shown.js';
|
|
9
|
+
export async function open(runtime, opened) {
|
|
10
|
+
const { store, socket, shell, conversations, build, usableWhenHeld } = runtime;
|
|
11
|
+
if (socket.closed())
|
|
12
|
+
throw new Error('runtime closed');
|
|
13
|
+
const interrupted = await opened.fences();
|
|
14
|
+
const kept = shell.generation;
|
|
15
|
+
const storedGeneration = await opened.generation();
|
|
16
|
+
const loss = detectStorageLoss(storedGeneration, kept);
|
|
17
|
+
const generation = nextGeneration(storedGeneration, kept);
|
|
18
|
+
if (generation !== storedGeneration)
|
|
19
|
+
await opened.rememberGeneration(generation);
|
|
20
|
+
if (generation !== kept)
|
|
21
|
+
await shell.keepGeneration(generation);
|
|
22
|
+
if (loss !== null) {
|
|
23
|
+
store.device.set({ storageLoss: loss });
|
|
24
|
+
emitStorageLoss(runtime);
|
|
25
|
+
}
|
|
26
|
+
const held = await opened.opened();
|
|
27
|
+
store.device.set({
|
|
28
|
+
heldWhenOpened: usableWhenHeld.length > 0 && (await opened.covering()).rooms.size > 0,
|
|
29
|
+
});
|
|
30
|
+
try {
|
|
31
|
+
await opened.demote();
|
|
32
|
+
await store.ask({ kind: 'read.builds', build });
|
|
33
|
+
for (const key of held.orphans)
|
|
34
|
+
await opened.release(key);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
if (!refusedForSpace(error))
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
if (held.erasing || held.orphans.length > 0)
|
|
41
|
+
queueMicrotask(() => sweep(runtime));
|
|
42
|
+
await conversationsOpened(conversations, opened);
|
|
43
|
+
if (interrupted.length > 0) {
|
|
44
|
+
queueMicrotask(() => {
|
|
45
|
+
void eraseFenced(runtime, interrupted).catch(uncaught);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
statusShown(runtime);
|
|
49
|
+
prepare(runtime);
|
|
50
|
+
emitRooms(runtime);
|
|
51
|
+
void unpair(runtime).catch(uncaught);
|
|
52
|
+
return opened;
|
|
53
|
+
}
|
package/dist/outcome.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ActionResult, AdapterFailure, AttachResult, BinaryLinkResult, HistoryResult, HistoryRevision, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
|
|
2
2
|
import type { ChangeBatch } from './change.js';
|
|
3
|
+
import type { Attempt, Retries } from './retried.js';
|
|
3
4
|
import type { KeptBinary, KeptResult } from './opened.js';
|
|
4
5
|
type Refused<Kind extends string> = ProviderRefusal & {
|
|
5
6
|
kind: Kind;
|
|
@@ -13,7 +14,9 @@ export type CallResult = {
|
|
|
13
14
|
kind: 'action';
|
|
14
15
|
result: unknown;
|
|
15
16
|
at?: RoomVersionAt;
|
|
16
|
-
} | Refused<'rejected'>
|
|
17
|
+
} | (Refused<'rejected'> & {
|
|
18
|
+
reset?: string;
|
|
19
|
+
}) | Refused<'undeclared'> | Failure;
|
|
17
20
|
export type HistoryAnswer = Exclude<HistoryResult, {
|
|
18
21
|
kind: Failure['kind'];
|
|
19
22
|
}> | Failure;
|
|
@@ -65,6 +68,7 @@ export type Offline = {
|
|
|
65
68
|
readonly kind: 'offline';
|
|
66
69
|
};
|
|
67
70
|
export declare const OFFLINE: Offline;
|
|
71
|
+
export declare function answeredResult(value: unknown): boolean;
|
|
68
72
|
export declare const UNCERTAIN: Failure;
|
|
69
73
|
export declare function undeclared(name: string): CallResult;
|
|
70
74
|
export declare function failure(result: AdapterFailure): Failure;
|
|
@@ -80,9 +84,8 @@ export type QueueEntry = {
|
|
|
80
84
|
readonly batch: ChangeBatch;
|
|
81
85
|
} & (Submission | {
|
|
82
86
|
readonly state: 'local';
|
|
83
|
-
} | {
|
|
84
|
-
readonly state: 'accepted';
|
|
85
|
-
readonly roomVersion: string;
|
|
86
87
|
});
|
|
88
|
+
export declare const UNANSWERED: ActionResult;
|
|
89
|
+
export declare function handedOutcome(retries: Retries, attempt: Attempt | undefined, result: ActionResult): CallResult;
|
|
87
90
|
export {};
|
|
88
91
|
//# sourceMappingURL=outcome.d.ts.map
|
package/dist/outcome.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../src/outcome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,eAAe,EACf,aAAa,EACb,aAAa,EACd,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../src/outcome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,eAAe,EACf,aAAa,EACb,aAAa,EACd,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE1D,KAAK,OAAO,CAAC,IAAI,SAAS,MAAM,IAAI,eAAe,GAAG;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC;AAErE,MAAM,MAAM,OAAO,GACf,OAAO,CAAC,uBAAuB,C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AAO,EAChB,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,MAAM,EAAE,YAAY,GACnB,UAAU,CAUZ"}
|
package/dist/outcome.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { refusalError } from './failure.js';
|
|
1
2
|
export const UNREADABLE = {
|
|
2
3
|
kind: 'unreadable',
|
|
3
4
|
code: 'room-not-readable',
|
|
@@ -44,6 +45,9 @@ export function lockedRoom(locator) {
|
|
|
44
45
|
return { kind: ROOM_LOCKED, locator, code: ROOM_LOCKED, fields: {}, retryable: true };
|
|
45
46
|
}
|
|
46
47
|
export const OFFLINE = { kind: 'offline' };
|
|
48
|
+
export function answeredResult(value) {
|
|
49
|
+
return typeof value === 'object' && value !== null && !('pending' in value);
|
|
50
|
+
}
|
|
47
51
|
export const UNCERTAIN = {
|
|
48
52
|
kind: 'transport-uncertainty',
|
|
49
53
|
code: 'transport-uncertainty',
|
|
@@ -79,3 +83,17 @@ export function historyAnswer(result) {
|
|
|
79
83
|
? result
|
|
80
84
|
: failure(result);
|
|
81
85
|
}
|
|
86
|
+
export const UNANSWERED = { kind: 'transport-uncertainty' };
|
|
87
|
+
export function handedOutcome(retries, attempt, result) {
|
|
88
|
+
if (attempt !== undefined) {
|
|
89
|
+
const { step, instance } = attempt;
|
|
90
|
+
if (result.kind === 'action')
|
|
91
|
+
retries.succeeded(step, instance);
|
|
92
|
+
else if (result.kind === 'transport-uncertainty')
|
|
93
|
+
retries.uncertain(step, instance, result);
|
|
94
|
+
else if (result.kind === 'rejected' && result.retryable) {
|
|
95
|
+
retries.failed(step, instance, refusalError(result));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return calledResult(result);
|
|
99
|
+
}
|
package/dist/overlay.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { type ApplyResult } from '@agentshouse/mdmodel';
|
|
1
2
|
import type { BinaryFile, HeadChange } from './adapter.js';
|
|
3
|
+
import { type Composition } from './collection.js';
|
|
2
4
|
import type { ChangeBatch } from './change.js';
|
|
3
5
|
export type Heads = {
|
|
4
6
|
revisions: Readonly<Record<string, string>>;
|
|
5
7
|
fileIds: Readonly<Record<string, string>>;
|
|
8
|
+
created: Readonly<Record<string, string>>;
|
|
6
9
|
changes: Readonly<Record<string, HeadChange>>;
|
|
7
10
|
};
|
|
8
11
|
export type HeldBinary = ({
|
|
@@ -21,5 +24,7 @@ export type Layer = Heads & {
|
|
|
21
24
|
export declare function acceptedBinaries(files: Readonly<Record<string, BinaryFile>>): Generator<readonly [string, HeldBinary]>;
|
|
22
25
|
export declare function sameBinary(left: HeldBinary | undefined, right: HeldBinary | undefined): boolean;
|
|
23
26
|
export declare function sameChange(left: HeadChange | undefined, right: HeadChange | undefined): boolean;
|
|
24
|
-
export declare function
|
|
27
|
+
export declare function composed(path: string, fields: Readonly<Record<string, unknown>>, sections: Readonly<Record<string, string>>, composition: Composition): ApplyResult;
|
|
28
|
+
export declare function compose(path: string, fields: Readonly<Record<string, unknown>>, sections: Readonly<Record<string, string>>, composition: Composition): string;
|
|
29
|
+
export declare function overlaying(base: Layer, queue: readonly ChangeBatch[], composition: Composition, unapplied?: () => void): Generator<number, Layer, void>;
|
|
25
30
|
//# sourceMappingURL=overlay.d.ts.map
|
package/dist/overlay.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../src/overlay.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../src/overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,WAAW,EAEjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAU,WAAW,EAAgB,MAAM,aAAa,CAAC;AAIrE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UAAU,GAAG,SAAS,EAAE,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAQ/F;AAqDD,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC1C,WAAW,EAAE,WAAW,GACvB,WAAW,CAqBb;AAED,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC1C,WAAW,EAAE,WAAW,GACvB,MAAM,CAIR;AA8ID,wBAAiB,UAAU,CACzB,IAAI,EAAE,KAAK,EACX,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,WAAW,EAAE,WAAW,EACxB,SAAS,CAAC,EAAE,MAAM,IAAI,GACrB,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAsChC"}
|
package/dist/overlay.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { apply, frontmatterValue, parse, serialize, } from '@agentshouse/mdmodel';
|
|
1
|
+
import { apply, create, frontmatterValue, parse, serialize, TYPE_FIELD, } from '@agentshouse/mdmodel';
|
|
2
|
+
import { definitionsAt } from './collection.js';
|
|
2
3
|
import { drafted, entriesIn, settling } from './shared.js';
|
|
3
4
|
import { ROW_WEIGHT } from './turn.js';
|
|
4
5
|
export function* acceptedBinaries(files) {
|
|
@@ -24,7 +25,6 @@ export function sameChange(left, right) {
|
|
|
24
25
|
left.author?.id === right.author?.id &&
|
|
25
26
|
left.author?.name === right.author?.name);
|
|
26
27
|
}
|
|
27
|
-
const EMPTY_FRONTMATTER = '---\n---\n';
|
|
28
28
|
function isPart(change) {
|
|
29
29
|
return change.kind === 'field' || change.kind === 'section' || change.kind === 'preamble';
|
|
30
30
|
}
|
|
@@ -53,16 +53,27 @@ function* priorsOf(preconditions) {
|
|
|
53
53
|
preamble: (path) => preambles.get(path) ?? '',
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
export function composed(path, fields, sections, composition) {
|
|
57
|
+
const declared = fields[TYPE_FIELD];
|
|
58
|
+
const type = typeof declared === 'string' && declared !== '' ? declared : undefined;
|
|
59
|
+
const definition = definitionsAt(composition, path)(type);
|
|
60
|
+
return apply(create(type, definition), [
|
|
61
|
+
...Object.entries(fields).flatMap(([name, value]) => (name !== TYPE_FIELD || type === undefined) && frontmatterValue(value)
|
|
62
|
+
? [{ kind: 'field', name, value, prior: undefined }]
|
|
63
|
+
: []),
|
|
64
|
+
...Object.entries(sections).map(([name, value]) => ({
|
|
65
|
+
kind: 'section',
|
|
66
|
+
name,
|
|
67
|
+
value,
|
|
68
|
+
prior: undefined,
|
|
69
|
+
})),
|
|
70
|
+
], definition);
|
|
71
|
+
}
|
|
72
|
+
export function compose(path, fields, sections, composition) {
|
|
73
|
+
const next = composed(path, fields, sections, composition);
|
|
74
|
+
if (next.outcome !== 'applied')
|
|
75
|
+
throw new Error(`the creation of ${path} writes no document`);
|
|
76
|
+
return serialize(next.document);
|
|
66
77
|
}
|
|
67
78
|
function edited(change, priors) {
|
|
68
79
|
if (change.kind === 'field')
|
|
@@ -81,17 +92,19 @@ function edited(change, priors) {
|
|
|
81
92
|
prior: priors.section(change.path, change.name),
|
|
82
93
|
};
|
|
83
94
|
}
|
|
84
|
-
function edit(staged, changes, priors) {
|
|
95
|
+
function edit(staged, changes, priors, composition) {
|
|
85
96
|
const path = changes[0].path;
|
|
86
97
|
delete staged.revisions[path];
|
|
87
98
|
const text = staged.documents[path];
|
|
88
99
|
if (text === undefined)
|
|
89
100
|
return changes.length;
|
|
90
|
-
const
|
|
101
|
+
const definitions = definitionsAt(composition, path);
|
|
102
|
+
const parsed = parse(text, path, definitions);
|
|
91
103
|
if (!parsed.ok)
|
|
92
104
|
return changes.length;
|
|
105
|
+
const definition = definitions(parsed.document.type);
|
|
93
106
|
const wanted = changes.map((change) => edited(change, priors));
|
|
94
|
-
const first = apply(parsed.document, wanted);
|
|
107
|
+
const first = apply(parsed.document, wanted, definition);
|
|
95
108
|
if (first.outcome === 'refuse')
|
|
96
109
|
return changes.length;
|
|
97
110
|
if (first.outcome === 'applied') {
|
|
@@ -100,7 +113,7 @@ function edit(staged, changes, priors) {
|
|
|
100
113
|
}
|
|
101
114
|
const stale = new Set(first.stale);
|
|
102
115
|
const kept = wanted.filter((_, at) => !stale.has(at));
|
|
103
|
-
const rest = apply(parsed.document, kept);
|
|
116
|
+
const rest = apply(parsed.document, kept, definition);
|
|
104
117
|
if (rest.outcome !== 'applied')
|
|
105
118
|
return changes.length;
|
|
106
119
|
staged.documents[path] = serialize(rest.document);
|
|
@@ -125,16 +138,21 @@ function relocate(staged, from, to) {
|
|
|
125
138
|
function moveHead(heads, from, to) {
|
|
126
139
|
const revision = heads.revisions[from];
|
|
127
140
|
const fileId = heads.fileIds[from];
|
|
141
|
+
const created = heads.created[from];
|
|
128
142
|
const change = heads.changes[from];
|
|
129
143
|
delete heads.revisions[from];
|
|
130
144
|
delete heads.fileIds[from];
|
|
145
|
+
delete heads.created[from];
|
|
131
146
|
delete heads.changes[from];
|
|
132
147
|
delete heads.fileIds[to];
|
|
148
|
+
delete heads.created[to];
|
|
133
149
|
delete heads.changes[to];
|
|
134
150
|
if (revision !== undefined)
|
|
135
151
|
heads.revisions[to] = revision;
|
|
136
152
|
if (fileId !== undefined)
|
|
137
153
|
heads.fileIds[to] = fileId;
|
|
154
|
+
if (created !== undefined)
|
|
155
|
+
heads.created[to] = created;
|
|
138
156
|
if (change !== undefined)
|
|
139
157
|
heads.changes[to] = change;
|
|
140
158
|
}
|
|
@@ -142,14 +160,18 @@ function erase(staged, path) {
|
|
|
142
160
|
delete staged.documents[path];
|
|
143
161
|
delete staged.revisions[path];
|
|
144
162
|
delete staged.fileIds[path];
|
|
163
|
+
delete staged.created[path];
|
|
145
164
|
delete staged.changes[path];
|
|
146
165
|
delete staged.binaries[path];
|
|
147
166
|
}
|
|
148
|
-
function stage(staged, change) {
|
|
167
|
+
function stage(staged, change, composition) {
|
|
149
168
|
if (change.kind === 'create') {
|
|
150
169
|
staged.documents[change.path] =
|
|
151
|
-
'content' in change
|
|
170
|
+
'content' in change
|
|
171
|
+
? change.content
|
|
172
|
+
: compose(change.path, change.fields, change.sections, composition);
|
|
152
173
|
delete staged.fileIds[change.path];
|
|
174
|
+
delete staged.created[change.path];
|
|
153
175
|
delete staged.changes[change.path];
|
|
154
176
|
return true;
|
|
155
177
|
}
|
|
@@ -194,15 +216,18 @@ function arrive(heads, change) {
|
|
|
194
216
|
heads.revisions[change.path] = change.revision;
|
|
195
217
|
if (change.fileId !== undefined)
|
|
196
218
|
heads.fileIds[change.path] = change.fileId;
|
|
219
|
+
if (change.created !== undefined)
|
|
220
|
+
heads.created[change.path] = change.created;
|
|
197
221
|
if (change.change !== undefined)
|
|
198
222
|
heads.changes[change.path] = change.change;
|
|
199
223
|
}
|
|
200
|
-
export function* overlaying(base, queue, unapplied) {
|
|
224
|
+
export function* overlaying(base, queue, composition, unapplied) {
|
|
201
225
|
const staged = {
|
|
202
226
|
documents: drafted(base.documents),
|
|
203
227
|
binaries: drafted(base.binaries),
|
|
204
228
|
revisions: drafted(base.revisions),
|
|
205
229
|
fileIds: drafted(base.fileIds),
|
|
230
|
+
created: drafted(base.created),
|
|
206
231
|
changes: drafted(base.changes),
|
|
207
232
|
};
|
|
208
233
|
for (const batch of queue) {
|
|
@@ -210,7 +235,7 @@ export function* overlaying(base, queue, unapplied) {
|
|
|
210
235
|
for (let index = 0; index < batch.changes.length; index += 1) {
|
|
211
236
|
const change = batch.changes[index];
|
|
212
237
|
if (!isPart(change)) {
|
|
213
|
-
if (!stage(staged, change))
|
|
238
|
+
if (!stage(staged, change, composition))
|
|
214
239
|
unapplied?.();
|
|
215
240
|
yield ROW_WEIGHT;
|
|
216
241
|
continue;
|
|
@@ -224,7 +249,7 @@ export function* overlaying(base, queue, unapplied) {
|
|
|
224
249
|
index += 1;
|
|
225
250
|
}
|
|
226
251
|
const text = staged.documents[change.path] ?? '';
|
|
227
|
-
for (let left = edit(staged, run, priors); left > 0; left -= 1)
|
|
252
|
+
for (let left = edit(staged, run, priors, composition); left > 0; left -= 1)
|
|
228
253
|
unapplied?.();
|
|
229
254
|
yield ROW_WEIGHT + text.length;
|
|
230
255
|
}
|
|
@@ -234,6 +259,7 @@ export function* overlaying(base, queue, unapplied) {
|
|
|
234
259
|
binaries: yield* settling(staged.binaries),
|
|
235
260
|
revisions: yield* settling(staged.revisions),
|
|
236
261
|
fileIds: yield* settling(staged.fileIds),
|
|
262
|
+
created: yield* settling(staged.created),
|
|
237
263
|
changes: yield* settling(staged.changes),
|
|
238
264
|
};
|
|
239
265
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const PAGE_METADATA_WORDS: {
|
|
2
|
+
readonly heading: 'Page metadata';
|
|
3
|
+
readonly app: 'App';
|
|
4
|
+
readonly address: 'Address';
|
|
5
|
+
readonly queries: 'Local Queries';
|
|
6
|
+
};
|
|
7
|
+
export declare function pageMetadataBlock(app: string, address: string, queries: readonly unknown[]): string;
|
|
8
|
+
//# sourceMappingURL=page-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-metadata.d.ts","sourceRoot":"","sources":["../src/page-metadata.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB;aAC9B,OAAO,EAAE,eAAe;aACxB,GAAG,EAAE,KAAK;aACV,OAAO,EAAE,SAAS;aAClB,OAAO,EAAE,eAAe;CAChB,CAAC;AAIX,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,SAAS,OAAO,EAAE,GAC1B,MAAM,CAUR"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { queryKey } from '@agentshouse/mdmodel';
|
|
2
|
+
export const PAGE_METADATA_WORDS = {
|
|
3
|
+
heading: 'Page metadata',
|
|
4
|
+
app: 'App',
|
|
5
|
+
address: 'Address',
|
|
6
|
+
queries: 'Local Queries',
|
|
7
|
+
};
|
|
8
|
+
const PAGE_METADATA_QUERIES = 10;
|
|
9
|
+
export function pageMetadataBlock(app, address, queries) {
|
|
10
|
+
const held = [...new Set(queries.map(queryKey))];
|
|
11
|
+
return [
|
|
12
|
+
PAGE_METADATA_WORDS.heading,
|
|
13
|
+
`${PAGE_METADATA_WORDS.app}: ${app}`,
|
|
14
|
+
`${PAGE_METADATA_WORDS.address}: ${address}`,
|
|
15
|
+
...(held.length === 0 || held.length > PAGE_METADATA_QUERIES
|
|
16
|
+
? []
|
|
17
|
+
: [`${PAGE_METADATA_WORDS.queries}:`, ...held]),
|
|
18
|
+
].join('\n');
|
|
19
|
+
}
|
package/dist/parts.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parts.d.ts","sourceRoot":"","sources":["../src/parts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAGhE,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,MAAM,GAAG,IAAI,CAGjE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,MAAM,GAAG,IAAI,CAKjE"}
|
package/dist/parts.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isOwn } from '@agentshouse/session-content';
|
|
2
|
+
import { excerpt } from './read.js';
|
|
3
|
+
export function currentStep(parts) {
|
|
4
|
+
const call = [...parts].reverse().find((part) => part.type === 'call');
|
|
5
|
+
return call?.type === 'call' && call.line !== '' ? call.line : null;
|
|
6
|
+
}
|
|
7
|
+
export function runningLine(parts) {
|
|
8
|
+
const own = parts.filter(isOwn);
|
|
9
|
+
const note = [...own].reverse().find((part) => part.type === 'text' && part.text.trim() !== '');
|
|
10
|
+
if (note?.type === 'text')
|
|
11
|
+
return excerpt(note.text);
|
|
12
|
+
return currentStep(own);
|
|
13
|
+
}
|
package/dist/paths.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare function normalize(path: string): string | null;
|
|
2
2
|
export declare function beneath(prefix: string, path: string): boolean;
|
|
3
3
|
export declare function covered(prefixes: readonly string[], path: string): boolean;
|
|
4
|
+
export declare function authoredAt(patterns: readonly string[], path: string): boolean;
|
|
5
|
+
export declare function ancestors(path: string): readonly string[];
|
|
4
6
|
//# sourceMappingURL=paths.d.ts.map
|
package/dist/paths.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYrD;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED,wBAAgB,OAAO,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAK1E;AAwBD,wBAAgB,UAAU,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7E;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAGzD"}
|
package/dist/paths.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isDocumentPath } from '@agentshouse/mdmodel';
|
|
1
2
|
export function normalize(path) {
|
|
2
3
|
const parts = [];
|
|
3
4
|
for (const part of path.split('/')) {
|
|
@@ -22,3 +23,28 @@ export function covered(prefixes, path) {
|
|
|
22
23
|
return normalized !== null && (normalized === '' || beneath(normalized, path));
|
|
23
24
|
});
|
|
24
25
|
}
|
|
26
|
+
function named(pattern, name) {
|
|
27
|
+
const star = pattern.indexOf('*');
|
|
28
|
+
if (star === -1)
|
|
29
|
+
return pattern === name;
|
|
30
|
+
const before = pattern.slice(0, star);
|
|
31
|
+
const after = pattern.slice(star + 1);
|
|
32
|
+
return (name.length > before.length + after.length && name.startsWith(before) && name.endsWith(after));
|
|
33
|
+
}
|
|
34
|
+
function matched(pattern, path) {
|
|
35
|
+
if (pattern === '/')
|
|
36
|
+
return isDocumentPath(path);
|
|
37
|
+
const wanted = pattern.split('/');
|
|
38
|
+
const names = path.split('/');
|
|
39
|
+
const open = wanted.at(-1) === '**';
|
|
40
|
+
const fixed = open ? wanted.slice(0, -1) : wanted;
|
|
41
|
+
return ((open ? names.length > fixed.length : names.length === fixed.length) &&
|
|
42
|
+
fixed.every((one, at) => named(one, names[at])));
|
|
43
|
+
}
|
|
44
|
+
export function authoredAt(patterns, path) {
|
|
45
|
+
return patterns.some((pattern) => matched(pattern, path));
|
|
46
|
+
}
|
|
47
|
+
export function ancestors(path) {
|
|
48
|
+
const parts = path.split('/');
|
|
49
|
+
return parts.slice(1).map((_, at) => parts.slice(0, at + 1).join('/'));
|
|
50
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PlanReach } from './query.js';
|
|
2
|
+
import { type PortReach } from './reach.js';
|
|
3
|
+
import { type CodeAvailability, type ConnectionAvailability, type Readiness } from './readiness.js';
|
|
4
|
+
import type { Runtime } from './runtime.js';
|
|
5
|
+
export type ReadinessPort = {
|
|
6
|
+
readonly target: string;
|
|
7
|
+
readonly code: CodeAvailability;
|
|
8
|
+
};
|
|
9
|
+
export type ReadinessWatch = {
|
|
10
|
+
readonly port: ReadinessPort;
|
|
11
|
+
readonly reach: PortReach | null;
|
|
12
|
+
readonly deliver: (readiness: Readiness) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare function prepare(runtime: Runtime, locators?: readonly string[]): void;
|
|
15
|
+
export declare function roomsOfReach(reach: PlanReach): ReadonlySet<string>;
|
|
16
|
+
export declare function connectionNow(runtime: Runtime): Promise<ConnectionAvailability>;
|
|
17
|
+
export declare function deliverOwedReadiness(runtime: Runtime, owed: readonly ReadinessWatch[]): Promise<void>;
|
|
18
|
+
export declare function watchReadiness({ store }: Runtime, port: ReadinessPort, reach: PortReach | null, deliver: (readiness: Readiness) => void): () => void;
|
|
19
|
+
export declare function filled(runtime: Runtime): void;
|
|
20
|
+
//# sourceMappingURL=preparation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preparation.d.ts","sourceRoot":"","sources":["../src/preparation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAE3B,KAAK,SAAS,EAEf,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAK5C,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;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