@polintpro/proposit-core 0.3.0 → 0.4.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.
Files changed (100) hide show
  1. package/README.md +13 -0
  2. package/dist/cli/commands/sources.d.ts +3 -0
  3. package/dist/cli/commands/sources.d.ts.map +1 -0
  4. package/dist/cli/commands/sources.js +175 -0
  5. package/dist/cli/commands/sources.js.map +1 -0
  6. package/dist/cli/config.d.ts +2 -0
  7. package/dist/cli/config.d.ts.map +1 -1
  8. package/dist/cli/config.js +6 -0
  9. package/dist/cli/config.js.map +1 -1
  10. package/dist/cli/engine.d.ts.map +1 -1
  11. package/dist/cli/engine.js +39 -1
  12. package/dist/cli/engine.js.map +1 -1
  13. package/dist/cli/schemata.d.ts +8 -0
  14. package/dist/cli/schemata.d.ts.map +1 -1
  15. package/dist/cli/schemata.js +10 -0
  16. package/dist/cli/schemata.js.map +1 -1
  17. package/dist/cli/storage/sources.d.ts +11 -0
  18. package/dist/cli/storage/sources.d.ts.map +1 -0
  19. package/dist/cli/storage/sources.js +105 -0
  20. package/dist/cli/storage/sources.js.map +1 -0
  21. package/dist/cli.js +2 -0
  22. package/dist/cli.js.map +1 -1
  23. package/dist/extensions/ieee/index.d.ts +3 -0
  24. package/dist/extensions/ieee/index.d.ts.map +1 -0
  25. package/dist/extensions/ieee/index.js +3 -0
  26. package/dist/extensions/ieee/index.js.map +1 -0
  27. package/dist/extensions/ieee/references.d.ts +620 -0
  28. package/dist/extensions/ieee/references.d.ts.map +1 -0
  29. package/dist/extensions/ieee/references.js +450 -0
  30. package/dist/extensions/ieee/references.js.map +1 -0
  31. package/dist/extensions/ieee/source.d.ts +286 -0
  32. package/dist/extensions/ieee/source.d.ts.map +1 -0
  33. package/dist/extensions/ieee/source.js +12 -0
  34. package/dist/extensions/ieee/source.js.map +1 -0
  35. package/dist/lib/consts.d.ts.map +1 -1
  36. package/dist/lib/consts.js +19 -0
  37. package/dist/lib/consts.js.map +1 -1
  38. package/dist/lib/core/argument-engine.d.ts +42 -134
  39. package/dist/lib/core/argument-engine.d.ts.map +1 -1
  40. package/dist/lib/core/argument-engine.js +299 -116
  41. package/dist/lib/core/argument-engine.js.map +1 -1
  42. package/dist/lib/core/change-collector.d.ts +12 -2
  43. package/dist/lib/core/change-collector.d.ts.map +1 -1
  44. package/dist/lib/core/change-collector.js +27 -0
  45. package/dist/lib/core/change-collector.js.map +1 -1
  46. package/dist/lib/core/diff.d.ts +8 -2
  47. package/dist/lib/core/diff.d.ts.map +1 -1
  48. package/dist/lib/core/diff.js +58 -0
  49. package/dist/lib/core/diff.js.map +1 -1
  50. package/dist/lib/core/interfaces/argument-engine.interfaces.d.ts +334 -0
  51. package/dist/lib/core/interfaces/argument-engine.interfaces.d.ts.map +1 -0
  52. package/dist/lib/core/interfaces/argument-engine.interfaces.js +2 -0
  53. package/dist/lib/core/interfaces/argument-engine.interfaces.js.map +1 -0
  54. package/dist/lib/core/interfaces/index.d.ts +5 -0
  55. package/dist/lib/core/interfaces/index.d.ts.map +1 -0
  56. package/dist/lib/core/interfaces/index.js +2 -0
  57. package/dist/lib/core/interfaces/index.js.map +1 -0
  58. package/dist/lib/core/interfaces/premise-engine.interfaces.d.ts +317 -0
  59. package/dist/lib/core/interfaces/premise-engine.interfaces.d.ts.map +1 -0
  60. package/dist/lib/core/interfaces/premise-engine.interfaces.js +2 -0
  61. package/dist/lib/core/interfaces/premise-engine.interfaces.js.map +1 -0
  62. package/dist/lib/core/interfaces/shared.interfaces.d.ts +24 -0
  63. package/dist/lib/core/interfaces/shared.interfaces.d.ts.map +1 -0
  64. package/dist/lib/core/interfaces/shared.interfaces.js +2 -0
  65. package/dist/lib/core/interfaces/shared.interfaces.js.map +1 -0
  66. package/dist/lib/core/interfaces/source-management.interfaces.d.ts +110 -0
  67. package/dist/lib/core/interfaces/source-management.interfaces.d.ts.map +1 -0
  68. package/dist/lib/core/interfaces/source-management.interfaces.js +2 -0
  69. package/dist/lib/core/interfaces/source-management.interfaces.js.map +1 -0
  70. package/dist/lib/core/premise-engine.d.ts +19 -153
  71. package/dist/lib/core/premise-engine.d.ts.map +1 -1
  72. package/dist/lib/core/premise-engine.js +95 -143
  73. package/dist/lib/core/premise-engine.js.map +1 -1
  74. package/dist/lib/core/source-manager.d.ts +109 -0
  75. package/dist/lib/core/source-manager.d.ts.map +1 -0
  76. package/dist/lib/core/source-manager.js +420 -0
  77. package/dist/lib/core/source-manager.js.map +1 -0
  78. package/dist/lib/index.d.ts +4 -1
  79. package/dist/lib/index.d.ts.map +1 -1
  80. package/dist/lib/index.js +2 -1
  81. package/dist/lib/index.js.map +1 -1
  82. package/dist/lib/schemata/index.d.ts +1 -0
  83. package/dist/lib/schemata/index.d.ts.map +1 -1
  84. package/dist/lib/schemata/index.js +1 -0
  85. package/dist/lib/schemata/index.js.map +1 -1
  86. package/dist/lib/schemata/source.d.ts +28 -0
  87. package/dist/lib/schemata/source.d.ts.map +1 -0
  88. package/dist/lib/schemata/source.js +35 -0
  89. package/dist/lib/schemata/source.js.map +1 -0
  90. package/dist/lib/types/checksum.d.ts +6 -0
  91. package/dist/lib/types/checksum.d.ts.map +1 -1
  92. package/dist/lib/types/diff.d.ts +9 -3
  93. package/dist/lib/types/diff.d.ts.map +1 -1
  94. package/dist/lib/types/evaluation.d.ts +1 -1
  95. package/dist/lib/types/evaluation.d.ts.map +1 -1
  96. package/dist/lib/types/mutation.d.ts +7 -3
  97. package/dist/lib/types/mutation.d.ts.map +1 -1
  98. package/dist/lib/types/reactive.d.ts +5 -2
  99. package/dist/lib/types/reactive.d.ts.map +1 -1
  100. package/package.json +5 -1
