@peac/capture-core 0.10.8 → 0.10.10

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/dist/mapper.js DELETED
@@ -1,212 +0,0 @@
1
- "use strict";
2
- /**
3
- * @peac/capture-core - Evidence Mapper
4
- *
5
- * Transforms SpoolEntry into InteractionEvidenceV01.
6
- * This is a pure transformation with no side effects.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.toInteractionEvidence = toInteractionEvidence;
10
- exports.toInteractionEvidenceBatch = toInteractionEvidenceBatch;
11
- // =============================================================================
12
- // Pure Transformation Functions
13
- // =============================================================================
14
- /**
15
- * Build executor from action.
16
- */
17
- function buildExecutor(action) {
18
- const executor = {
19
- platform: action.platform,
20
- };
21
- if (action.platform_version) {
22
- executor.version = action.platform_version;
23
- }
24
- if (action.plugin_id) {
25
- executor.plugin_id = action.plugin_id;
26
- }
27
- return executor;
28
- }
29
- /**
30
- * Build tool target from action (if applicable).
31
- */
32
- function buildToolTarget(action) {
33
- if (!action.tool_name) {
34
- return undefined;
35
- }
36
- const tool = {
37
- name: action.tool_name,
38
- };
39
- if (action.tool_provider) {
40
- tool.provider = action.tool_provider;
41
- }
42
- return tool;
43
- }
44
- /**
45
- * Build resource target from action (if applicable).
46
- */
47
- function buildResourceTarget(action) {
48
- if (!action.resource_uri && !action.resource_method) {
49
- return undefined;
50
- }
51
- const resource = {};
52
- if (action.resource_uri) {
53
- resource.uri = action.resource_uri;
54
- }
55
- if (action.resource_method) {
56
- resource.method = action.resource_method;
57
- }
58
- return resource;
59
- }
60
- /**
61
- * Build payload reference from digest.
62
- */
63
- function buildPayloadRef(digest, redaction) {
64
- if (!digest) {
65
- return undefined;
66
- }
67
- return {
68
- digest,
69
- redaction,
70
- };
71
- }
72
- /**
73
- * Build result from action.
74
- */
75
- function buildResult(action) {
76
- if (!action.status) {
77
- return undefined;
78
- }
79
- const result = {
80
- status: action.status,
81
- };
82
- if (action.error_code) {
83
- result.error_code = action.error_code;
84
- }
85
- if (action.retryable !== undefined) {
86
- result.retryable = action.retryable;
87
- }
88
- return result;
89
- }
90
- /**
91
- * Build policy context from action.
92
- */
93
- function buildPolicyContext(action) {
94
- if (!action.policy) {
95
- return undefined;
96
- }
97
- const policy = {
98
- decision: action.policy.decision,
99
- };
100
- if (action.policy.sandbox_enabled !== undefined) {
101
- policy.sandbox_enabled = action.policy.sandbox_enabled;
102
- }
103
- if (action.policy.elevated !== undefined) {
104
- policy.elevated = action.policy.elevated;
105
- }
106
- // Note: effective_policy_digest would require converting the string to Digest
107
- // This is left for the adapter to handle if needed
108
- return policy;
109
- }
110
- // =============================================================================
111
- // Main Mapper
112
- // =============================================================================
113
- /**
114
- * Convert a SpoolEntry to InteractionEvidenceV01.
115
- *
116
- * This is a pure, deterministic transformation.
117
- * The same SpoolEntry will always produce the same InteractionEvidence.
118
- */
119
- function toInteractionEvidence(entry, options = {}) {
120
- const { defaultRedaction = 'hash_only', includeSpoolAnchor = false } = options;
121
- const { action } = entry;
122
- // Build the evidence object
123
- const evidence = {
124
- interaction_id: action.id,
125
- kind: action.kind,
126
- executor: buildExecutor(action),
127
- started_at: action.started_at,
128
- };
129
- // Optional tool target
130
- const tool = buildToolTarget(action);
131
- if (tool) {
132
- evidence.tool = tool;
133
- }
134
- // Optional resource target
135
- const resource = buildResourceTarget(action);
136
- if (resource) {
137
- evidence.resource = resource;
138
- }
139
- // Optional input payload reference
140
- const input = buildPayloadRef(entry.input_digest, defaultRedaction);
141
- if (input) {
142
- evidence.input = input;
143
- }
144
- // Optional output payload reference
145
- const output = buildPayloadRef(entry.output_digest, defaultRedaction);
146
- if (output) {
147
- evidence.output = output;
148
- }
149
- // Optional completed_at
150
- if (action.completed_at) {
151
- evidence.completed_at = action.completed_at;
152
- }
153
- // Optional duration
154
- if (action.duration_ms !== undefined) {
155
- evidence.duration_ms = action.duration_ms;
156
- }
157
- // Optional result
158
- const result = buildResult(action);
159
- if (result) {
160
- evidence.result = result;
161
- }
162
- // Optional policy context
163
- const policy = buildPolicyContext(action);
164
- if (policy) {
165
- evidence.policy = policy;
166
- }
167
- // Build extensions
168
- const extensions = {};
169
- // Add platform-specific metadata if present
170
- if (action.metadata && Object.keys(action.metadata).length > 0) {
171
- // Check if metadata keys are already properly namespaced
172
- // Namespaced keys (e.g., org.openclaw/context) go directly into extensions
173
- // Non-namespaced keys go under the generic capture-metadata key
174
- const EXTENSION_KEY_PATTERN = /^[a-z0-9-]+\.[a-z0-9-]+\//;
175
- const genericMetadata = {};
176
- for (const [key, value] of Object.entries(action.metadata)) {
177
- if (EXTENSION_KEY_PATTERN.test(key)) {
178
- // Already namespaced - add directly to extensions
179
- extensions[key] = value;
180
- }
181
- else {
182
- // Not namespaced - collect for generic key
183
- genericMetadata[key] = value;
184
- }
185
- }
186
- // Add non-namespaced metadata under generic key
187
- if (Object.keys(genericMetadata).length > 0) {
188
- extensions['org.peacprotocol/capture-metadata@0.1'] = genericMetadata;
189
- }
190
- }
191
- // Add spool anchor if requested
192
- if (includeSpoolAnchor) {
193
- const anchor = {
194
- spool_head_digest: entry.entry_digest,
195
- sequence: entry.sequence,
196
- anchored_at: entry.captured_at,
197
- };
198
- extensions['org.peacprotocol/spool-anchor@0.1'] = anchor;
199
- }
200
- // Only add extensions if non-empty
201
- if (Object.keys(extensions).length > 0) {
202
- evidence.extensions = extensions;
203
- }
204
- return evidence;
205
- }
206
- /**
207
- * Batch convert SpoolEntries to InteractionEvidence array.
208
- */
209
- function toInteractionEvidenceBatch(entries, options = {}) {
210
- return entries.map((entry) => toInteractionEvidence(entry, options));
211
- }
212
- //# sourceMappingURL=mapper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapper.js","sourceRoot":"","sources":["../src/mapper.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAoLH,sDAyGC;AAKD,gEAKC;AA9PD,gFAAgF;AAChF,gCAAgC;AAChC,gFAAgF;AAEhF;;GAEG;AACH,SAAS,aAA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AAgC;IAChC,IAAI,kBAAkB,EAAE,CAAC;QACvB,MAAM,MAAM,GAAgB;YAC1B,iBAAiB,EAAE,KAAK,CAAC,YAAY;YACrC,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,WAAW,EAAE,KAAK,CAAC,WAAW;SAC/B,CAAC;QACF,UAAU,CAAC,mCAAmC,CAAC,GAAG,MAAM,CAAC;IAC3D,CAAC;IAED,mCAAmC;IACnC,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvC,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAC;IACnC,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAgB,0BAA0B,CACxC,OAAqB,EACrB,UAAyB,EAAE;IAE3B,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,qBAAqB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AACvE,CAAC"}
package/dist/memory.js DELETED
@@ -1,196 +0,0 @@
1
- "use strict";
2
- /**
3
- * @peac/capture-core - In-Memory Implementations
4
- *
5
- * Reference implementations for testing and development.
6
- * NOT for production use - use @peac/capture-node for durable storage.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.InMemoryDedupeIndex = exports.InMemorySpoolStore = void 0;
10
- exports.createInMemorySpoolStore = createInMemorySpoolStore;
11
- exports.createInMemoryDedupeIndex = createInMemoryDedupeIndex;
12
- const types_1 = require("./types");
13
- // =============================================================================
14
- // In-Memory Spool Store
15
- // =============================================================================
16
- /**
17
- * In-memory spool store for testing.
18
- *
19
- * Features:
20
- * - Entries stored in array (ordered by sequence)
21
- * - commit() is a no-op (no durability)
22
- * - Useful for unit tests and development
23
- */
24
- class InMemorySpoolStore {
25
- entries = [];
26
- headDigest = types_1.GENESIS_DIGEST;
27
- currentSequence = 0;
28
- closed = false;
29
- /**
30
- * Append an entry to the spool.
31
- */
32
- async append(entry) {
33
- this.assertNotClosed();
34
- // Validate sequence
35
- if (entry.sequence !== this.currentSequence + 1) {
36
- throw new Error(`Invalid sequence: expected ${this.currentSequence + 1}, got ${entry.sequence}`);
37
- }
38
- // Validate chain
39
- if (entry.prev_entry_digest !== this.headDigest) {
40
- throw new Error(`Invalid chain: expected prev_entry_digest ${this.headDigest}, got ${entry.prev_entry_digest}`);
41
- }
42
- this.entries.push(entry);
43
- this.headDigest = entry.entry_digest;
44
- this.currentSequence = entry.sequence;
45
- return entry.sequence;
46
- }
47
- /**
48
- * Commit is a no-op for in-memory store.
49
- */
50
- async commit() {
51
- this.assertNotClosed();
52
- // No-op for in-memory
53
- }
54
- /**
55
- * Read entries starting from a sequence number.
56
- */
57
- async read(fromSequence, limit) {
58
- this.assertNotClosed();
59
- const startIndex = fromSequence > 0 ? fromSequence - 1 : 0;
60
- const entries = this.entries.slice(startIndex);
61
- if (limit !== undefined && limit > 0) {
62
- return entries.slice(0, limit);
63
- }
64
- return entries;
65
- }
66
- /**
67
- * Get the current head digest.
68
- */
69
- async getHeadDigest() {
70
- this.assertNotClosed();
71
- return this.headDigest;
72
- }
73
- /**
74
- * Get the current sequence number.
75
- */
76
- async getSequence() {
77
- this.assertNotClosed();
78
- return this.currentSequence;
79
- }
80
- /**
81
- * Close the store.
82
- */
83
- async close() {
84
- this.closed = true;
85
- }
86
- /**
87
- * Check if store is closed.
88
- */
89
- assertNotClosed() {
90
- if (this.closed) {
91
- throw new Error('SpoolStore is closed');
92
- }
93
- }
94
- // Test helpers (not part of interface)
95
- /**
96
- * Get all entries (for testing).
97
- */
98
- getAllEntries() {
99
- return [...this.entries];
100
- }
101
- /**
102
- * Clear all entries (for testing).
103
- */
104
- clear() {
105
- this.entries = [];
106
- this.headDigest = types_1.GENESIS_DIGEST;
107
- this.currentSequence = 0;
108
- }
109
- }
110
- exports.InMemorySpoolStore = InMemorySpoolStore;
111
- // =============================================================================
112
- // In-Memory Dedupe Index
113
- // =============================================================================
114
- /**
115
- * In-memory dedupe index for testing.
116
- *
117
- * Features:
118
- * - Entries stored in Map
119
- * - No persistence
120
- * - Returns resolved Promises (async interface, sync implementation)
121
- * - Useful for unit tests and development
122
- */
123
- class InMemoryDedupeIndex {
124
- entries = new Map();
125
- /**
126
- * Get entry by action ID.
127
- */
128
- async get(actionId) {
129
- return this.entries.get(actionId);
130
- }
131
- /**
132
- * Set entry for action ID.
133
- */
134
- async set(actionId, entry) {
135
- this.entries.set(actionId, entry);
136
- }
137
- /**
138
- * Check if action ID exists.
139
- */
140
- async has(actionId) {
141
- return this.entries.has(actionId);
142
- }
143
- /**
144
- * Mark an entry as emitted.
145
- */
146
- async markEmitted(actionId) {
147
- const entry = this.entries.get(actionId);
148
- if (!entry) {
149
- return false;
150
- }
151
- entry.emitted = true;
152
- return true;
153
- }
154
- /**
155
- * Delete entry.
156
- */
157
- async delete(actionId) {
158
- return this.entries.delete(actionId);
159
- }
160
- /**
161
- * Get count of entries.
162
- */
163
- async size() {
164
- return this.entries.size;
165
- }
166
- /**
167
- * Clear all entries.
168
- */
169
- async clear() {
170
- this.entries.clear();
171
- }
172
- // Test helpers (not part of interface)
173
- /**
174
- * Get all entries as array (for testing).
175
- */
176
- getAllEntries() {
177
- return [...this.entries.entries()];
178
- }
179
- }
180
- exports.InMemoryDedupeIndex = InMemoryDedupeIndex;
181
- // =============================================================================
182
- // Factory Functions
183
- // =============================================================================
184
- /**
185
- * Create an in-memory spool store.
186
- */
187
- function createInMemorySpoolStore() {
188
- return new InMemorySpoolStore();
189
- }
190
- /**
191
- * Create an in-memory dedupe index.
192
- */
193
- function createInMemoryDedupeIndex() {
194
- return new InMemoryDedupeIndex();
195
- }
196
- //# sourceMappingURL=memory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memory.js","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAoNH,4DAEC;AAKD,8DAEC;AA1ND,mCAAyC;AAEzC,gFAA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ACnC,CAAC"}
package/dist/session.js DELETED
@@ -1,244 +0,0 @@
1
- "use strict";
2
- /**
3
- * @peac/capture-core - Capture Session
4
- *
5
- * Stateful capture pipeline that orchestrates hashing, deduplication,
6
- * and spool storage.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.DefaultCaptureSession = void 0;
10
- exports.createCaptureSession = createCaptureSession;
11
- // =============================================================================
12
- // Capture Session Implementation
13
- // =============================================================================
14
- /**
15
- * Default capture session implementation.
16
- *
17
- * Orchestrates:
18
- * 1. Deduplication check
19
- * 2. Payload hashing (input/output)
20
- * 3. Entry creation with chain linking
21
- * 4. Spool storage
22
- * 5. Dedupe index update
23
- */
24
- class DefaultCaptureSession {
25
- store;
26
- dedupe;
27
- hasher;
28
- closed = false;
29
- // Concurrency serialization: queue captures to prevent race conditions
30
- // on sequence numbers and chain linkage
31
- captureQueue = Promise.resolve();
32
- constructor(config) {
33
- this.store = config.store;
34
- this.dedupe = config.dedupe;
35
- this.hasher = config.hasher;
36
- }
37
- /**
38
- * Capture an action.
39
- *
40
- * Process:
41
- * 1. Validate action
42
- * 2. Serialize via queue (prevents race conditions)
43
- * 3. Check for duplicate (by action.id)
44
- * 4. Hash input/output payloads
45
- * 5. Create spool entry with chain link
46
- * 6. Append to spool
47
- * 7. Update dedupe index
48
- *
49
- * Concurrency: Capture calls are serialized to prevent race conditions
50
- * on sequence numbers and chain linkage.
51
- *
52
- * GUARANTEE: This method NEVER throws. All failures are returned as
53
- * CaptureResult with success=false. This ensures the capture queue
54
- * remains healthy and subsequent captures can proceed.
55
- */
56
- async capture(action) {
57
- try {
58
- // Check session state (convert throw to result)
59
- if (this.closed) {
60
- return {
61
- success: false,
62
- code: 'E_CAPTURE_SESSION_CLOSED',
63
- message: 'CaptureSession is closed',
64
- };
65
- }
66
- // 1. Validate action (can run before serialization)
67
- const validationError = this.validateAction(action);
68
- if (validationError) {
69
- return {
70
- success: false,
71
- code: 'E_CAPTURE_INVALID_ACTION',
72
- message: validationError,
73
- };
74
- }
75
- // 2. Serialize capture operations to prevent race conditions
76
- let result;
77
- const capturePromise = this.captureQueue.then(async () => {
78
- result = await this.captureInternal(action);
79
- });
80
- // Keep queue alive regardless of outcome
81
- this.captureQueue = capturePromise.catch(() => {
82
- // Swallow errors to keep queue alive for subsequent captures
83
- });
84
- // Await result, but catch any unexpected throws
85
- await capturePromise;
86
- return result;
87
- }
88
- catch (error) {
89
- // Last-resort catch: convert ANY unexpected throw to CaptureResult
90
- // This should never happen if captureInternal is correct, but provides safety
91
- const message = error instanceof Error ? error.message : String(error);
92
- return {
93
- success: false,
94
- code: 'E_CAPTURE_INTERNAL',
95
- message: `Internal capture error: ${message}`,
96
- };
97
- }
98
- }
99
- /**
100
- * Internal capture logic (runs serialized).
101
- *
102
- * IMPORTANT: This method must NEVER throw - it always returns CaptureResult.
103
- * This is critical for queue safety: if this throws, the queue chain would
104
- * propagate the rejection to the caller while the queue itself stays healthy.
105
- */
106
- async captureInternal(action) {
107
- try {
108
- // 3. Check for duplicate (inside try/catch for queue safety)
109
- if (await this.dedupe.has(action.id)) {
110
- return {
111
- success: false,
112
- code: 'E_CAPTURE_DUPLICATE',
113
- message: `Action ${action.id} already captured`,
114
- };
115
- }
116
- // 4. Hash payloads
117
- const inputDigest = action.input_bytes
118
- ? await this.hasher.digest(action.input_bytes)
119
- : undefined;
120
- const outputDigest = action.output_bytes
121
- ? await this.hasher.digest(action.output_bytes)
122
- : undefined;
123
- // 5. Get current chain state
124
- const prevDigest = await this.store.getHeadDigest();
125
- const sequence = (await this.store.getSequence()) + 1;
126
- // 6. Build entry (without entry_digest)
127
- // DETERMINISM: Derive captured_at from action timestamps, not wall clock.
128
- // This ensures the same action stream produces identical chain digests.
129
- const capturedAt = action.completed_at ?? action.started_at;
130
- const partialEntry = {
131
- captured_at: capturedAt,
132
- action: this.stripPayloadBytes(action),
133
- input_digest: inputDigest,
134
- output_digest: outputDigest,
135
- prev_entry_digest: prevDigest,
136
- sequence,
137
- };
138
- // 7. Compute entry digest
139
- const entryDigest = await this.hasher.digestEntry(partialEntry);
140
- // 8. Complete entry
141
- const entry = {
142
- ...partialEntry,
143
- entry_digest: entryDigest,
144
- };
145
- // 9. Append to spool
146
- await this.store.append(entry);
147
- // 10. Update dedupe index
148
- await this.dedupe.set(action.id, {
149
- sequence,
150
- entry_digest: entryDigest,
151
- captured_at: capturedAt,
152
- emitted: false,
153
- });
154
- return { success: true, entry };
155
- }
156
- catch (error) {
157
- // Determine error type
158
- const message = error instanceof Error ? error.message : String(error);
159
- if (message.includes('hash') || message.includes('digest')) {
160
- return {
161
- success: false,
162
- code: 'E_CAPTURE_HASH_FAILED',
163
- message: `Hash failed: ${message}`,
164
- };
165
- }
166
- return {
167
- success: false,
168
- code: 'E_CAPTURE_STORE_FAILED',
169
- message: `Store failed: ${message}`,
170
- };
171
- }
172
- }
173
- /**
174
- * Commit pending writes to durable storage.
175
- */
176
- async commit() {
177
- this.assertNotClosed();
178
- await this.store.commit();
179
- }
180
- /**
181
- * Get the current spool head digest.
182
- */
183
- async getHeadDigest() {
184
- this.assertNotClosed();
185
- return this.store.getHeadDigest();
186
- }
187
- /**
188
- * Close the session and release resources.
189
- */
190
- async close() {
191
- if (!this.closed) {
192
- await this.store.close();
193
- this.closed = true;
194
- }
195
- }
196
- // =============================================================================
197
- // Private Helpers
198
- // =============================================================================
199
- /**
200
- * Validate action has required fields.
201
- */
202
- validateAction(action) {
203
- if (!action.id || action.id.trim() === '') {
204
- return 'Missing action.id';
205
- }
206
- if (!action.kind || action.kind.trim() === '') {
207
- return 'Missing action.kind';
208
- }
209
- if (!action.platform || action.platform.trim() === '') {
210
- return 'Missing action.platform';
211
- }
212
- if (!action.started_at || action.started_at.trim() === '') {
213
- return 'Missing action.started_at';
214
- }
215
- return null;
216
- }
217
- /**
218
- * Strip payload bytes from action for storage.
219
- */
220
- stripPayloadBytes(action) {
221
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
222
- const { input_bytes, output_bytes, ...rest } = action;
223
- return rest;
224
- }
225
- /**
226
- * Assert session is not closed.
227
- */
228
- assertNotClosed() {
229
- if (this.closed) {
230
- throw new Error('CaptureSession is closed');
231
- }
232
- }
233
- }
234
- exports.DefaultCaptureSession = DefaultCaptureSession;
235
- // =============================================================================
236
- // Factory Function
237
- // =============================================================================
238
- /**
239
- * Create a capture session.
240
- */
241
- function createCaptureSession(config) {
242
- return new DefaultCaptureSession(config);
243
- }
244
- //# sourceMappingURL=session.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAmRH,oDAEC;AAxQD,gFAAgF;AAChF,iCAAiC;AACjC,gFAAgF;AAEhF;;;;;;;;;GASG;AACH,MAAa,qBAAqB;IACf,KAAK,CAAa;IAClB,MAAM,CAAc;IACpB,MAAM,CAAS;IACxB,MAAM,GAAY,KAAK,CAAC;IAEhC,uEAAuE;IACvE,wCAAwC;IAChC,YAAY,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IAExD,YAAY,MAA4B;QACtC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9B,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,OAAO,CAAC,MAAsB;QAClC,IAAI,CAAC;YACH,gDAAgD;YAChD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,IAAI,EAAE,0BAA0B;oBAChC,OAAO,EAAE,0BAA0B;iBACpC,CAAC;YACJ,CAAC;YAED,oDAAoD;YACpD,MAAM,eAAe,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACpD,IAAI,eAAe,EAAE,CAAC;gBACpB,OAA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