@agentshouse/mdruntime 0.1.0-alpha.8 → 0.1.0-c3903a68dcbbf

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.
Files changed (121) hide show
  1. package/AGENTS.md +210 -0
  2. package/README.md +44 -0
  3. package/dist/adapter.d.ts +223 -25
  4. package/dist/adapter.d.ts.map +1 -1
  5. package/dist/adapter.js +2 -3
  6. package/dist/attachment.d.ts +3 -0
  7. package/dist/attachment.d.ts.map +1 -0
  8. package/dist/attachment.js +8 -0
  9. package/dist/bootstrap.d.ts +6 -7
  10. package/dist/bootstrap.d.ts.map +1 -1
  11. package/dist/bootstrap.js +32 -28
  12. package/dist/change-set.d.ts +33 -0
  13. package/dist/change-set.d.ts.map +1 -0
  14. package/dist/change-set.js +87 -0
  15. package/dist/change.d.ts +9 -0
  16. package/dist/change.d.ts.map +1 -1
  17. package/dist/change.js +6 -5
  18. package/dist/client.d.ts +75 -0
  19. package/dist/client.d.ts.map +1 -0
  20. package/dist/client.js +171 -0
  21. package/dist/collection.d.ts +24 -15
  22. package/dist/collection.d.ts.map +1 -1
  23. package/dist/collection.js +69 -77
  24. package/dist/connection.d.ts +79 -36
  25. package/dist/connection.d.ts.map +1 -1
  26. package/dist/connection.js +1699 -953
  27. package/dist/conversation.d.ts +79 -0
  28. package/dist/conversation.d.ts.map +1 -0
  29. package/dist/conversation.js +557 -0
  30. package/dist/durability.d.ts +8 -3
  31. package/dist/durability.d.ts.map +1 -1
  32. package/dist/durability.js +7 -61
  33. package/dist/file.d.ts +20 -0
  34. package/dist/file.d.ts.map +1 -0
  35. package/dist/file.js +126 -0
  36. package/dist/host.d.ts +14 -0
  37. package/dist/host.d.ts.map +1 -0
  38. package/dist/host.js +198 -0
  39. package/dist/identity.d.ts +1 -0
  40. package/dist/identity.d.ts.map +1 -1
  41. package/dist/identity.js +10 -9
  42. package/dist/index.d.ts +14 -9
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +1 -2
  45. package/dist/log.js +5 -6
  46. package/dist/memory.d.ts +17 -2
  47. package/dist/memory.d.ts.map +1 -1
  48. package/dist/memory.js +269 -113
  49. package/dist/model.d.ts +10 -25
  50. package/dist/model.d.ts.map +1 -1
  51. package/dist/model.js +18 -21
  52. package/dist/observation.d.ts +25 -0
  53. package/dist/observation.d.ts.map +1 -0
  54. package/dist/observation.js +85 -0
  55. package/dist/outcome.d.ts +22 -18
  56. package/dist/outcome.d.ts.map +1 -1
  57. package/dist/outcome.js +1 -13
  58. package/dist/overlay.d.ts +9 -2
  59. package/dist/overlay.d.ts.map +1 -1
  60. package/dist/overlay.js +187 -43
  61. package/dist/paths.d.ts +0 -1
  62. package/dist/paths.d.ts.map +1 -1
  63. package/dist/paths.js +12 -19
  64. package/dist/query.d.ts +210 -9
  65. package/dist/query.d.ts.map +1 -1
  66. package/dist/query.js +420 -15
  67. package/dist/read-side.d.ts +14 -0
  68. package/dist/read-side.d.ts.map +1 -0
  69. package/dist/read-side.js +371 -0
  70. package/dist/refresh.d.ts +4 -5
  71. package/dist/refresh.d.ts.map +1 -1
  72. package/dist/refresh.js +45 -30
  73. package/dist/replica.d.ts +27 -6
  74. package/dist/replica.d.ts.map +1 -1
  75. package/dist/replica.js +237 -30
  76. package/dist/room-draft.d.ts +124 -0
  77. package/dist/room-draft.d.ts.map +1 -0
  78. package/dist/room-draft.js +327 -0
  79. package/dist/rows.d.ts +41 -0
  80. package/dist/rows.d.ts.map +1 -0
  81. package/dist/rows.js +100 -0
  82. package/dist/save.d.ts +10 -6
  83. package/dist/save.d.ts.map +1 -1
  84. package/dist/save.js +267 -333
  85. package/dist/search.d.ts +61 -0
  86. package/dist/search.d.ts.map +1 -0
  87. package/dist/search.js +125 -0
  88. package/dist/status.d.ts +9 -2
  89. package/dist/status.d.ts.map +1 -1
  90. package/dist/status.js +11 -14
  91. package/dist/store.d.ts +85 -18
  92. package/dist/store.d.ts.map +1 -1
  93. package/dist/store.js +380 -97
  94. package/dist/transfer.d.ts +5 -0
  95. package/dist/transfer.d.ts.map +1 -1
  96. package/dist/transfer.js +1 -5
  97. package/dist/wire.d.ts +64 -0
  98. package/dist/wire.d.ts.map +1 -0
  99. package/dist/wire.js +124 -0
  100. package/package.json +15 -13
  101. package/dist/adapter.js.map +0 -1
  102. package/dist/bootstrap.js.map +0 -1
  103. package/dist/change.js.map +0 -1
  104. package/dist/collection.js.map +0 -1
  105. package/dist/connection.js.map +0 -1
  106. package/dist/durability.js.map +0 -1
  107. package/dist/identity.js.map +0 -1
  108. package/dist/index.js.map +0 -1
  109. package/dist/log.js.map +0 -1
  110. package/dist/memory.js.map +0 -1
  111. package/dist/model.js.map +0 -1
  112. package/dist/outcome.js.map +0 -1
  113. package/dist/overlay.js.map +0 -1
  114. package/dist/paths.js.map +0 -1
  115. package/dist/query.js.map +0 -1
  116. package/dist/refresh.js.map +0 -1
  117. package/dist/replica.js.map +0 -1
  118. package/dist/save.js.map +0 -1
  119. package/dist/status.js.map +0 -1
  120. package/dist/store.js.map +0 -1
  121. package/dist/transfer.js.map +0 -1