@@ -0,0 +1,317 @@
1
+ import type { TCoreArgument, TCorePremise, TCorePropositionalExpression, TCorePropositionalVariable, TCoreSource, TCoreExpressionSourceAssociation } from "../../schemata/index.js";
2
+ import type { TCoreExpressionAssignment, TCorePremiseEvaluationResult, TCoreValidationResult } from "../../types/evaluation.js";
3
+ import type { TCoreMutationResult } from "../../types/mutation.js";
4
+ import type { TExpressionInput, TExpressionWithoutPosition, TExpressionUpdate } from "../expression-manager.js";
5
+ import type { TPremiseEngineSnapshot } from "../premise-engine.js";
6
+ /**
7
+ * Single-premise expression tree mutations.
8
+ */
9
+ export interface TExpressionMutations<TArg extends TCoreArgument = TCoreArgument, TPremise extends TCorePremise = TCorePremise, TExpr extends TCorePropositionalExpression = TCorePropositionalExpression, TVar extends TCorePropositionalVariable = TCorePropositionalVariable, TSource extends TCoreSource = TCoreSource> {
10
+ /**
11
+ * Adds an expression to this premise's tree.
12
+ *
13
+ * If the expression has `parentId: null` it becomes the root; only one
14
+ * root is permitted per premise. All structural rules (`implies`/`iff`
15
+ * root-only, child limits, position uniqueness) are enforced.
16
+ *
17
+ * @param expression - The expression to add, including position and
18
+ * parent assignment.
19
+ * @returns The added expression (with checksum) and changeset.
20
+ * @throws If the premise already has a root expression and this one is
21
+ * also a root.
22
+ * @throws If the expression's parent does not exist in this premise.
23
+ * @throws If the expression is a variable reference and the variable
24
+ * has not been registered.
25
+ */
26
+ addExpression(expression: TExpressionInput<TExpr>): TCoreMutationResult<TExpr, TExpr, TVar, TPremise, TArg, TSource>;
27
+ /**
28
+ * Adds an expression as the last child of the given parent, with
29
+ * position computed automatically. If `parentId` is `null`, the
30
+ * expression becomes the root.
31
+ *
32
+ * @param parentId - The parent expression ID, or `null` for root.
33
+ * @param expression - The expression to add (position is auto-assigned).
34
+ * @returns The added expression (with checksum) and changeset.
35
+ * @throws If the premise already has a root and `parentId` is `null`.
36
+ * @throws If the expression is a variable reference and the variable
37
+ * has not been registered.
38
+ */
39
+ appendExpression(parentId: string | null, expression: TExpressionWithoutPosition<TExpr>): TCoreMutationResult<TExpr, TExpr, TVar, TPremise, TArg, TSource>;
40
+ /**
41
+ * Adds an expression immediately before or after an existing sibling,
42
+ * with position computed automatically.
43
+ *
44
+ * @param siblingId - The ID of the existing sibling expression.
45
+ * @param relativePosition - Whether to insert `"before"` or `"after"`
46
+ * the sibling.
47
+ * @param expression - The expression to add (position is auto-assigned).
48
+ * @returns The added expression (with checksum) and changeset.
49
+ * @throws If the sibling does not exist in this premise.
50
+ * @throws If the expression is a variable reference and the variable
51
+ * has not been registered.
52
+ */
53
+ addExpressionRelative(siblingId: string, relativePosition: "before" | "after", expression: TExpressionWithoutPosition<TExpr>): TCoreMutationResult<TExpr, TExpr, TVar, TPremise, TArg, TSource>;
54
+ /**
55
+ * Updates mutable fields of an existing expression. Only `position`,
56
+ * `variableId`, and `operator` may be updated.
57
+ *
58
+ * @param expressionId - The ID of the expression to update.
59
+ * @param updates - The fields to update.
60
+ * @returns The updated expression and changeset.
61
+ * @throws If the expression does not exist in this premise.
62
+ * @throws If `variableId` references a non-existent variable.
63
+ */
64
+ updateExpression(expressionId: string, updates: TExpressionUpdate): TCoreMutationResult<TExpr, TExpr, TVar, TPremise, TArg, TSource>;
65
+ /**
66
+ * Removes an expression and optionally its entire descendant subtree,
67
+ * then collapses any ancestor operators with fewer than two children.
68
+ *
69
+ * @param expressionId - The ID of the expression to remove.
70
+ * @param deleteSubtree - Whether to remove all descendants as well.
71
+ * @returns The removed root expression, or `undefined` if not found.
72
+ */
73
+ removeExpression(expressionId: string, deleteSubtree: boolean): TCoreMutationResult<TExpr | undefined, TExpr, TVar, TPremise, TArg, TSource>;
74
+ /**
75
+ * Splices a new expression between existing nodes in the tree. The new
76
+ * expression inherits the tree slot of the anchor node
77
+ * (`leftNodeId ?? rightNodeId`).
78
+ *
79
+ * @param expression - The expression to insert, including position and
80
+ * parent assignment.
81
+ * @param leftNodeId - The existing node to become the left child of
82
+ * the new expression.
83
+ * @param rightNodeId - The existing node to become the right child of
84
+ * the new expression.
85
+ * @returns The inserted expression (with checksum) and changeset.
86
+ * @throws If the expression is a variable reference and the variable
87
+ * has not been registered.
88
+ */
89
+ insertExpression(expression: TExpressionInput<TExpr>, leftNodeId?: string, rightNodeId?: string): TCoreMutationResult<TExpr, TExpr, TVar, TPremise, TArg, TSource>;
90
+ /**
91
+ * Wraps an existing expression with a new operator and a new sibling
92
+ * in a single atomic operation.
93
+ *
94
+ * The operator takes the existing node's slot in the tree. Both the
95
+ * existing node and the new sibling become children of the operator.
96
+ * Exactly one of `leftNodeId` / `rightNodeId` must be provided — it
97
+ * identifies the existing node and which child slot it occupies.
98
+ *
99
+ * @param operator - The new operator expression to wrap with.
100
+ * @param newSibling - The new sibling expression to add alongside the
101
+ * existing node.
102
+ * @param leftNodeId - The existing node to place as the left child.
103
+ * @param rightNodeId - The existing node to place as the right child.
104
+ * @returns The inserted operator (with checksum) and changeset.
105
+ * @throws If the new sibling is a variable reference and the variable
106
+ * has not been registered.
107
+ */
108
+ wrapExpression(operator: TExpressionWithoutPosition<TExpr>, newSibling: TExpressionWithoutPosition<TExpr>, leftNodeId?: string, rightNodeId?: string): TCoreMutationResult<TExpr, TExpr, TVar, TPremise, TArg, TSource>;
109
+ /**
110
+ * Creates an association between a source and this expression within
111
+ * this premise.
112
+ *
113
+ * @param sourceId - The ID of the source.
114
+ * @param expressionId - The ID of the expression to associate.
115
+ * @returns The created association and changeset.
116
+ * @throws If the source does not exist.
117
+ * @throws If the expression does not exist in this premise.
118
+ * @throws If the association already exists.
119
+ */
120
+ addExpressionSourceAssociation(sourceId: string, expressionId: string): TCoreMutationResult<TCoreExpressionSourceAssociation, TExpr, TVar, TPremise, TArg, TSource>;
121
+ /**
122
+ * Removes an expression–source association by its own ID.
123
+ *
124
+ * @param associationId - The ID of the association to remove.
125
+ * @returns The removed association, or `undefined` if not found.
126
+ */
127
+ removeExpressionSourceAssociation(associationId: string): TCoreMutationResult<TCoreExpressionSourceAssociation | undefined, TExpr, TVar, TPremise, TArg, TSource>;
128
+ /**
129
+ * Returns all source associations for a given expression in this
130
+ * premise.
131
+ *
132
+ * @param expressionId - The expression ID to look up.
133
+ * @returns An array of expression–source associations.
134
+ */
135
+ getSourceAssociationsForExpression(expressionId: string): TCoreExpressionSourceAssociation[];
136
+ }
137
+ /**
138
+ * Single-premise expression tree reads.
139
+ */
140
+ export interface TExpressionQueries<TExpr extends TCorePropositionalExpression = TCorePropositionalExpression> {
141
+ /**
142
+ * Returns an expression by ID, or `undefined` if not found in this
143
+ * premise.
144
+ *
145
+ * @param id - The expression ID to look up.
146
+ * @returns The expression entity, or `undefined`.
147
+ */
148
+ getExpression(id: string): TExpr | undefined;
149
+ /**
150
+ * Returns the ID of the root expression, or `undefined` if the premise
151
+ * is empty.
152
+ *
153
+ * @returns The root expression ID, or `undefined`.
154
+ */
155
+ getRootExpressionId(): string | undefined;
156
+ /**
157
+ * Returns the root expression, or `undefined` if the premise is empty.
158
+ *
159
+ * @returns The root expression entity, or `undefined`.
160
+ */
161
+ getRootExpression(): TExpr | undefined;
162
+ /**
163
+ * Returns all expressions in this premise.
164
+ *
165
+ * @returns An array of expression entities.
166
+ */
167
+ getExpressions(): TExpr[];
168
+ /**
169
+ * Returns the child expressions of the given parent, sorted by
170
+ * position.
171
+ *
172
+ * @param parentId - The parent expression ID, or `null` for root-level
173
+ * children.
174
+ * @returns An array of child expression entities.
175
+ */
176
+ getChildExpressions(parentId: string | null): TExpr[];
177
+ }
178
+ /**
179
+ * Variable reference queries and cascade deletion.
180
+ */
181
+ export interface TVariableReferences<TArg extends TCoreArgument = TCoreArgument, TPremise extends TCorePremise = TCorePremise, TExpr extends TCorePropositionalExpression = TCorePropositionalExpression, TVar extends TCorePropositionalVariable = TCorePropositionalVariable, TSource extends TCoreSource = TCoreSource> {
182
+ /**
183
+ * Returns all argument-level variables (from the shared
184
+ * VariableManager) sorted by ID. Since the VariableManager is shared
185
+ * across all premises, this returns every registered variable — not
186
+ * just those referenced by expressions in this premise.
187
+ *
188
+ * @returns An array of variable entities.
189
+ */
190
+ getVariables(): TVar[];
191
+ /**
192
+ * Returns the set of variable IDs referenced by expressions in this
193
+ * premise. Only variables that appear in `type: "variable"` expression
194
+ * nodes are included.
195
+ *
196
+ * @returns A Set of referenced variable ID strings.
197
+ */
198
+ getReferencedVariableIds(): Set<string>;
199
+ /**
200
+ * Deletes all expressions that reference the given variable ID,
201
+ * including their subtrees. Operator collapse runs after each removal.
202
+ *
203
+ * @param variableId - The variable ID whose referencing expressions
204
+ * should be removed.
205
+ * @returns The removed expressions and changeset.
206
+ */
207
+ deleteExpressionsUsingVariable(variableId: string): TCoreMutationResult<TExpr[], TExpr, TVar, TPremise, TArg, TSource>;
208
+ }
209
+ /**
210
+ * Premise type classification (inference vs constraint).
211
+ */
212
+ export interface TPremiseClassification {
213
+ /**
214
+ * Returns `true` if the root expression is an `implies` or `iff`
215
+ * operator, meaning this premise expresses a logical inference
216
+ * relationship.
217
+ *
218
+ * @returns Whether this premise is an inference.
219
+ */
220
+ isInference(): boolean;
221
+ /**
222
+ * Returns `true` if this premise does not have an inference operator at
223
+ * its root. Equivalent to `!isInference()`.
224
+ *
225
+ * @returns Whether this premise is a constraint.
226
+ */
227
+ isConstraint(): boolean;
228
+ }
229
+ /**
230
+ * Premise-level evaluation: single-assignment evaluation and evaluability
231
+ * validation.
232
+ */
233
+ export interface TPremiseEvaluation {
234
+ /**
235
+ * Validates that this premise is structurally ready for evaluation.
236
+ *
237
+ * @returns A validation result with any issues found.
238
+ */
239
+ validateEvaluability(): TCoreValidationResult;
240
+ /**
241
+ * Evaluates the premise under a three-valued expression assignment.
242
+ *
243
+ * Variable values are looked up using Kleene three-valued logic
244
+ * (`null` = unknown). Missing variables default to `null`. For
245
+ * inference premises (`implies`/`iff`), an `inferenceDiagnostic` is
246
+ * computed with three-valued fields unless the root is rejected.
247
+ *
248
+ * @param assignment - The variable assignment and optional rejected
249
+ * expression IDs.
250
+ * @param options - Optional evaluation options.
251
+ * @param options.strictUnknownKeys - If `true`, unknown variable keys
252
+ * in the assignment cause an error.
253
+ * @param options.requireExactCoverage - If `true`, the assignment must
254
+ * cover exactly the referenced variables.
255
+ * @returns The premise evaluation result.
256
+ */
257
+ evaluate(assignment: TCoreExpressionAssignment, options?: {
258
+ strictUnknownKeys?: boolean;
259
+ requireExactCoverage?: boolean;
260
+ }): TCorePremiseEvaluationResult;
261
+ }
262
+ /**
263
+ * Premise snapshot and mutation callback lifecycle.
264
+ * Static fromSnapshot factory is class-level only.
265
+ */
266
+ export interface TPremiseLifecycle<TPremise extends TCorePremise = TCorePremise, TExpr extends TCorePropositionalExpression = TCorePropositionalExpression> {
267
+ /**
268
+ * Returns a serializable snapshot of the premise's owned state.
269
+ *
270
+ * @returns The premise engine snapshot.
271
+ */
272
+ snapshot(): TPremiseEngineSnapshot<TPremise, TExpr>;
273
+ /**
274
+ * Sets a callback invoked after every mutation, or `undefined` to
275
+ * clear.
276
+ *
277
+ * @param callback - The mutation callback, or `undefined` to remove.
278
+ */
279
+ setOnMutate(callback: (() => void) | undefined): void;
280
+ /**
281
+ * Invalidates the cached checksum so the next call recomputes it.
282
+ */
283
+ markDirty(): void;
284
+ }
285
+ /**
286
+ * Premise entity identity and metadata access.
287
+ */
288
+ export interface TPremiseIdentity<TArg extends TCoreArgument = TCoreArgument, TPremise extends TCorePremise = TCorePremise, TExpr extends TCorePropositionalExpression = TCorePropositionalExpression, TVar extends TCorePropositionalVariable = TCorePropositionalVariable, TSource extends TCoreSource = TCoreSource> {
289
+ /**
290
+ * Returns the premise ID.
291
+ *
292
+ * @returns The premise ID string.
293
+ */
294
+ getId(): string;
295
+ /**
296
+ * Returns a serializable premise representation containing only
297
+ * identity/metadata and checksum. Use `getRootExpressionId()`,
298
+ * `getExpressions()`, `getReferencedVariableIds()` for runtime state.
299
+ *
300
+ * @returns The premise data entity.
301
+ */
302
+ toPremiseData(): TPremise;
303
+ /**
304
+ * Returns the premise's extra metadata record.
305
+ *
306
+ * @returns The extras record.
307
+ */
308
+ getExtras(): Record<string, unknown>;
309
+ /**
310
+ * Replaces the premise's extra metadata record.
311
+ *
312
+ * @param extras - The new extras record.
313
+ * @returns The previous extras record and changeset.
314
+ */
315
+ setExtras(extras: Record<string, unknown>): TCoreMutationResult<Record<string, unknown>, TExpr, TVar, TPremise, TArg, TSource>;
316
+ }
317
+ //# sourceMappingURL=premise-engine.interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"premise-engine.interfaces.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/interfaces/premise-engine.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,aAAa,EACb,YAAY,EACZ,4BAA4B,EAC5B,0BAA0B,EAC1B,WAAW,EACX,gCAAgC,EACnC,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EACR,yBAAyB,EACzB,4BAA4B,EAC5B,qBAAqB,EACxB,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,KAAK,EACR,gBAAgB,EAChB,0BAA0B,EAC1B,iBAAiB,EACpB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAElE;;GAEG;AACH,MAAM,WAAW,oBAAoB,CACjC,IAAI,SAAS,aAAa,GAAG,aAAa,EAC1C,QAAQ,SAAS,YAAY,GAAG,YAAY,EAC5C,KAAK,SAAS,4BAA4B,GAAG,4BAA4B,EACzE,IAAI,SAAS,0BAA0B,GAAG,0BAA0B,EACpE,OAAO,SAAS,WAAW,GAAG,WAAW;IAEzC;;;;;;;;;;;;;;;OAeG;IACH,aAAa,CACT,UAAU,EAAE,gBAAgB,CAAC,KAAK,CAAC,GACpC,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IACnE;;;;;;;;;;;OAWG;IACH,gBAAgB,CACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,UAAU,EAAE,0BAA0B,CAAC,KAAK,CAAC,GAC9C,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IACnE;;;;;;;;;;;;OAYG;IACH,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AC,CAAA;IACpC;;;;;OAKG;IACH,SAAS,CACL,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,mBAAmB,CAClB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvB,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,OAAO,CACV,CAAA;CACJ"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=premise-engine.interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"premise-engine.interfaces.js","sourceRoot":"","sources":["../../../../src/lib/core/interfaces/premise-engine.interfaces.ts"],"names":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * An entity that can produce a human-readable display string.
3
+ */
4
+ export interface TDisplayable {
5
+ /**
6
+ * Renders the entity as a human-readable string.
7
+ *
8
+ * @returns A human-readable display string.
9
+ */
10
+ toDisplayString(): string;
11
+ }
12
+ /**
13
+ * An entity that can produce a deterministic content checksum.
14
+ */
15
+ export interface TChecksummable {
16
+ /**
17
+ * Returns a deterministic content checksum. Computed lazily — only
18
+ * recalculated when state has changed.
19
+ *
20
+ * @returns A hex-encoded checksum string.
21
+ */
22
+ checksum(): string;
23
+ }
24
+ //# sourceMappingURL=shared.interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.interfaces.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/interfaces/shared.interfaces.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;;;OAIG;IACH,eAAe,IAAI,MAAM,CAAA;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B;;;;;OAKG;IACH,QAAQ,IAAI,MAAM,CAAA;CACrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=shared.interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.interfaces.js","sourceRoot":"","sources":["../../../../src/lib/core/interfaces/shared.interfaces.ts"],"names":[],"mappings":""}
@@ -0,0 +1,110 @@
1
+ import type { TCoreArgument, TCorePremise, TCorePropositionalExpression, TCorePropositionalVariable, TOptionalChecksum, TCoreSource, TCoreVariableSourceAssociation, TCoreExpressionSourceAssociation } from "../../schemata/index.js";
2
+ import type { TCoreMutationResult } from "../../types/mutation.js";
3
+ /**
4
+ * Source CRUD, association management, and lookup for an argument.
5
+ */
6
+ export interface TSourceManagement<TArg extends TCoreArgument = TCoreArgument, TPremise extends TCorePremise = TCorePremise, TExpr extends TCorePropositionalExpression = TCorePropositionalExpression, TVar extends TCorePropositionalVariable = TCorePropositionalVariable, TSource extends TCoreSource = TCoreSource> {
7
+ /**
8
+ * Registers a new source with this argument.
9
+ *
10
+ * @param source - The source entity to add, with optional checksum.
11
+ * @returns The added source (with checksum) and changeset.
12
+ * @throws If a source with the given ID already exists.
13
+ */
14
+ addSource(source: TOptionalChecksum<TSource>): TCoreMutationResult<TSource, TExpr, TVar, TPremise, TArg, TSource>;
15
+ /**
16
+ * Removes a source and any associations referencing it.
17
+ *
18
+ * @param sourceId - The ID of the source to remove.
19
+ * @returns The removed source, or `undefined` if not found.
20
+ */
21
+ removeSource(sourceId: string): TCoreMutationResult<TSource | undefined, TExpr, TVar, TPremise, TArg, TSource>;
22
+ /**
23
+ * Creates an association between a source and a variable.
24
+ *
25
+ * @param sourceId - The ID of the source.
26
+ * @param variableId - The ID of the variable to associate.
27
+ * @returns The created association and changeset.
28
+ * @throws If the source does not exist.
29
+ * @throws If the variable does not exist.
30
+ * @throws If the association already exists.
31
+ */
32
+ addVariableSourceAssociation(sourceId: string, variableId: string): TCoreMutationResult<TCoreVariableSourceAssociation, TExpr, TVar, TPremise, TArg, TSource>;
33
+ /**
34
+ * Removes a variable–source association by its own ID.
35
+ *
36
+ * @param associationId - The ID of the association to remove.
37
+ * @returns The removed association, or `undefined` if not found.
38
+ */
39
+ removeVariableSourceAssociation(associationId: string): TCoreMutationResult<TCoreVariableSourceAssociation | undefined, TExpr, TVar, TPremise, TArg, TSource>;
40
+ /**
41
+ * Creates an association between a source and an expression within a
42
+ * specific premise.
43
+ *
44
+ * @param sourceId - The ID of the source.
45
+ * @param expressionId - The ID of the expression to associate.
46
+ * @param premiseId - The ID of the premise that owns the expression.
47
+ * @returns The created association and changeset.
48
+ * @throws If the source does not exist.
49
+ * @throws If the expression does not exist in the specified premise.
50
+ * @throws If the association already exists.
51
+ */
52
+ addExpressionSourceAssociation(sourceId: string, expressionId: string, premiseId: string): TCoreMutationResult<TCoreExpressionSourceAssociation, TExpr, TVar, TPremise, TArg, TSource>;
53
+ /**
54
+ * Removes an expression–source association by its own ID.
55
+ *
56
+ * @param associationId - The ID of the association to remove.
57
+ * @returns The removed association, or `undefined` if not found.
58
+ */
59
+ removeExpressionSourceAssociation(associationId: string): TCoreMutationResult<TCoreExpressionSourceAssociation | undefined, TExpr, TVar, TPremise, TArg, TSource>;
60
+ /**
61
+ * Returns all registered sources sorted by ID.
62
+ *
63
+ * @returns An array of source entities.
64
+ */
65
+ getSources(): TSource[];
66
+ /**
67
+ * Returns the source with the given ID, or `undefined` if not found.
68
+ *
69
+ * @param sourceId - The source ID to look up.
70
+ * @returns The source entity, or `undefined`.
71
+ */
72
+ getSource(sourceId: string): TSource | undefined;
73
+ /**
74
+ * Returns all variable and expression associations for a given source.
75
+ *
76
+ * @param sourceId - The source ID to look up.
77
+ * @returns An object with `variable` and `expression` association arrays.
78
+ */
79
+ getAssociationsForSource(sourceId: string): {
80
+ variable: TCoreVariableSourceAssociation[];
81
+ expression: TCoreExpressionSourceAssociation[];
82
+ };
83
+ /**
84
+ * Returns all source associations for a given variable.
85
+ *
86
+ * @param variableId - The variable ID to look up.
87
+ * @returns An array of variable–source associations.
88
+ */
89
+ getAssociationsForVariable(variableId: string): TCoreVariableSourceAssociation[];
90
+ /**
91
+ * Returns all source associations for a given expression.
92
+ *
93
+ * @param expressionId - The expression ID to look up.
94
+ * @returns An array of expression–source associations.
95
+ */
96
+ getAssociationsForExpression(expressionId: string): TCoreExpressionSourceAssociation[];
97
+ /**
98
+ * Returns all variable–source associations across the argument.
99
+ *
100
+ * @returns An array of all variable–source association entities.
101
+ */
102
+ getAllVariableSourceAssociations(): TCoreVariableSourceAssociation[];
103
+ /**
104
+ * Returns all expression–source associations across the argument.
105
+ *
106
+ * @returns An array of all expression–source association entities.
107
+ */
108
+ getAllExpressionSourceAssociations(): TCoreExpressionSourceAssociation[];
109
+ }
110
+ //# sourceMappingURL=source-management.interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-management.interfaces.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/interfaces/source-management.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,aAAa,EACb,YAAY,EACZ,4BAA4B,EAC5B,0BAA0B,EAC1B,iBAAiB,EACjB,WAAW,EACX,8BAA8B,EAC9B,gCAAgC,EACnC,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAElE;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAC9B,IAAI,SAAS,aAAa,GAAG,aAAa,EAC1C,QAAQ,SAAS,YAAY,GAAG,YAAY,EAC5C,KAAK,SAAS,4BAA4B,GAAG,4BAA4B,EACzE,IAAI,SAAS,0BAA0B,GAAG,0BAA0B,EACpE,OAAO,SAAS,WAAW,GAAG,WAAW;IAEzC;;;;;;OAMG;IACH,SAAS,CACL,MAAM,EAAE,iBAAiB,CAAC,OAAO,CAAC,GACnC,mBAAmB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IAErE;;;;;OAKG;IACH,YAAY,CACR,QAAQ,EAAE,MAAM,GACjB,mBAAmB,CAClB,OAAO,GAAG,SAAS,EACnB,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,OAAO,CACV,CAAA;IAED;;;;;;;;;OASG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CAAkC,IAAI,gCAAgC,EAAE,CAAA;CAC3E"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=source-management.interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-management.interfaces.js","sourceRoot":"","sources":["../../../../src/lib/core/interfaces/source-management.interfaces.ts"],"names":[],"mappings":""}