@proposit/proposit-core 0.9.1 → 0.11.0
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 +147 -35
- package/dist/cli/commands/arguments.d.ts.map +1 -1
- package/dist/cli/commands/arguments.js +8 -16
- package/dist/cli/commands/arguments.js.map +1 -1
- package/dist/cli/commands/citations.d.ts +3 -0
- package/dist/cli/commands/citations.d.ts.map +1 -0
- package/dist/cli/commands/citations.js +89 -0
- package/dist/cli/commands/citations.js.map +1 -0
- package/dist/cli/commands/claims.d.ts.map +1 -1
- package/dist/cli/commands/claims.js +10 -2
- package/dist/cli/commands/claims.js.map +1 -1
- package/dist/cli/commands/parse.d.ts.map +1 -1
- package/dist/cli/commands/parse.js +9 -17
- package/dist/cli/commands/parse.js.map +1 -1
- package/dist/cli/commands/premises.d.ts.map +1 -1
- package/dist/cli/commands/premises.js +82 -5
- package/dist/cli/commands/premises.js.map +1 -1
- package/dist/cli/commands/render.d.ts.map +1 -1
- package/dist/cli/commands/render.js +46 -19
- package/dist/cli/commands/render.js.map +1 -1
- package/dist/cli/commands/variables.d.ts.map +1 -1
- package/dist/cli/commands/variables.js +1 -0
- package/dist/cli/commands/variables.js.map +1 -1
- package/dist/cli/engine.d.ts.map +1 -1
- package/dist/cli/engine.js +15 -9
- package/dist/cli/engine.js.map +1 -1
- package/dist/cli/import.d.ts +2 -4
- package/dist/cli/import.d.ts.map +1 -1
- package/dist/cli/import.js +78 -20
- package/dist/cli/import.js.map +1 -1
- package/dist/cli/router.js +1 -1
- package/dist/cli/router.js.map +1 -1
- package/dist/cli/storage/libraries.d.ts +4 -7
- package/dist/cli/storage/libraries.d.ts.map +1 -1
- package/dist/cli/storage/libraries.js +9 -28
- package/dist/cli/storage/libraries.js.map +1 -1
- package/dist/cli/storage/migrate-v0.10.d.ts +10 -0
- package/dist/cli/storage/migrate-v0.10.d.ts.map +1 -0
- package/dist/cli/storage/migrate-v0.10.js +213 -0
- package/dist/cli/storage/migrate-v0.10.js.map +1 -0
- package/dist/cli/storage/migrate-v0.11.d.ts +15 -0
- package/dist/cli/storage/migrate-v0.11.d.ts.map +1 -0
- package/dist/cli/storage/migrate-v0.11.js +125 -0
- package/dist/cli/storage/migrate-v0.11.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/extensions/basics/argument-parser.d.ts +1 -2
- package/dist/extensions/basics/argument-parser.d.ts.map +1 -1
- package/dist/extensions/basics/argument-parser.js.map +1 -1
- package/dist/extensions/basics/schemata.d.ts +12 -1
- package/dist/extensions/basics/schemata.d.ts.map +1 -1
- package/dist/extensions/ieee/{source.d.ts → citation-claim.d.ts} +5 -3
- package/dist/extensions/ieee/citation-claim.d.ts.map +1 -0
- package/dist/extensions/ieee/{source.js → citation-claim.js} +5 -4
- package/dist/extensions/ieee/citation-claim.js.map +1 -0
- package/dist/extensions/ieee/index.d.ts +1 -1
- package/dist/extensions/ieee/index.d.ts.map +1 -1
- package/dist/extensions/ieee/index.js +1 -1
- package/dist/extensions/ieee/index.js.map +1 -1
- package/dist/lib/consts.d.ts.map +1 -1
- package/dist/lib/consts.js +15 -14
- package/dist/lib/consts.js.map +1 -1
- package/dist/lib/core/argument-engine.d.ts +47 -9
- package/dist/lib/core/argument-engine.d.ts.map +1 -1
- package/dist/lib/core/argument-engine.js +209 -20
- package/dist/lib/core/argument-engine.js.map +1 -1
- package/dist/lib/core/argument-library.d.ts +13 -15
- package/dist/lib/core/argument-library.d.ts.map +1 -1
- package/dist/lib/core/argument-library.js +23 -9
- package/dist/lib/core/argument-library.js.map +1 -1
- package/dist/lib/core/claim-citation-library.d.ts +44 -0
- package/dist/lib/core/claim-citation-library.d.ts.map +1 -0
- package/dist/lib/core/claim-citation-library.js +336 -0
- package/dist/lib/core/claim-citation-library.js.map +1 -0
- package/dist/lib/core/claim-library.d.ts +33 -1
- package/dist/lib/core/claim-library.d.ts.map +1 -1
- package/dist/lib/core/claim-library.js +71 -3
- package/dist/lib/core/claim-library.js.map +1 -1
- package/dist/lib/core/fork-library.d.ts +19 -10
- package/dist/lib/core/fork-library.d.ts.map +1 -1
- package/dist/lib/core/fork-library.js +16 -13
- package/dist/lib/core/fork-library.js.map +1 -1
- package/dist/lib/core/fork.d.ts +6 -7
- package/dist/lib/core/fork.d.ts.map +1 -1
- package/dist/lib/core/fork.js +8 -3
- package/dist/lib/core/fork.js.map +1 -1
- package/dist/lib/core/interfaces/argument-engine.interfaces.d.ts +132 -7
- package/dist/lib/core/interfaces/argument-engine.interfaces.d.ts.map +1 -1
- package/dist/lib/core/interfaces/index.d.ts +1 -1
- package/dist/lib/core/interfaces/index.d.ts.map +1 -1
- package/dist/lib/core/interfaces/library.interfaces.d.ts +76 -157
- package/dist/lib/core/interfaces/library.interfaces.d.ts.map +1 -1
- package/dist/lib/core/managed-derivation-premise-engine.d.ts +155 -0
- package/dist/lib/core/managed-derivation-premise-engine.d.ts.map +1 -0
- package/dist/lib/core/managed-derivation-premise-engine.js +517 -0
- package/dist/lib/core/managed-derivation-premise-engine.js.map +1 -0
- package/dist/lib/core/premise-engine.d.ts +6 -5
- package/dist/lib/core/premise-engine.d.ts.map +1 -1
- package/dist/lib/core/premise-engine.js +5 -3
- package/dist/lib/core/premise-engine.js.map +1 -1
- package/dist/lib/core/proposit-core.d.ts +30 -32
- package/dist/lib/core/proposit-core.d.ts.map +1 -1
- package/dist/lib/core/proposit-core.js +82 -89
- package/dist/lib/core/proposit-core.js.map +1 -1
- package/dist/lib/index.d.ts +5 -3
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +4 -3
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/parsing/argument-parser.d.ts +9 -12
- package/dist/lib/parsing/argument-parser.d.ts.map +1 -1
- package/dist/lib/parsing/argument-parser.js +27 -45
- package/dist/lib/parsing/argument-parser.js.map +1 -1
- package/dist/lib/parsing/index.d.ts +2 -2
- package/dist/lib/parsing/index.d.ts.map +1 -1
- package/dist/lib/parsing/index.js +1 -1
- package/dist/lib/parsing/index.js.map +1 -1
- package/dist/lib/parsing/prompt-builder.d.ts.map +1 -1
- package/dist/lib/parsing/prompt-builder.js +31 -24
- package/dist/lib/parsing/prompt-builder.js.map +1 -1
- package/dist/lib/parsing/schemata.d.ts +7 -19
- package/dist/lib/parsing/schemata.d.ts.map +1 -1
- package/dist/lib/parsing/schemata.js +7 -14
- package/dist/lib/parsing/schemata.js.map +1 -1
- package/dist/lib/parsing/types.d.ts +1 -2
- package/dist/lib/parsing/types.d.ts.map +1 -1
- package/dist/lib/schemata/claim-citation.d.ts +11 -0
- package/dist/lib/schemata/claim-citation.d.ts.map +1 -0
- package/dist/lib/schemata/claim-citation.js +25 -0
- package/dist/lib/schemata/claim-citation.js.map +1 -0
- package/dist/lib/schemata/claim.d.ts +1 -0
- package/dist/lib/schemata/claim.d.ts.map +1 -1
- package/dist/lib/schemata/claim.js +3 -0
- package/dist/lib/schemata/claim.js.map +1 -1
- package/dist/lib/schemata/fork.d.ts +0 -11
- package/dist/lib/schemata/fork.d.ts.map +1 -1
- package/dist/lib/schemata/fork.js +0 -10
- package/dist/lib/schemata/fork.js.map +1 -1
- package/dist/lib/schemata/import.d.ts +39 -2
- package/dist/lib/schemata/import.d.ts.map +1 -1
- package/dist/lib/schemata/import.js +22 -1
- package/dist/lib/schemata/import.js.map +1 -1
- package/dist/lib/schemata/index.d.ts +1 -1
- package/dist/lib/schemata/index.d.ts.map +1 -1
- package/dist/lib/schemata/index.js +1 -1
- package/dist/lib/schemata/index.js.map +1 -1
- package/dist/lib/schemata/propositional.d.ts +32 -1
- package/dist/lib/schemata/propositional.d.ts.map +1 -1
- package/dist/lib/schemata/propositional.js +17 -2
- package/dist/lib/schemata/propositional.js.map +1 -1
- package/dist/lib/types/checksum.d.ts +3 -5
- package/dist/lib/types/checksum.d.ts.map +1 -1
- package/dist/lib/types/evaluation.d.ts +1 -1
- package/dist/lib/types/evaluation.d.ts.map +1 -1
- package/dist/lib/types/validation.d.ts +19 -7
- package/dist/lib/types/validation.d.ts.map +1 -1
- package/dist/lib/types/validation.js +21 -8
- package/dist/lib/types/validation.js.map +1 -1
- package/dist/lib/utils/derivation-validation.d.ts +24 -0
- package/dist/lib/utils/derivation-validation.d.ts.map +1 -0
- package/dist/lib/utils/derivation-validation.js +107 -0
- package/dist/lib/utils/derivation-validation.js.map +1 -0
- package/dist/lib/utils/lookup.d.ts +7 -15
- package/dist/lib/utils/lookup.d.ts.map +1 -1
- package/dist/lib/utils/lookup.js +9 -18
- package/dist/lib/utils/lookup.js.map +1 -1
- package/package.json +1 -1
- package/dist/cli/commands/sources.d.ts +0 -3
- package/dist/cli/commands/sources.d.ts.map +0 -1
- package/dist/cli/commands/sources.js +0 -103
- package/dist/cli/commands/sources.js.map +0 -1
- package/dist/extensions/ieee/source.d.ts.map +0 -1
- package/dist/extensions/ieee/source.js.map +0 -1
- package/dist/lib/core/claim-source-library.d.ts +0 -32
- package/dist/lib/core/claim-source-library.d.ts.map +0 -1
- package/dist/lib/core/claim-source-library.js +0 -193
- package/dist/lib/core/claim-source-library.js.map +0 -1
- package/dist/lib/core/source-library.d.ts +0 -23
- package/dist/lib/core/source-library.d.ts.map +0 -1
- package/dist/lib/core/source-library.js +0 -21
- package/dist/lib/core/source-library.js.map +0 -1
- package/dist/lib/schemata/source.d.ts +0 -18
- package/dist/lib/schemata/source.d.ts.map +0 -1
- package/dist/lib/schemata/source.js +0 -35
- package/dist/lib/schemata/source.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TCoreClaim } from "../../schemata/claim.js";
|
|
2
|
-
import type {
|
|
3
|
-
import type { TCoreArgumentForkRecord, TCorePremiseForkRecord, TCoreExpressionForkRecord, TCoreVariableForkRecord, TCoreClaimForkRecord
|
|
2
|
+
import type { TCoreClaimCitation } from "../../schemata/claim-citation.js";
|
|
3
|
+
import type { TCoreArgumentForkRecord, TCorePremiseForkRecord, TCoreExpressionForkRecord, TCoreVariableForkRecord, TCoreClaimForkRecord } from "../../schemata/fork.js";
|
|
4
4
|
import type { TInvariantValidationResult } from "../../types/validation.js";
|
|
5
5
|
import type { TCoreArgument, TCorePremise, TCorePropositionalExpression, TCorePropositionalVariable } from "../../schemata/index.js";
|
|
6
6
|
import type { TArgumentEngineSnapshot } from "../argument-engine.js";
|
|
@@ -21,21 +21,19 @@ export interface TClaimLookup<TClaim extends TCoreClaim = TCoreClaim> {
|
|
|
21
21
|
* @returns The claim entity, or `undefined`.
|
|
22
22
|
*/
|
|
23
23
|
get(id: string, version: number): TClaim | undefined;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Narrow read-only interface for source lookups. Used by `ArgumentEngine` for
|
|
27
|
-
* validation — callers that only need to verify source existence should depend
|
|
28
|
-
* on this rather than the full `SourceLibrary`.
|
|
29
|
-
*/
|
|
30
|
-
export interface TSourceLookup<TSource extends TCoreSource = TCoreSource> {
|
|
31
24
|
/**
|
|
32
|
-
* Returns a
|
|
25
|
+
* Returns the latest version of a claim for the given ID, or `undefined`
|
|
26
|
+
* if the claim does not exist in this lookup.
|
|
27
|
+
*
|
|
28
|
+
* Implementations backed by a flat array (e.g. `createLookup`) return the
|
|
29
|
+
* item with the highest version number for the given ID. The full
|
|
30
|
+
* `ClaimLibrary` class tracks versions natively and returns its internal
|
|
31
|
+
* latest version directly.
|
|
33
32
|
*
|
|
34
|
-
* @param id - The
|
|
35
|
-
* @
|
|
36
|
-
* @returns The source entity, or `undefined`.
|
|
33
|
+
* @param id - The claim ID.
|
|
34
|
+
* @returns The latest claim entity, or `undefined`.
|
|
37
35
|
*/
|
|
38
|
-
|
|
36
|
+
getCurrent(id: string): TClaim | undefined;
|
|
39
37
|
}
|
|
40
38
|
/**
|
|
41
39
|
* Full management interface for a versioned claim library. Extends
|
|
@@ -44,13 +42,18 @@ export interface TSourceLookup<TSource extends TCoreSource = TCoreSource> {
|
|
|
44
42
|
export interface TClaimLibraryManagement<TClaim extends TCoreClaim = TCoreClaim> extends TClaimLookup<TClaim> {
|
|
45
43
|
/**
|
|
46
44
|
* Creates a new claim at version 0. The `version`, `frozen`, and
|
|
47
|
-
* `checksum` fields are assigned automatically.
|
|
45
|
+
* `checksum` fields are assigned automatically. The `id` field is
|
|
46
|
+
* auto-generated when omitted. The `type` field is required and is
|
|
47
|
+
* immutable across the claim's lifetime.
|
|
48
48
|
*
|
|
49
|
-
* @param claim - The claim data without system-managed fields.
|
|
49
|
+
* @param claim - The claim data without system-managed fields. `id` is
|
|
50
|
+
* optional (auto-generated when omitted) and `type` is required.
|
|
50
51
|
* @returns The created claim entity with all fields populated.
|
|
51
52
|
* @throws If a claim with the same ID already exists.
|
|
52
53
|
*/
|
|
53
|
-
create(claim: Omit<TClaim, "version" | "frozen" | "checksum">
|
|
54
|
+
create(claim: Omit<TClaim, "version" | "frozen" | "checksum"> | (Omit<TClaim, "id" | "version" | "frozen" | "checksum"> & {
|
|
55
|
+
id?: string;
|
|
56
|
+
})): TClaim;
|
|
54
57
|
/**
|
|
55
58
|
* Updates mutable fields on the current (latest, unfrozen) version of a
|
|
56
59
|
* claim. System-managed fields (`id`, `version`, `frozen`, `checksum`)
|
|
@@ -112,152 +115,81 @@ export interface TClaimLibraryManagement<TClaim extends TCoreClaim = TCoreClaim>
|
|
|
112
115
|
validate(): TInvariantValidationResult;
|
|
113
116
|
}
|
|
114
117
|
/**
|
|
115
|
-
*
|
|
116
|
-
*
|
|
118
|
+
* Narrow read-only interface for claim-citation lookups.
|
|
119
|
+
* Implemented by `ClaimCitationLibrary`.
|
|
117
120
|
*/
|
|
118
|
-
export interface
|
|
119
|
-
/**
|
|
120
|
-
* Creates a new source at version 0. The `version`, `frozen`, and
|
|
121
|
-
* `checksum` fields are assigned automatically.
|
|
122
|
-
*
|
|
123
|
-
* @param source - The source data without system-managed fields.
|
|
124
|
-
* @returns The created source entity with all fields populated.
|
|
125
|
-
* @throws If a source with the same ID already exists.
|
|
126
|
-
*/
|
|
127
|
-
create(source: Omit<TSource, "version" | "frozen" | "checksum">): TSource;
|
|
128
|
-
/**
|
|
129
|
-
* Updates mutable fields on the current (latest, unfrozen) version of a
|
|
130
|
-
* source. System-managed fields (`id`, `version`, `frozen`, `checksum`)
|
|
131
|
-
* cannot be updated.
|
|
132
|
-
*
|
|
133
|
-
* @param id - The source ID.
|
|
134
|
-
* @param updates - The fields to update.
|
|
135
|
-
* @returns The updated source entity.
|
|
136
|
-
* @throws If the source does not exist.
|
|
137
|
-
* @throws If the current version is frozen.
|
|
138
|
-
*/
|
|
139
|
-
update(id: string, updates: Partial<Omit<TSource, "id" | "version" | "frozen" | "checksum">>): TSource;
|
|
121
|
+
export interface TClaimCitationLookup<TCitation extends TCoreClaimCitation = TCoreClaimCitation> {
|
|
140
122
|
/**
|
|
141
|
-
*
|
|
142
|
-
* creates a new mutable version at `version + 1`.
|
|
123
|
+
* Returns all citations where the given claim is the citing-side endpoint.
|
|
143
124
|
*
|
|
144
|
-
* @param
|
|
145
|
-
* @returns An
|
|
146
|
-
* `current` (mutable) version.
|
|
147
|
-
* @throws If the source does not exist.
|
|
148
|
-
* @throws If the current version is already frozen.
|
|
125
|
+
* @param citingClaimId - The citing claim ID to filter by.
|
|
126
|
+
* @returns An array of matching citations.
|
|
149
127
|
*/
|
|
150
|
-
|
|
151
|
-
frozen: TSource;
|
|
152
|
-
current: TSource;
|
|
153
|
-
};
|
|
128
|
+
getCitationsForCitingClaim(citingClaimId: string): TCitation[];
|
|
154
129
|
/**
|
|
155
|
-
* Returns
|
|
130
|
+
* Returns all citations where the given claim is the source-side endpoint.
|
|
156
131
|
*
|
|
157
|
-
* @param
|
|
158
|
-
* @returns
|
|
132
|
+
* @param sourceClaimId - The source claim ID to filter by.
|
|
133
|
+
* @returns An array of matching citations.
|
|
159
134
|
*/
|
|
160
|
-
|
|
135
|
+
getCitationsForSourceClaim(sourceClaimId: string): TCitation[];
|
|
161
136
|
/**
|
|
162
|
-
* Returns
|
|
137
|
+
* Returns a citation by ID, or `undefined` if not found.
|
|
163
138
|
*
|
|
164
|
-
* @
|
|
139
|
+
* @param id - The citation ID.
|
|
140
|
+
* @returns The citation entity, or `undefined`.
|
|
165
141
|
*/
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Returns all versions of a source sorted by version number ascending.
|
|
169
|
-
*
|
|
170
|
-
* @param id - The source ID.
|
|
171
|
-
* @returns An array of source entities, or an empty array if the ID does
|
|
172
|
-
* not exist.
|
|
173
|
-
*/
|
|
174
|
-
getVersions(id: string): TSource[];
|
|
175
|
-
/**
|
|
176
|
-
* Returns a serializable snapshot of all sources in the library.
|
|
177
|
-
*
|
|
178
|
-
* @returns The source library snapshot.
|
|
179
|
-
*/
|
|
180
|
-
snapshot(): TSourceLibrarySnapshot<TSource>;
|
|
181
|
-
/**
|
|
182
|
-
* Run invariant validation on the source library.
|
|
183
|
-
*
|
|
184
|
-
* @returns The invariant validation result.
|
|
185
|
-
*/
|
|
186
|
-
validate(): TInvariantValidationResult;
|
|
142
|
+
get(id: string): TCitation | undefined;
|
|
187
143
|
}
|
|
188
144
|
/**
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
145
|
+
* Full management interface for a claim-citation library. Extends
|
|
146
|
+
* `TClaimCitationLookup` with mutation, query, and snapshot methods.
|
|
147
|
+
* Citations are create-or-delete only — no update path.
|
|
192
148
|
*/
|
|
193
|
-
export interface
|
|
149
|
+
export interface TClaimCitationLibraryManagement<TCitation extends TCoreClaimCitation = TCoreClaimCitation> extends TClaimCitationLookup<TCitation> {
|
|
194
150
|
/**
|
|
195
|
-
*
|
|
151
|
+
* Creates a claim citation. Validates that both the citing and source
|
|
152
|
+
* claims exist in the claim library, that the source-side claim has
|
|
153
|
+
* type='citation', and that the new edge does not introduce a cycle in
|
|
154
|
+
* the global claim-citation graph.
|
|
196
155
|
*
|
|
197
|
-
* @param
|
|
198
|
-
* @returns
|
|
156
|
+
* @param citation - The citation data without the `checksum` field.
|
|
157
|
+
* @returns The created citation with checksum populated.
|
|
158
|
+
* @throws If a citation with the same ID already exists.
|
|
159
|
+
* @throws If the referenced citing or source claim does not exist.
|
|
160
|
+
* @throws If the source-side claim has type !== 'citation'.
|
|
161
|
+
* @throws If the citation would create a cycle.
|
|
199
162
|
*/
|
|
200
|
-
|
|
163
|
+
add(citation: Omit<TCitation, "checksum">): TCitation;
|
|
201
164
|
/**
|
|
202
|
-
*
|
|
165
|
+
* Removes a claim citation by ID.
|
|
203
166
|
*
|
|
204
|
-
* @param
|
|
205
|
-
* @returns
|
|
167
|
+
* @param id - The citation ID to remove.
|
|
168
|
+
* @returns The removed citation entity.
|
|
169
|
+
* @throws If the citation does not exist.
|
|
206
170
|
*/
|
|
207
|
-
|
|
171
|
+
remove(id: string): TCitation;
|
|
208
172
|
/**
|
|
209
|
-
* Returns
|
|
173
|
+
* Returns all citations in the library.
|
|
210
174
|
*
|
|
211
|
-
* @
|
|
212
|
-
* @returns The association entity, or `undefined`.
|
|
175
|
+
* @returns An array of all citation entities.
|
|
213
176
|
*/
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Full management interface for a claim-source association library. Extends
|
|
218
|
-
* `TClaimSourceLookup` with mutation, query, and snapshot methods.
|
|
219
|
-
* Associations are create-or-delete only — no update path.
|
|
220
|
-
*/
|
|
221
|
-
export interface TClaimSourceLibraryManagement<TAssoc extends TCoreClaimSourceAssociation = TCoreClaimSourceAssociation> extends TClaimSourceLookup<TAssoc> {
|
|
177
|
+
getAll(): TCitation[];
|
|
222
178
|
/**
|
|
223
|
-
*
|
|
224
|
-
* and source exist in their respective libraries.
|
|
179
|
+
* Returns all citations matching the predicate.
|
|
225
180
|
*
|
|
226
|
-
* @param
|
|
227
|
-
* @returns
|
|
228
|
-
* @throws If an association with the same ID already exists.
|
|
229
|
-
* @throws If the referenced claim or source does not exist.
|
|
181
|
+
* @param predicate - A filter function applied to each citation.
|
|
182
|
+
* @returns An array of matching citations.
|
|
230
183
|
*/
|
|
231
|
-
|
|
184
|
+
filter(predicate: (c: TCitation) => boolean): TCitation[];
|
|
232
185
|
/**
|
|
233
|
-
*
|
|
186
|
+
* Returns a serializable snapshot of all citations in the library.
|
|
234
187
|
*
|
|
235
|
-
* @
|
|
236
|
-
* @returns The removed association entity.
|
|
237
|
-
* @throws If the association does not exist.
|
|
188
|
+
* @returns The claim-citation library snapshot.
|
|
238
189
|
*/
|
|
239
|
-
|
|
190
|
+
snapshot(): TClaimCitationLibrarySnapshot<TCitation>;
|
|
240
191
|
/**
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* @returns An array of all association entities.
|
|
244
|
-
*/
|
|
245
|
-
getAll(): TAssoc[];
|
|
246
|
-
/**
|
|
247
|
-
* Returns all associations matching the predicate.
|
|
248
|
-
*
|
|
249
|
-
* @param predicate - A filter function applied to each association.
|
|
250
|
-
* @returns An array of matching associations.
|
|
251
|
-
*/
|
|
252
|
-
filter(predicate: (a: TAssoc) => boolean): TAssoc[];
|
|
253
|
-
/**
|
|
254
|
-
* Returns a serializable snapshot of all associations in the library.
|
|
255
|
-
*
|
|
256
|
-
* @returns The claim-source library snapshot.
|
|
257
|
-
*/
|
|
258
|
-
snapshot(): TClaimSourceLibrarySnapshot<TAssoc>;
|
|
259
|
-
/**
|
|
260
|
-
* Run invariant validation on the claim-source association library.
|
|
192
|
+
* Run invariant validation on the claim-citation library.
|
|
261
193
|
*
|
|
262
194
|
* @returns The invariant validation result.
|
|
263
195
|
*/
|
|
@@ -272,26 +204,18 @@ export type TClaimLibrarySnapshot<TClaim extends TCoreClaim = TCoreClaim> = {
|
|
|
272
204
|
claims: TClaim[];
|
|
273
205
|
};
|
|
274
206
|
/**
|
|
275
|
-
* Serializable snapshot of a `
|
|
276
|
-
* across all IDs and versions.
|
|
277
|
-
*/
|
|
278
|
-
export type TSourceLibrarySnapshot<TSource extends TCoreSource = TCoreSource> = {
|
|
279
|
-
/** All source entities in the library. */
|
|
280
|
-
sources: TSource[];
|
|
281
|
-
};
|
|
282
|
-
/**
|
|
283
|
-
* Serializable snapshot of a `ClaimSourceLibrary`. Contains all association
|
|
207
|
+
* Serializable snapshot of a `ClaimCitationLibrary`. Contains all citation
|
|
284
208
|
* entities.
|
|
285
209
|
*/
|
|
286
|
-
export type
|
|
287
|
-
/** All claim
|
|
288
|
-
|
|
210
|
+
export type TClaimCitationLibrarySnapshot<TCitation extends TCoreClaimCitation = TCoreClaimCitation> = {
|
|
211
|
+
/** All claim citation entities in the library. */
|
|
212
|
+
claimCitations: TCitation[];
|
|
289
213
|
};
|
|
290
214
|
/**
|
|
291
215
|
* Serializable snapshot of a `ForkLibrary`. Contains arrays of fork records
|
|
292
216
|
* for each entity type.
|
|
293
217
|
*/
|
|
294
|
-
export type TForkLibrarySnapshot<TArgFork extends TCoreArgumentForkRecord = TCoreArgumentForkRecord, TPremiseFork extends TCorePremiseForkRecord = TCorePremiseForkRecord, TExprFork extends TCoreExpressionForkRecord = TCoreExpressionForkRecord, TVarFork extends TCoreVariableForkRecord = TCoreVariableForkRecord, TClaimFork extends TCoreClaimForkRecord = TCoreClaimForkRecord
|
|
218
|
+
export type TForkLibrarySnapshot<TArgFork extends TCoreArgumentForkRecord = TCoreArgumentForkRecord, TPremiseFork extends TCorePremiseForkRecord = TCorePremiseForkRecord, TExprFork extends TCoreExpressionForkRecord = TCoreExpressionForkRecord, TVarFork extends TCoreVariableForkRecord = TCoreVariableForkRecord, TClaimFork extends TCoreClaimForkRecord = TCoreClaimForkRecord> = {
|
|
295
219
|
/** All argument fork records. */
|
|
296
220
|
arguments: TArgFork[];
|
|
297
221
|
/** All premise fork records. */
|
|
@@ -302,8 +226,6 @@ export type TForkLibrarySnapshot<TArgFork extends TCoreArgumentForkRecord = TCor
|
|
|
302
226
|
variables: TVarFork[];
|
|
303
227
|
/** All claim fork records. */
|
|
304
228
|
claims: TClaimFork[];
|
|
305
|
-
/** All source fork records. */
|
|
306
|
-
sources: TSourceFork[];
|
|
307
229
|
};
|
|
308
230
|
/**
|
|
309
231
|
* Serializable snapshot of an `ArgumentLibrary`. Contains snapshots of all
|
|
@@ -315,20 +237,17 @@ export type TArgumentLibrarySnapshot<TArg extends TCoreArgument = TCoreArgument,
|
|
|
315
237
|
};
|
|
316
238
|
/**
|
|
317
239
|
* Serializable snapshot of a `PropositCore` instance. Contains snapshots of
|
|
318
|
-
* all managed libraries: arguments, claims,
|
|
319
|
-
* and fork records.
|
|
240
|
+
* all managed libraries: arguments, claims, claim citations, and fork records.
|
|
320
241
|
*/
|
|
321
|
-
export type TPropositCoreSnapshot<TArg extends TCoreArgument = TCoreArgument, TPremise extends TCorePremise = TCorePremise, TExpr extends TCorePropositionalExpression = TCorePropositionalExpression, TVar extends TCorePropositionalVariable = TCorePropositionalVariable,
|
|
242
|
+
export type TPropositCoreSnapshot<TArg extends TCoreArgument = TCoreArgument, TPremise extends TCorePremise = TCorePremise, TExpr extends TCorePropositionalExpression = TCorePropositionalExpression, TVar extends TCorePropositionalVariable = TCorePropositionalVariable, TClaim extends TCoreClaim = TCoreClaim, TCitation extends TCoreClaimCitation = TCoreClaimCitation, TArgFork extends TCoreArgumentForkRecord = TCoreArgumentForkRecord, TPremiseFork extends TCorePremiseForkRecord = TCorePremiseForkRecord, TExprFork extends TCoreExpressionForkRecord = TCoreExpressionForkRecord, TVarFork extends TCoreVariableForkRecord = TCoreVariableForkRecord, TClaimFork extends TCoreClaimForkRecord = TCoreClaimForkRecord> = {
|
|
322
243
|
/** Snapshot of all argument engines. */
|
|
323
244
|
arguments: TArgumentLibrarySnapshot<TArg, TPremise, TExpr, TVar>;
|
|
324
245
|
/** Snapshot of the claim library. */
|
|
325
246
|
claims: TClaimLibrarySnapshot<TClaim>;
|
|
326
|
-
/** Snapshot of the
|
|
327
|
-
|
|
328
|
-
/** Snapshot of the claim-source association library. */
|
|
329
|
-
claimSources: TClaimSourceLibrarySnapshot<TAssoc>;
|
|
247
|
+
/** Snapshot of the claim-citation library. */
|
|
248
|
+
claimCitations: TClaimCitationLibrarySnapshot<TCitation>;
|
|
330
249
|
/** Snapshot of the fork library. */
|
|
331
|
-
forks: TForkLibrarySnapshot<TArgFork, TPremiseFork, TExprFork, TVarFork, TClaimFork
|
|
250
|
+
forks: TForkLibrarySnapshot<TArgFork, TPremiseFork, TExprFork, TVarFork, TClaimFork>;
|
|
332
251
|
};
|
|
333
252
|
/**
|
|
334
253
|
* Shared configuration options for `PropositCore`. These config values are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.interfaces.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/interfaces/library.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"library.interfaces.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/interfaces/library.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAC1E,OAAO,KAAK,EACR,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,EACvB,oBAAoB,EACvB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAA;AAC3E,OAAO,KAAK,EACR,aAAa,EACb,YAAY,EACZ,4BAA4B,EAC5B,0BAA0B,EAC7B,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAE5D;;;;GAIG;AACH,MAAM,WAAW,YAAY,CAAC,MAAM,SAAS,UAAU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QAAQ,SAAS,uBAAuB,GAAG,uBAAuB,EAClE,UAAU,SAAS,oBAAoB,GAAG,oBAAoB,IAC9D;IACA,wCAAwC;IACxC,SAAS,EAAE,wBAAwB,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;IAChE,qCAAqC;IACrC,MAAM,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAA;IACrC,8CAA8C;IAC9C,cAAc,EAAE,6BAA6B,CAAC,SAAS,CAAC,CAAA;IACxD,oCAAoC;IACpC,KAAK,EAAE,oBAAoB,CACvB,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,UAAU,CACb,CAAA;CACJ,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,+DAA+D;IAC/D,cAAc,CAAC,EAAE,mBAAmB,CAAA;IACpC,4CAA4C;IAC5C,cAAc,CAAC,EAAE,mBAAmB,CAAA;IACpC,2CAA2C;IAC3C,aAAa,CAAC,EAAE,cAAc,CAAA;IAC9B,uFAAuF;IACvF,UAAU,CAAC,EAAE,MAAM,MAAM,CAAA;CAC5B,CAAA"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { type TCoreArgument, type TCoreLogicalOperatorType, type TCorePremise, type TCorePropositionalExpression, type TCorePropositionalVariable, type TOptionalChecksum, type TClaimBoundVariable } from "../schemata/index.js";
|
|
2
|
+
import { PremiseEngine, type TPremiseEngineSnapshot } from "./premise-engine.js";
|
|
3
|
+
import { VariableManager } from "./variable-manager.js";
|
|
4
|
+
import { type TLogicEngineOptions } from "./argument-engine.js";
|
|
5
|
+
/**
|
|
6
|
+
* Minimal structural interface needed by `populateFromCitations`. Using a
|
|
7
|
+
* structural type rather than the concrete `ArgumentEngine<…>` class prevents
|
|
8
|
+
* generic-parameter variance errors when the caller uses default type params.
|
|
9
|
+
*/
|
|
10
|
+
export type TVariableMaterializer = {
|
|
11
|
+
ensureClaimBoundVariable(claimId: string): TClaimBoundVariable;
|
|
12
|
+
};
|
|
13
|
+
import { type TGrammarConfig } from "../types/grammar.js";
|
|
14
|
+
import type { TExpressionInput, TExpressionWithoutPosition, TExpressionUpdate } from "./expression-manager.js";
|
|
15
|
+
import type { TCoreMutationResult } from "../types/mutation.js";
|
|
16
|
+
import type { ClaimCitationLibrary } from "./claim-citation-library.js";
|
|
17
|
+
/**
|
|
18
|
+
* A managed engine for derivation premises that enforces structural rules
|
|
19
|
+
* from the v0.11.0 spec on construction and on snapshot restoration.
|
|
20
|
+
*
|
|
21
|
+
* Construction validates the premise type (`DERIVATION_TYPE_MISMATCH` if the
|
|
22
|
+
* premise isn't `type: "derivation"`). Full expression-tree structural
|
|
23
|
+
* validation (`DERIVATION_STRUCTURE_INVALID`) runs in `fromSnapshot` — after
|
|
24
|
+
* expressions are loaded — and will be called from mutation overrides in
|
|
25
|
+
* Task 6.
|
|
26
|
+
*
|
|
27
|
+
* Note: The constructor only validates the premise type, not the expression
|
|
28
|
+
* tree, because `PremiseEngine` is always constructed before expressions are
|
|
29
|
+
* loaded (expressions are added separately via mutations or `loadExpressions`).
|
|
30
|
+
* Structural validation at the end of `fromSnapshot` catches tampered
|
|
31
|
+
* snapshots, and Task 6 mutation overrides will enforce it on every change.
|
|
32
|
+
*
|
|
33
|
+
* The classic `PremiseEngine` is permissive and allows mutations that leave a
|
|
34
|
+
* derivation premise temporarily or permanently invalid. The managed engine
|
|
35
|
+
* wraps it for safe, structurally-enforced editing.
|
|
36
|
+
*
|
|
37
|
+
* Use `ManagedDerivationPremiseEngine.fromSnapshot(...)` to restore from a
|
|
38
|
+
* serialized snapshot — the validation pass catches tampered snapshots.
|
|
39
|
+
*/
|
|
40
|
+
export declare class ManagedDerivationPremiseEngine<TArg extends TCoreArgument = TCoreArgument, TPremise extends TCorePremise = TCorePremise, TExpr extends TCorePropositionalExpression = TCorePropositionalExpression, TVar extends TCorePropositionalVariable = TCorePropositionalVariable> extends PremiseEngine<TArg, TPremise, TExpr, TVar> {
|
|
41
|
+
/**
|
|
42
|
+
* Captured from `config.generateId` (or the default UUID generator) for
|
|
43
|
+
* use in `populateFromCitations`, which needs to mint new expression IDs.
|
|
44
|
+
* Stored separately because `PremiseEngine`'s generateId is private.
|
|
45
|
+
* Not `readonly` because `fromSnapshot` re-injects it after the prototype
|
|
46
|
+
* upgrade.
|
|
47
|
+
*/
|
|
48
|
+
private generateIdFn;
|
|
49
|
+
constructor(premise: TOptionalChecksum<TPremise>, deps: {
|
|
50
|
+
argument: TOptionalChecksum<TArg>;
|
|
51
|
+
variables: VariableManager<TVar>;
|
|
52
|
+
expressionIndex?: Map<string, string>;
|
|
53
|
+
}, config?: TLogicEngineOptions);
|
|
54
|
+
/**
|
|
55
|
+
* Restore a `ManagedDerivationPremiseEngine` from a serialized snapshot,
|
|
56
|
+
* applying both derivation-type and structural validation. Throws on
|
|
57
|
+
* tampered or structurally invalid snapshots.
|
|
58
|
+
*
|
|
59
|
+
* Delegates to `PremiseEngine.fromSnapshot` for the full restoration logic
|
|
60
|
+
* (including the private `rebuildVariableIndex` pass), then upgrades the
|
|
61
|
+
* prototype and validates. TypeScript's static methods do not support
|
|
62
|
+
* `super`, so the parent is called by name and the result is recast.
|
|
63
|
+
*/
|
|
64
|
+
static fromSnapshot<TArg extends TCoreArgument = TCoreArgument, TPremise extends TCorePremise = TCorePremise, TExpr extends TCorePropositionalExpression = TCorePropositionalExpression, TVar extends TCorePropositionalVariable = TCorePropositionalVariable>(snapshot: TPremiseEngineSnapshot<TPremise, TExpr>, argument: TOptionalChecksum<TArg>, variables: VariableManager<TVar>, expressionIndex?: Map<string, string>, grammarConfig?: TGrammarConfig, generateId?: () => string): ManagedDerivationPremiseEngine<TArg, TPremise, TExpr, TVar>;
|
|
65
|
+
/**
|
|
66
|
+
* Validate that the wrapped premise has `type === "derivation"`.
|
|
67
|
+
* @throws InvariantViolationError with code `DERIVATION_TYPE_MISMATCH`
|
|
68
|
+
*/
|
|
69
|
+
protected assertDerivationType(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Validate that the expression tree conforms to the derivation rules from
|
|
72
|
+
* the v0.11.0 spec (naked-Q or IMPLIES/IFF with Q as consequent).
|
|
73
|
+
* @throws InvariantViolationError with code `DERIVATION_STRUCTURE_INVALID`
|
|
74
|
+
*/
|
|
75
|
+
protected assertWellFormed(): void;
|
|
76
|
+
addExpression(expression: TExpressionInput<TExpr>): TCoreMutationResult<TExpr, TExpr, TVar, TPremise, TArg>;
|
|
77
|
+
appendExpression(parentId: string | null, expression: TExpressionWithoutPosition<TExpr>): TCoreMutationResult<TExpr, TExpr, TVar, TPremise, TArg>;
|
|
78
|
+
addExpressionRelative(siblingId: string, relativePosition: "before" | "after", expression: TExpressionWithoutPosition<TExpr>): TCoreMutationResult<TExpr, TExpr, TVar, TPremise, TArg>;
|
|
79
|
+
updateExpression(expressionId: string, updates: TExpressionUpdate): TCoreMutationResult<TExpr, TExpr, TVar, TPremise, TArg>;
|
|
80
|
+
removeExpression(expressionId: string, deleteSubtree: boolean): TCoreMutationResult<TExpr | undefined, TExpr, TVar, TPremise, TArg>;
|
|
81
|
+
insertExpression(expression: TExpressionInput<TExpr>, leftNodeId?: string, rightNodeId?: string): TCoreMutationResult<TExpr, TExpr, TVar, TPremise, TArg>;
|
|
82
|
+
toggleNegation(expressionId: string, extraFields?: Partial<TExpr>): TCoreMutationResult<TExpr | null, TExpr, TVar, TPremise, TArg>;
|
|
83
|
+
wrapExpression(operator: TExpressionWithoutPosition<TExpr>, newSibling: TExpressionWithoutPosition<TExpr>, leftNodeId?: string, rightNodeId?: string): TCoreMutationResult<TExpr, TExpr, TVar, TPremise, TArg>;
|
|
84
|
+
changeOperator(expressionId: string, newOperator: TCoreLogicalOperatorType, sourceChildId?: string, targetChildId?: string, extraFields?: Partial<TExpr>): TCoreMutationResult<TExpr | null, TExpr, TVar, TPremise, TArg>;
|
|
85
|
+
normalizeExpressions(): TCoreMutationResult<void, TExpr, TVar, TPremise, TArg>;
|
|
86
|
+
loadExpressions(expressions: TExpressionInput<TExpr>[]): void;
|
|
87
|
+
/**
|
|
88
|
+
* One-shot snapshot helper that builds the antecedent of this derivation
|
|
89
|
+
* premise from the current global citations of the derived claim.
|
|
90
|
+
*
|
|
91
|
+
* Behavior by citation count:
|
|
92
|
+
* - n = 0: no change. Premise stays in its current form (typically
|
|
93
|
+
* naked-Q, indicating "no support given").
|
|
94
|
+
* - n = 1: produces `IMPLIES(VariableExpression(S1), VariableExpression(Q))`.
|
|
95
|
+
* - n ≥ 2: produces `IMPLIES(OR(VariableExpression(S1), …,
|
|
96
|
+
* VariableExpression(Sn)), VariableExpression(Q))`.
|
|
97
|
+
*
|
|
98
|
+
* Materializes a claim-bound variable for each cited source via
|
|
99
|
+
* `argumentEngine.ensureClaimBoundVariable(citation.sourceClaimId)`.
|
|
100
|
+
*
|
|
101
|
+
* **Tree construction approach:** Mutations are performed via `super.*`
|
|
102
|
+
* calls, bypassing this class's overrides (which call `assertWellFormed()`
|
|
103
|
+
* after every mutation and would reject intermediate states during
|
|
104
|
+
* multi-step construction). For n ≥ 2 the grammar is temporarily switched
|
|
105
|
+
* to `PERMISSIVE_GRAMMAR_CONFIG` so that the OR operator can sit directly
|
|
106
|
+
* under IMPLIES without triggering an auto-inserted formula buffer. The
|
|
107
|
+
* grammar is restored and `assertWellFormed()` is called at the end to
|
|
108
|
+
* validate the final state.
|
|
109
|
+
*
|
|
110
|
+
* @throws InvariantViolationError(DERIVATION_ANTECEDENT_NON_EMPTY) when the
|
|
111
|
+
* derivation premise already has a non-empty antecedent (i.e., the
|
|
112
|
+
* root is `implies`/`iff` with a position-0 child). The caller
|
|
113
|
+
* decides whether to delete and re-create the premise.
|
|
114
|
+
*
|
|
115
|
+
* @since 0.11.0
|
|
116
|
+
*/
|
|
117
|
+
populateFromCitations(citationLib: ClaimCitationLibrary, argumentEngine: TVariableMaterializer): void;
|
|
118
|
+
/**
|
|
119
|
+
* Returns the ID of the consequent expression, or `undefined` if the tree
|
|
120
|
+
* has no root yet.
|
|
121
|
+
*
|
|
122
|
+
* - Naked form (root is a variable expression): the root IS the consequent.
|
|
123
|
+
* - Implication/biconditional form (root is `implies`/`iff`): the position-1
|
|
124
|
+
* child of the root is the consequent.
|
|
125
|
+
*/
|
|
126
|
+
private getConsequentExpressionId;
|
|
127
|
+
/**
|
|
128
|
+
* Reject an `insertExpression` call that would place a new node into the
|
|
129
|
+
* consequent slot of the root `implies`/`iff`.
|
|
130
|
+
*
|
|
131
|
+
* Detection is by parentId + position on the input: we block when
|
|
132
|
+
* `expression.parentId === rootId` AND `expression.position >= consequent.position`.
|
|
133
|
+
* For `implies`/`iff` the consequent sits at position 1, so this blocks
|
|
134
|
+
* insertions into position 1 (which would displace the consequent) and
|
|
135
|
+
* positions beyond (which would exceed arity 2). Insertions at position 0
|
|
136
|
+
* (antecedent slot) pass through.
|
|
137
|
+
*/
|
|
138
|
+
private assertNotConsequentSlot;
|
|
139
|
+
/**
|
|
140
|
+
* Reject `removeExpression` and `toggleNegation` calls on the consequent
|
|
141
|
+
* expression.
|
|
142
|
+
*/
|
|
143
|
+
private assertNotConsequentExpression;
|
|
144
|
+
/**
|
|
145
|
+
* Reject `updateExpression` calls that change the consequent's `variableId`
|
|
146
|
+
* or `type`.
|
|
147
|
+
*/
|
|
148
|
+
private assertConsequentNotMutated;
|
|
149
|
+
/**
|
|
150
|
+
* Reject `changeOperator` calls that would swap the root `implies`/`iff`
|
|
151
|
+
* to a non-implication operator (`and`, `or`, `not`).
|
|
152
|
+
*/
|
|
153
|
+
private assertRootOperatorChangeValid;
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=managed-derivation-premise-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-derivation-premise-engine.d.ts","sourceRoot":"","sources":["../../../src/lib/core/managed-derivation-premise-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,aAAa,EAElB,KAAK,wBAAwB,EAC7B,KAAK,YAAY,E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