package/dist/replica.js CHANGED
@@ -1,30 +1,70 @@
1
+ import { parse } from '@agentshouse/mdmodel';
1
2
  import { immutable } from './change.js';
2
- import { parseCollection, readCollection, validateCollection } from './collection.js';
3
- import { overlay } from './overlay.js';
4
- export function readConfirmed(record) {
5
- const collection = readCollection(record.documents, record.collectionRoot, record.model);
6
- return collection === null ? null : {
7
- record,
8
- collection
3
+ import { parseCollection, readCollection, validateCollection, } from './collection.js';
4
+ import { overlay, overlayChanged, sameLayerText } from './overlay.js';
5
+ import { providerRewritten } from './save.js';
6
+ import { equalValue } from './room-draft.js';
7
+ export function compositionOf(record) {
8
+ return {
9
+ model: record.model,
10
+ selection: record.typedSelection === null
11
+ ? null
12
+ : { roots: record.typedSelection.roots, model: record.selectionModel },
13
+ untypedFolders: record.untypedFolders,
9
14
  };
10
15
  }
11
- export function readStaged(record, binding) {
12
- if (record.model.status === 'current' && binding !== null && validateCollection(record.documents, record.binaryTargets, record.collectionRoot, record.model, binding).verdict === 'refuse') return null;
13
- return readConfirmed(record);
16
+ export function readConfirmed(record, previous) {
17
+ const read = readCollection(record.documents, compositionOf(record), previous === undefined
18
+ ? undefined
19
+ : { text: previous.record.documents, collection: previous.collection });
20
+ return read.kind === 'read'
21
+ ? { kind: 'staged', confirmed: { record, collection: read.collection } }
22
+ : read;
14
23
  }
15
- export function applyReturned(confirmed, documents, revisions, removals, roomVersion, binding) {
16
- const nextDocuments = {
17
- ...confirmed.record.documents,
18
- ...documents
19
- };
20
- const nextRevisions = {
21
- ...confirmed.record.revisions,
22
- ...revisions
24
+ export function sameMembership(record, other) {
25
+ return (JSON.stringify(record.untypedFolders) === JSON.stringify(other.untypedFolders) &&
26
+ JSON.stringify(record.typedSelection?.roots ?? null) ===
27
+ JSON.stringify(other.typedSelection?.roots ?? null));
28
+ }
29
+ export function readStaged(record, previous) {
30
+ if ((record.model.status === 'current' || record.selectionModel.status === 'current') &&
31
+ (previous === undefined ||
32
+ !sameLayerText(record, previous.record) ||
33
+ record.model !== previous.record.model ||
34
+ record.selectionModel !== previous.record.selectionModel)) {
35
+ const verdict = validateCollection(record.documents, record.binaryTargets, compositionOf(record));
36
+ if (verdict.verdict === 'refuse' && verdict.rule !== 'model-unavailable') {
37
+ return { kind: 'refused', refusal: verdict };
38
+ }
39
+ }
40
+ return readConfirmed(record, previous);
41
+ }
42
+ export function readReclassified(record, previous) {
43
+ const verdict = validateCollection(record.documents, record.binaryTargets, compositionOf(record));
44
+ if (verdict.verdict !== 'refuse')
45
+ return readConfirmed(record, previous);
46
+ return verdict.rule === 'model-unavailable'
47
+ ? { kind: 'deferred' }
48
+ : { kind: 'refused', refusal: verdict };
49
+ }
50
+ export function applyReturned(confirmed, documents, revisions, removals, roomVersion) {
51
+ const nextDocuments = { ...confirmed.record.documents, ...documents };
52
+ const nextRevisions = { ...confirmed.record.revisions, ...revisions };
53
+ const nextChanges = { ...confirmed.record.changes };
54
+ const nextWritten = {
55
+ ...confirmed.record.written,
56
+ ...Object.fromEntries(Object.keys(documents).map((path) => [path, roomVersion])),
23
57
  };
24
58
  const binaryTargets = new Set(confirmed.record.binaryTargets);
25
- for (const path of removals){
59
+ for (const [path, revision] of Object.entries(revisions)) {
60
+ if (confirmed.record.revisions[path] !== revision)
61
+ delete nextChanges[path];
62
+ }
63
+ for (const path of removals) {
26
64
  delete nextDocuments[path];
27
65
  delete nextRevisions[path];
66
+ delete nextChanges[path];
67
+ delete nextWritten[path];
28
68
  binaryTargets.delete(path);
29
69
  }
30
70
  return readStaged({
@@ -32,12 +72,55 @@ export function applyReturned(confirmed, documents, revisions, removals, roomVer
32
72
  roomVersion,
33
73
  documents: nextDocuments,
34
74
  revisions: nextRevisions,
35
- binaryTargets: [
36
- ...binaryTargets
37
- ].sort()
38
- }, binding);
75
+ changes: nextChanges,
76
+ written: nextWritten,
77
+ binaryTargets: [...binaryTargets].sort(),
78
+ }, confirmed);
79
+ }
80
+ function predicted(confirmed, batches, previous) {
81
+ const composition = compositionOf(confirmed.record);
82
+ let layer = confirmed.record;
83
+ const replay = [];
84
+ const prior = new Map(previous?.replay.map((step) => [step.id, step]) ?? []);
85
+ for (const batch of batches) {
86
+ const before = layer;
87
+ const old = prior.get(batch.id);
88
+ const hasMove = batch.changes.some((change) => change.kind === 'move');
89
+ const reuseRewrite = old?.collection !== undefined &&
90
+ sameLayerText(before, old.before) &&
91
+ JSON.stringify(old.collection.composition.untypedFolders) ===
92
+ JSON.stringify(composition.untypedFolders) &&
93
+ old.collection.composition.model === composition.model &&
94
+ old.collection.composition.selection?.model === composition.selection?.model &&
95
+ JSON.stringify(old.collection.composition.selection?.roots) ===
96
+ JSON.stringify(composition.selection?.roots);
97
+ const collection = hasMove
98
+ ? reuseRewrite
99
+ ? old.collection
100
+ : parseCollection(before.documents, composition, old?.collection === undefined
101
+ ? { text: confirmed.record.documents, collection: confirmed.collection }
102
+ : { text: old.before.documents, collection: old.collection })
103
+ : undefined;
104
+ const effective = collection === undefined
105
+ ? batch
106
+ : reuseRewrite
107
+ ? old.effective
108
+ : providerRewritten(batch, { ...before, collection });
109
+ layer =
110
+ old === undefined
111
+ ? overlay(before, [effective])
112
+ : overlayChanged(before, [effective], old.before, [old.effective], old.after);
113
+ replay.push({
114
+ id: batch.id,
115
+ before,
116
+ after: layer,
117
+ effective,
118
+ ...(collection === undefined ? {} : { collection }),
119
+ });
120
+ }
121
+ return { layer, replay };
39
122
  }
40
- export function replicaOf(confirmed, queue) {
123
+ export function replicaOf(confirmed, queue, rewriting, previous) {
41
124
  const batches = Object.freeze(queue.map(immutable));
42
125
  if (batches.length === 0) {
43
126
  return {
@@ -47,19 +130,143 @@ export function replicaOf(confirmed, queue) {
47
130
  documents: confirmed.record.documents,
48
131
  binaryTargets: confirmed.record.binaryTargets,
49
132
  revisions: confirmed.record.revisions,
50
- collection: confirmed.collection
51
- }
133
+ changes: confirmed.record.changes,
134
+ collection: confirmed.collection,
135
+ },
136
+ replay: [],
52
137
  };
53
138
  }
54
- const layer = overlay(confirmed.record, batches);
139
+ const predictedState = rewriting === 'provider' ? predicted(confirmed, batches, previous) : null;
140
+ const layer = rewriting === 'provider'
141
+ ? predictedState.layer
142
+ : previous === undefined
143
+ ? overlay(confirmed.record, batches)
144
+ : overlayChanged(confirmed.record, batches, previous.confirmed.record, previous.queue, previous.visible);
55
145
  return {
56
146
  confirmed,
57
147
  queue: batches,
148
+ replay: predictedState?.replay ?? [],
58
149
  visible: {
59
150
  ...layer,
60
- collection: parseCollection(layer.documents, confirmed.record.model)
151
+ collection: parseCollection(layer.documents, compositionOf(confirmed.record), previous === undefined
152
+ ? undefined
153
+ : { text: previous.visible.documents, collection: previous.visible.collection }),
154
+ },
155
+ };
156
+ }
157
+ function present(layer, path) {
158
+ return layer.documents[path] !== undefined || layer.binaryTargets.includes(path);
159
+ }
160
+ function holds(layer, preconditions) {
161
+ const parsed = new Map();
162
+ const documentAt = (path) => {
163
+ if (!parsed.has(path)) {
164
+ const text = layer.documents[path];
165
+ const opened = text === undefined ? null : parse(text, path);
166
+ parsed.set(path, opened?.ok === true ? opened.document : null);
61
167
  }
168
+ return parsed.get(path) ?? null;
62
169
  };
170
+ return preconditions.every((precondition) => {
171
+ const path = precondition.path;
172
+ if (precondition.kind === 'absent')
173
+ return !present(layer, path);
174
+ if (precondition.kind === 'present')
175
+ return present(layer, path);
176
+ if (precondition.kind === 'revision') {
177
+ return present(layer, path) && layer.revisions[path] === precondition.revision;
178
+ }
179
+ const document = documentAt(path);
180
+ if (document === null)
181
+ return false;
182
+ if (precondition.kind === 'field') {
183
+ const value = Object.hasOwn(document.fields, precondition.name)
184
+ ? document.fields[precondition.name]
185
+ : undefined;
186
+ return equalValue(value, precondition.value);
187
+ }
188
+ if (precondition.kind === 'section') {
189
+ return (Object.hasOwn(document.sections, precondition.name) &&
190
+ document.sections[precondition.name] === precondition.value);
191
+ }
192
+ return document.preamble === precondition.value;
193
+ });
194
+ }
195
+ function effects(change) {
196
+ const path = change.path;
197
+ if (change.kind === 'field' || change.kind === 'section' || change.kind === 'preamble') {
198
+ return [change];
199
+ }
200
+ if (change.kind === 'create' && !('content' in change)) {
201
+ return [
202
+ { kind: 'present', path },
203
+ ...Object.entries(change.fields).map(([name, value]) => ({
204
+ kind: 'field',
205
+ path,
206
+ name,
207
+ value,
208
+ })),
209
+ ...Object.entries(change.sections).map(([name, value]) => ({
210
+ kind: 'section',
211
+ path,
212
+ name,
213
+ value,
214
+ })),
215
+ ];
216
+ }
217
+ if (change.kind === 'move') {
218
+ return [
219
+ { kind: 'absent', path },
220
+ { kind: 'present', path: change.to },
221
+ ];
222
+ }
223
+ return [{ kind: 'absent', path }];
224
+ }
225
+ function after(changes, index, path) {
226
+ let at = path;
227
+ for (const change of changes.slice(index + 1)) {
228
+ if (change.path !== at)
229
+ continue;
230
+ if (change.kind === 'remove')
231
+ return null;
232
+ if (change.kind === 'move')
233
+ at = change.to;
234
+ }
235
+ return at;
236
+ }
237
+ export function landed(batch, confirmed) {
238
+ const layer = confirmed.record;
239
+ return batch.changes.every((change, index) => {
240
+ if (change.kind === 'replace' || (change.kind === 'create' && 'content' in change)) {
241
+ const at = after(batch.changes, index, change.path);
242
+ return at === null || layer.documents[at] === change.content;
243
+ }
244
+ return effects(change).every((effect) => {
245
+ if (effect.kind === 'absent')
246
+ return holds(layer, [effect]);
247
+ const at = after(batch.changes, index, effect.path);
248
+ return at === null || holds(layer, [{ ...effect, path: at }]);
249
+ });
250
+ });
251
+ }
252
+ export function withdrawals(confirmed, queue, withdrawable, rewriting) {
253
+ if (!queue.some(withdrawable))
254
+ return [];
255
+ const composition = compositionOf(confirmed.record);
256
+ let layer = confirmed.record;
257
+ const withdrawn = [];
258
+ for (const batch of queue) {
259
+ if (withdrawable(batch) && !holds(layer, batch.preconditions)) {
260
+ withdrawn.push(batch);
261
+ continue;
262
+ }
263
+ const effective = rewriting === 'provider' && batch.changes.some((change) => change.kind === 'move')
264
+ ? providerRewritten(batch, {
265
+ ...layer,
266
+ collection: parseCollection(layer.documents, composition),
267
+ })
268
+ : batch;
269
+ layer = overlay(layer, [effective]);
270
+ }
271
+ return withdrawn;
63
272
  }
64
-
65
- //# sourceMappingURL=replica.js.map
@@ -0,0 +1,124 @@
1
+ import type { ProviderRefusal } from './adapter.js';
2
+ import type { Change, Precondition } from './change.js';
3
+ import type { VisibleLayer } from './replica.js';
4
+ export type FieldValue = {
5
+ readonly value: unknown;
6
+ } | null;
7
+ export type RoomDraftCreation = {
8
+ readonly type: string;
9
+ readonly fields: Readonly<Record<string, unknown>>;
10
+ readonly sections: Readonly<Record<string, string>>;
11
+ } | {
12
+ readonly markdown: string;
13
+ };
14
+ export type RoomDraftParts = {
15
+ readonly fields?: Readonly<Record<string, {
16
+ readonly value: unknown;
17
+ readonly base?: FieldValue;
18
+ }>>;
19
+ readonly sections?: Readonly<Record<string, {
20
+ readonly value: string;
21
+ readonly base?: string;
22
+ }>>;
23
+ readonly preamble?: {
24
+ readonly value: string;
25
+ readonly base?: string;
26
+ };
27
+ readonly markdown?: {
28
+ readonly value: string;
29
+ readonly base?: string;
30
+ };
31
+ readonly creation?: RoomDraftCreation;
32
+ readonly move?: {
33
+ readonly to: string;
34
+ readonly base?: string | null;
35
+ };
36
+ readonly removal?: {
37
+ readonly base?: string | null;
38
+ };
39
+ };
40
+ type HeldParts = {
41
+ readonly fields?: Readonly<Record<string, {
42
+ readonly value: unknown;
43
+ readonly base: FieldValue;
44
+ }>>;
45
+ readonly sections?: Readonly<Record<string, {
46
+ readonly value: string;
47
+ readonly base: string;
48
+ }>>;
49
+ readonly preamble?: {
50
+ readonly value: string;
51
+ readonly base: string;
52
+ };
53
+ readonly markdown?: {
54
+ readonly value: string;
55
+ readonly base: string;
56
+ };
57
+ readonly creation?: RoomDraftCreation;
58
+ readonly move?: {
59
+ readonly to: string;
60
+ readonly base: string | null;
61
+ };
62
+ readonly removal?: {
63
+ readonly base: string | null;
64
+ };
65
+ };
66
+ type ChangedUnderneath = {
67
+ readonly fields?: Readonly<Record<string, FieldValue>>;
68
+ readonly sections?: Readonly<Record<string, string | null>>;
69
+ readonly preamble?: string | null;
70
+ readonly markdown?: string | null;
71
+ readonly creation?: string;
72
+ readonly move?: string | null;
73
+ readonly removal?: string | null;
74
+ };
75
+ export type ReturnReason = (ProviderRefusal & {
76
+ readonly kind: 'conflicted' | 'rejected';
77
+ }) | {
78
+ readonly kind: 'expired';
79
+ } | {
80
+ readonly kind: 'withdrawn';
81
+ };
82
+ export type RoomDraft = {
83
+ readonly room: string;
84
+ readonly path: string;
85
+ readonly revision: string;
86
+ readonly parts: HeldParts;
87
+ readonly changedUnderneath: ChangedUnderneath;
88
+ readonly returned: ReturnReason | null;
89
+ };
90
+ export type RoomDraftWrite = {
91
+ readonly outcome: 'written';
92
+ readonly roomDraft: RoomDraft | null;
93
+ } | {
94
+ readonly outcome: 'stale';
95
+ readonly current: RoomDraft | null;
96
+ };
97
+ export type ChangedPart = {
98
+ readonly path: string;
99
+ readonly part: 'field' | 'section' | 'preamble' | 'markdown' | 'creation' | 'move' | 'removal';
100
+ readonly name?: string;
101
+ };
102
+ export type RoomDraftRecord = {
103
+ readonly locator: string;
104
+ readonly path: string;
105
+ readonly revision: string;
106
+ readonly parts: HeldParts;
107
+ readonly returned: ReturnReason | null;
108
+ };
109
+ export type SavedDraft = {
110
+ readonly path: string;
111
+ readonly parts: HeldParts;
112
+ };
113
+ export declare function readParts(value: unknown): RoomDraftParts;
114
+ export declare function held(current: HeldParts | undefined, parts: RoomDraftParts): HeldParts;
115
+ export declare function equalValue(left: unknown, right: unknown): boolean;
116
+ export declare function underneath(parts: HeldParts, path: string, visible: VisibleLayer | undefined): ChangedUnderneath;
117
+ export declare function changedParts(path: string, report: ChangedUnderneath): readonly ChangedPart[];
118
+ export declare function returnedInto(existing: HeldParts | undefined, returned: HeldParts): HeldParts;
119
+ export declare function changesOf(path: string, parts: HeldParts): {
120
+ changes: readonly Change[];
121
+ bases: readonly Precondition[];
122
+ };
123
+ export {};
124
+ //# sourceMappingURL=room-draft.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room-draft.d.ts","sourceRoot":"","sources":["../src/room-draft.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAAC;AAE5D,MAAM,MAAM,iBAAiB,GACzB;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAA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