@rsconcept/rstool 1.2.2 → 1.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.
- package/README.md +4 -4
- package/dist/{agent-workflow-Gk0Vfnv1.d.ts → agent-workflow-D22FeODL.d.ts} +6 -6
- package/dist/{analysis-LLnPhmGa.d.ts → analysis-DA44pfgA.d.ts} +4 -3
- package/dist/common-D6TFl6l_.d.ts +11 -0
- package/dist/{constituenta-DnGR6bnM.d.ts → constituenta-QY5w1x91.d.ts} +7 -7
- package/dist/diagnostic-C6TRoBgt.d.ts +38 -0
- package/dist/diagnostic-assembly-DRunIcKQ.js +54 -0
- package/dist/diagnostic-assembly-DRunIcKQ.js.map +1 -0
- package/dist/{evaluation-Cns8BFm4.d.ts → evaluation-Cd4S7-3t.d.ts} +4 -3
- package/dist/index.d.ts +12 -12
- package/dist/index.js +4 -3
- package/dist/mappers/model-adapter.d.ts +3 -3
- package/dist/mappers/model-adapter.js +1 -199
- package/dist/mappers/schema-adapter.d.ts +5 -5
- package/dist/mappers/schema-adapter.js +8 -8
- package/dist/mappers/schema-adapter.js.map +1 -1
- package/dist/mappers/types.d.ts +6 -6
- package/dist/mappers/types.js +6 -10
- package/dist/mappers/types.js.map +1 -1
- package/dist/model-adapter-D-YmIvQW.js +225 -0
- package/dist/model-adapter-D-YmIvQW.js.map +1 -0
- package/dist/{model-value-BbonPzMz.d.ts → model-value-BUhr2IjA.d.ts} +2 -2
- package/dist/models/agent-workflow.d.ts +1 -1
- package/dist/models/analysis.d.ts +1 -1
- package/dist/models/common.d.ts +2 -2
- package/dist/models/common.js +1 -1
- package/dist/models/constituenta.d.ts +1 -1
- package/dist/models/diagnostic.d.ts +2 -2
- package/dist/models/diagnostic.js +3 -1
- package/dist/models/evaluation.d.ts +1 -1
- package/dist/models/index.d.ts +11 -11
- package/dist/models/index.js +3 -2
- package/dist/models/model-value.d.ts +1 -1
- package/dist/models/rstool-agent.d.ts +1 -1
- package/dist/models/rstool-agent.js +1 -1
- package/dist/models/session.d.ts +1 -1
- package/dist/models/tool-contract.d.ts +1 -1
- package/dist/models/tool-contract.js +1 -1
- package/dist/models/tool-contract.js.map +1 -1
- package/dist/{models-9G6ur_pg.js → models-DTLctDmB.js} +72 -15
- package/dist/models-DTLctDmB.js.map +1 -0
- package/dist/{rstool-agent-D2cQze_b.d.ts → rstool-agent-BMVAyMAG.d.ts} +11 -10
- package/dist/session/session-store.d.ts +6 -6
- package/dist/session/session-store.js +1 -1
- package/dist/{session-ChexW8i7.d.ts → session-CI4rLYby.d.ts} +3 -3
- package/dist/{tool-contract-0uRGhEfW.d.ts → tool-contract-sQfr-DYD.d.ts} +12 -12
- package/dist/wrapper/stdio-wrapper.js +1 -1
- package/docs/BASE-SELECTION.md +92 -0
- package/docs/CONCEPTUAL-SCHEMA.md +20 -15
- package/docs/CONSTITUENTA.md +3 -3
- package/docs/DIAGNOSTICS.md +63 -20
- package/docs/DOMAIN.md +27 -21
- package/docs/README.md +1 -0
- package/docs/SYNTAX.md +3 -2
- package/docs/TYPIFICATION.md +3 -9
- package/examples/README.md +2 -0
- package/examples/agent-client.ts +15 -3
- package/examples/audit-diagnostics.ts +40 -0
- package/examples/chocolate-nim/build-rsform.ts +15 -0
- package/examples/chocolate-nim/build-rsmodel.ts +15 -22
- package/examples/chocolate-nim/model-demo.ts +11 -0
- package/examples/chocolate-nim/rsform-session.json +329 -310
- package/examples/chocolate-nim/rsmodel-session.json +311 -311
- package/examples/diagnostics-utils.ts +25 -0
- package/examples/expression-bank/bank-constituents.ts +10 -10
- package/examples/expression-bank/build-rsform.ts +8 -0
- package/examples/expression-bank/rsform-session.json +1501 -1501
- package/examples/kinship/build-rsform.ts +16 -1
- package/examples/kinship/build-rsmodel.ts +15 -56
- package/examples/kinship/model-demo.ts +35 -0
- package/examples/kinship/rsform-session.json +300 -215
- package/examples/kinship/rsmodel-session.json +216 -216
- package/examples/movd/build-rsform.ts +15 -0
- package/examples/movd/build-rsmodel.ts +15 -46
- package/examples/movd/model-demo.ts +31 -0
- package/examples/movd/rsform-session.json +359 -270
- package/examples/movd/rsmodel-session.json +263 -263
- package/examples/sample/build-rsform.ts +43 -3
- package/examples/sample/build-rsmodel.ts +26 -2
- package/examples/sample/rsform-session.json +41 -12
- package/examples/sample/rsmodel-session.json +37 -37
- package/examples/template-apply/build-rsform.ts +26 -9
- package/examples/template-apply/rsform-session.json +100 -45
- package/package.json +3 -2
- package/skills/rstool-helper/EXAMPLES.md +22 -1
- package/skills/rstool-helper/GUIDE.md +23 -28
- package/skills/rstool-helper/REFERENCE.md +28 -23
- package/src/index.ts +7 -4
- package/src/mappers/diagnostic-assembly.ts +96 -0
- package/src/mappers/diagnostics-collector.test.ts +63 -0
- package/src/mappers/diagnostics-collector.ts +73 -0
- package/src/mappers/model-adapter.ts +28 -99
- package/src/mappers/rsform-builder.ts +127 -0
- package/src/mappers/schema-adapter.ts +19 -15
- package/src/mappers/types.ts +12 -12
- package/src/models/agent-workflow.ts +2 -2
- package/src/models/analysis.ts +3 -2
- package/src/models/common.ts +0 -12
- package/src/models/constituenta.ts +4 -4
- package/src/models/diagnostic.ts +15 -10
- package/src/models/evaluation.ts +3 -8
- package/src/models/index.ts +8 -2
- package/src/models/rstool-agent.test.ts +66 -5
- package/src/models/rstool-agent.ts +22 -10
- package/src/models/tool-contract.ts +4 -4
- package/src/session/persistence.ts +2 -2
- package/src/session/session-store.ts +14 -7
- package/dist/common-DHJalS-Q.d.ts +0 -22
- package/dist/diagnostic-D9yl_mEL.d.ts +0 -19
- package/dist/mappers/model-adapter.js.map +0 -1
- package/dist/models-9G6ur_pg.js.map +0 -1
package/dist/mappers/types.js
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
|
+
import { r as expressionDiagnostic } from "../diagnostic-assembly-DRunIcKQ.js";
|
|
1
2
|
//#region src/mappers/types.ts
|
|
2
3
|
/** Map a domain parser/semantic error to the public diagnostic shape. */
|
|
3
|
-
function
|
|
4
|
-
return
|
|
5
|
-
code: error.code,
|
|
6
|
-
from: error.from,
|
|
7
|
-
to: error.to,
|
|
8
|
-
params: error.params
|
|
9
|
-
};
|
|
4
|
+
function toDiagnostic(error, expression, target) {
|
|
5
|
+
return expressionDiagnostic(error, expression, target);
|
|
10
6
|
}
|
|
11
7
|
/** Map a domain analysis result to the public {@link AnalysisResult} shape. */
|
|
12
|
-
function toPublicAnalysis(analysis) {
|
|
8
|
+
function toPublicAnalysis(analysis, expression, target) {
|
|
13
9
|
return {
|
|
14
10
|
success: analysis.success,
|
|
15
11
|
type: analysis.type,
|
|
16
12
|
valueClass: analysis.valueClass,
|
|
17
|
-
diagnostics: analysis.errors.map(
|
|
13
|
+
diagnostics: analysis.errors.map((error) => expressionDiagnostic(error, expression, target))
|
|
18
14
|
};
|
|
19
15
|
}
|
|
20
16
|
//#endregion
|
|
21
|
-
export {
|
|
17
|
+
export { toDiagnostic, toPublicAnalysis };
|
|
22
18
|
|
|
23
19
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/mappers/types.ts"],"sourcesContent":["import { type ValueClass } from '@rsconcept/domain/rslang';\n\nimport { type AnalysisResult, type
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/mappers/types.ts"],"sourcesContent":["import { DiagnosticKind, type DiagnosticTarget, expressionDiagnostic } from './diagnostic-assembly';\nimport { type RSErrorDescription, type ValueClass } from '@rsconcept/domain/rslang';\n\nimport { type AnalysisResult, type Diagnostic } from '../models';\n\n/** Minimal domain error shape before mapping to {@link Diagnostic}. */\nexport interface DomainErrorLike {\n code: number;\n from: number;\n to: number;\n params?: readonly string[];\n}\n\n/** Minimal domain analysis shape before mapping to {@link AnalysisResult}. */\nexport interface DomainAnalysisLike {\n success: boolean;\n type: Record<string, unknown> | null;\n valueClass: ValueClass | null;\n errors: DomainErrorLike[];\n}\n\n/** Map a domain parser/semantic error to the public diagnostic shape. */\nexport function toDiagnostic(error: DomainErrorLike, expression: string, target?: DiagnosticTarget): Diagnostic {\n return expressionDiagnostic(error as RSErrorDescription, expression, target);\n}\n\n/** Map a domain analysis result to the public {@link AnalysisResult} shape. */\nexport function toPublicAnalysis(\n analysis: DomainAnalysisLike,\n expression: string,\n target?: DiagnosticTarget\n): AnalysisResult {\n return {\n success: analysis.success,\n type: analysis.type,\n valueClass: analysis.valueClass,\n diagnostics: analysis.errors.map(error => expressionDiagnostic(error as RSErrorDescription, expression, target))\n };\n}\n"],"mappings":";;;AAsBA,SAAgB,aAAa,OAAwB,YAAoB,QAAuC;CAC9G,OAAO,qBAAqB,OAA6B,YAAY,MAAM;AAC7E;;AAGA,SAAgB,iBACd,UACA,YACA,QACgB;CAChB,OAAO;EACL,SAAS,SAAS;EAClB,MAAM,SAAS;EACf,YAAY,SAAS;EACrB,aAAa,SAAS,OAAO,KAAI,UAAS,qBAAqB,OAA6B,YAAY,MAAM,CAAC;CACjH;AACF"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { r as expressionDiagnostic, t as DiagnosticKind } from "./diagnostic-assembly-DRunIcKQ.js";
|
|
2
|
+
import { assignSchemaDiagnostics } from "@rsconcept/domain/library";
|
|
3
|
+
import { CstType } from "@rsconcept/domain/library/rsform";
|
|
4
|
+
import { EvalStatus } from "@rsconcept/domain/library/rsmodel";
|
|
5
|
+
import { RSLangAnalyzer } from "@rsconcept/domain/rslang";
|
|
6
|
+
import { isInferrable, isInterpretable, toBasicBinding, validateBasicBindingData, validateValueData } from "@rsconcept/domain/library/rsmodel-api";
|
|
7
|
+
import { isBaseSet, normalizeExpression } from "@rsconcept/domain/library/rsform-api";
|
|
8
|
+
import { RSEngine } from "@rsconcept/domain/library/rsengine";
|
|
9
|
+
import { Graph } from "@rsconcept/domain/graph/graph";
|
|
10
|
+
import { extractGlobals } from "@rsconcept/domain/rslang/api";
|
|
11
|
+
//#region src/mappers/rsform-builder.ts
|
|
12
|
+
/** Build a domain {@link RSForm} view from session state (same shape as Portal loader output). */
|
|
13
|
+
function buildRSFormFromSession(session) {
|
|
14
|
+
const graph = new Graph();
|
|
15
|
+
const cstByAlias = /* @__PURE__ */ new Map();
|
|
16
|
+
const cstByID = /* @__PURE__ */ new Map();
|
|
17
|
+
const analyzer = new RSLangAnalyzer();
|
|
18
|
+
const items = session.items.map((item) => {
|
|
19
|
+
const cst = toFrontendConstituenta(item);
|
|
20
|
+
cstByAlias.set(cst.alias, cst);
|
|
21
|
+
cstByID.set(cst.id, cst);
|
|
22
|
+
graph.addNode(cst.id);
|
|
23
|
+
if (item.cstType === CstType.BASE) analyzer.addBase(cst.alias);
|
|
24
|
+
if (cst.effectiveType) analyzer.setGlobal(cst.alias, cst.effectiveType, cst.analysis.valueClass);
|
|
25
|
+
return cst;
|
|
26
|
+
});
|
|
27
|
+
for (const cst of items) for (const alias of extractGlobals(cst.definition_formal)) {
|
|
28
|
+
const source = cstByAlias.get(alias);
|
|
29
|
+
if (source) graph.addEdge(source.id, cst.id);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
id: 0,
|
|
33
|
+
items,
|
|
34
|
+
cstByAlias,
|
|
35
|
+
cstByID,
|
|
36
|
+
graph,
|
|
37
|
+
analyzer,
|
|
38
|
+
inheritance: [],
|
|
39
|
+
attribution: [],
|
|
40
|
+
attribution_graph: graph.clone(),
|
|
41
|
+
oss: [],
|
|
42
|
+
models: [],
|
|
43
|
+
editors: [],
|
|
44
|
+
versions: [],
|
|
45
|
+
is_produced: false,
|
|
46
|
+
is_attributive: false,
|
|
47
|
+
version: "latest"
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/** Enrich session constituents with Portal-style schema metadata used for diagnostics. */
|
|
51
|
+
function enrichSessionConstituents(session) {
|
|
52
|
+
const schema = buildRSFormFromSession(session);
|
|
53
|
+
const normalizedDefinitions = /* @__PURE__ */ new Map();
|
|
54
|
+
const resolveAlias = (id) => schema.cstByID.get(id)?.alias ?? String(id);
|
|
55
|
+
for (const item of session.items) {
|
|
56
|
+
const normalized = normalizeExpression(item.definitionFormal, item.cstType);
|
|
57
|
+
if (normalized) normalizedDefinitions.set(item.id, normalized);
|
|
58
|
+
}
|
|
59
|
+
assignSchemaDiagnostics(schema.items, resolveAlias, normalizedDefinitions);
|
|
60
|
+
return session.items.map((item) => ({
|
|
61
|
+
item,
|
|
62
|
+
cst: schema.cstByID.get(item.id)
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
function toFrontendConstituenta(item) {
|
|
66
|
+
const effectiveType = item.analysis.type ?? null;
|
|
67
|
+
return {
|
|
68
|
+
id: item.id,
|
|
69
|
+
alias: item.alias,
|
|
70
|
+
cst_type: item.cstType,
|
|
71
|
+
definition_formal: item.definitionFormal,
|
|
72
|
+
definition_raw: item.definitionFormal,
|
|
73
|
+
definition_resolved: item.definitionFormal,
|
|
74
|
+
term_raw: item.term,
|
|
75
|
+
term_resolved: item.term,
|
|
76
|
+
term_forms: [],
|
|
77
|
+
convention: item.convention,
|
|
78
|
+
typification_manual: "",
|
|
79
|
+
value_is_property: false,
|
|
80
|
+
crucial: false,
|
|
81
|
+
attributes: [],
|
|
82
|
+
diagnostics: [],
|
|
83
|
+
analysis: {
|
|
84
|
+
success: item.analysis.success,
|
|
85
|
+
type: effectiveType,
|
|
86
|
+
valueClass: item.analysis.valueClass
|
|
87
|
+
},
|
|
88
|
+
effectiveType,
|
|
89
|
+
is_type_mismatch: false,
|
|
90
|
+
schema: 0,
|
|
91
|
+
cst_class: "derived",
|
|
92
|
+
status: item.analysis.success ? "verified" : "incorrect",
|
|
93
|
+
is_template: false,
|
|
94
|
+
is_simple_expression: true,
|
|
95
|
+
parent_schema_index: 0,
|
|
96
|
+
parent_schema: null,
|
|
97
|
+
is_inherited: false,
|
|
98
|
+
has_inherited_children: false,
|
|
99
|
+
spawn: [],
|
|
100
|
+
spawn_alias: []
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/mappers/model-adapter.ts
|
|
105
|
+
const SESSION_MODEL_ID = 0;
|
|
106
|
+
var ModelAdapter = class {
|
|
107
|
+
async setConstituentaValue(session, input) {
|
|
108
|
+
this.validateSetInput(session, input);
|
|
109
|
+
const engine = this.createEngine(session);
|
|
110
|
+
const frontendType = session.items.find((item) => item.id === input.target).cstType;
|
|
111
|
+
if (isBaseSet(frontendType)) {
|
|
112
|
+
const binding = toBasicBinding(input.value);
|
|
113
|
+
await engine.setBasicValue(input.target, binding);
|
|
114
|
+
} else await engine.setStructureValue(input.target, input.value);
|
|
115
|
+
session.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
116
|
+
return structuredClone(session.model);
|
|
117
|
+
}
|
|
118
|
+
async setConstituentaValues(session, input) {
|
|
119
|
+
for (const item of input.items) await this.setConstituentaValue(session, item);
|
|
120
|
+
return structuredClone(session.model);
|
|
121
|
+
}
|
|
122
|
+
async clearConstituentaValues(session, ids) {
|
|
123
|
+
const engine = this.createEngine(session);
|
|
124
|
+
for (const id of ids) {
|
|
125
|
+
await engine.resetValue(id);
|
|
126
|
+
session.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
127
|
+
}
|
|
128
|
+
return structuredClone(session.model);
|
|
129
|
+
}
|
|
130
|
+
evaluateExpression(session, expression, cstType) {
|
|
131
|
+
const result = this.createEngine(session).evaluateExpression(expression, cstType);
|
|
132
|
+
const status = result.value === null ? result.errors.length > 0 ? EvalStatus.EVAL_FAIL : EvalStatus.EMPTY : EvalStatus.HAS_DATA;
|
|
133
|
+
return toPublicEvaluationResult(result.value, result.errors, result.iterations, result.cacheHits, status, expression);
|
|
134
|
+
}
|
|
135
|
+
evaluateConstituenta(session, constituentId) {
|
|
136
|
+
const cst = session.items.find((item) => item.id === constituentId);
|
|
137
|
+
if (!cst) throw new Error(`Unknown constituent: ${constituentId}`);
|
|
138
|
+
const engine = this.createEngine(session);
|
|
139
|
+
const result = engine.calculateCst(constituentId);
|
|
140
|
+
const status = engine.getCstStatus(constituentId);
|
|
141
|
+
return toPublicEvaluationResult(result.value, result.errors, result.iterations, result.cacheHits, status, cst.definitionFormal, {
|
|
142
|
+
constituentId: cst.id,
|
|
143
|
+
alias: cst.alias
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
recalculateModel(session) {
|
|
147
|
+
const engine = this.createEngine(session);
|
|
148
|
+
engine.recalculateAll();
|
|
149
|
+
return { items: session.items.map((item) => ({
|
|
150
|
+
id: item.id,
|
|
151
|
+
alias: item.alias,
|
|
152
|
+
value: engine.getCstValue(item.id),
|
|
153
|
+
status: engine.getCstStatus(item.id)
|
|
154
|
+
})) };
|
|
155
|
+
}
|
|
156
|
+
createEngine(session) {
|
|
157
|
+
const schema = buildRSFormFromSession(session);
|
|
158
|
+
const model = buildRSModelFromSession(session);
|
|
159
|
+
const engine = new RSEngine(SESSION_MODEL_ID, createInMemoryServices(session));
|
|
160
|
+
engine.loadData(schema, model);
|
|
161
|
+
return engine;
|
|
162
|
+
}
|
|
163
|
+
validateSetInput(session, input) {
|
|
164
|
+
const cst = session.items.find((item) => item.id === input.target);
|
|
165
|
+
if (!cst) throw new Error(`Unknown constituent: ${input.target}`);
|
|
166
|
+
const frontendType = cst.cstType;
|
|
167
|
+
if (!isInterpretable(frontendType)) throw new Error(`Constituent ${cst.alias} is not interpretable`);
|
|
168
|
+
if (isInferrable(frontendType)) throw new Error(`Constituent ${cst.alias} is inferrable and cannot be set directly`);
|
|
169
|
+
if (isBaseSet(frontendType)) {
|
|
170
|
+
if (!validateBasicBindingData(input.value)) throw new Error(`Invalid basic binding for ${cst.alias}`);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (!validateValueData(input.value)) throw new Error(`Invalid structured value for ${cst.alias}`);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
function createInMemoryServices(session) {
|
|
177
|
+
return {
|
|
178
|
+
setCstValue: async ({ data }) => {
|
|
179
|
+
for (const item of data) {
|
|
180
|
+
const entry = {
|
|
181
|
+
id: item.target,
|
|
182
|
+
type: item.type,
|
|
183
|
+
value: item.data
|
|
184
|
+
};
|
|
185
|
+
const index = session.model.items.findIndex((existing) => existing.id === item.target);
|
|
186
|
+
if (index === -1) session.model.items.push(entry);
|
|
187
|
+
else session.model.items[index] = entry;
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
clearValues: async ({ data }) => {
|
|
191
|
+
const ids = new Set(data.items);
|
|
192
|
+
session.model.items = session.model.items.filter((item) => !ids.has(item.id));
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function buildRSModelFromSession(session) {
|
|
197
|
+
return {
|
|
198
|
+
id: SESSION_MODEL_ID,
|
|
199
|
+
schema: 0,
|
|
200
|
+
editors: [],
|
|
201
|
+
items: session.model.items.map((item) => ({
|
|
202
|
+
id: item.id,
|
|
203
|
+
type: item.type,
|
|
204
|
+
value: item.value
|
|
205
|
+
}))
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function toPublicEvaluationResult(value, errors, iterations, cacheHits, status, expression, target) {
|
|
209
|
+
const diagnostics = errors.map((error) => ({
|
|
210
|
+
...expressionDiagnostic(error, expression, target),
|
|
211
|
+
kind: DiagnosticKind.MODEL
|
|
212
|
+
}));
|
|
213
|
+
return {
|
|
214
|
+
success: diagnostics.length === 0 && value !== null,
|
|
215
|
+
value,
|
|
216
|
+
status,
|
|
217
|
+
iterations,
|
|
218
|
+
cacheHits,
|
|
219
|
+
diagnostics
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
//#endregion
|
|
223
|
+
export { enrichSessionConstituents as n, ModelAdapter as t };
|
|
224
|
+
|
|
225
|
+
//# sourceMappingURL=model-adapter-D-YmIvQW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-adapter-D-YmIvQW.js","names":[],"sources":["../src/mappers/rsform-builder.ts","../src/mappers/model-adapter.ts"],"sourcesContent":["import { Graph } from '@rsconcept/domain/graph/graph';\nimport { extractGlobals } from '@rsconcept/domain/rslang/api';\nimport { type ExpressionType, RSLangAnalyzer, type ValueClass } from '@rsconcept/domain/rslang';\nimport { assignSchemaDiagnostics } from '@rsconcept/domain/library';\nimport { isBasicConcept, isLogical, normalizeExpression } from '@rsconcept/domain/library/rsform-api';\nimport { type Constituenta, CstType, type RSForm } from '@rsconcept/domain/library/rsform';\n\nimport { type ConstituentaState, type SessionState } from '../models';\n\nexport interface EnrichedConstituenta {\n item: ConstituentaState;\n cst: Constituenta;\n}\n\n/** Build a domain {@link RSForm} view from session state (same shape as Portal loader output). */\nexport function buildRSFormFromSession(session: SessionState): RSForm {\n const graph = new Graph<number>();\n const cstByAlias = new Map<string, Constituenta>();\n const cstByID = new Map<number, Constituenta>();\n const analyzer = new RSLangAnalyzer();\n\n const items = session.items.map(item => {\n const cst = toFrontendConstituenta(item);\n cstByAlias.set(cst.alias, cst);\n cstByID.set(cst.id, cst);\n graph.addNode(cst.id);\n if (item.cstType === CstType.BASE) {\n analyzer.addBase(cst.alias);\n }\n if (cst.effectiveType) {\n analyzer.setGlobal(cst.alias, cst.effectiveType, cst.analysis.valueClass as ValueClass | null);\n }\n return cst;\n });\n\n for (const cst of items) {\n for (const alias of extractGlobals(cst.definition_formal)) {\n const source = cstByAlias.get(alias);\n if (source) {\n graph.addEdge(source.id, cst.id);\n }\n }\n }\n\n return {\n id: 0,\n items,\n cstByAlias,\n cstByID,\n graph,\n analyzer,\n inheritance: [],\n attribution: [],\n attribution_graph: graph.clone(),\n oss: [],\n models: [],\n editors: [],\n versions: [],\n is_produced: false,\n is_attributive: false,\n version: 'latest'\n } as unknown as RSForm;\n}\n\n/** Enrich session constituents with Portal-style schema metadata used for diagnostics. */\nexport function enrichSessionConstituents(session: SessionState): EnrichedConstituenta[] {\n const schema = buildRSFormFromSession(session);\n const normalizedDefinitions = new Map<number, string>();\n const resolveAlias = (id: number) => schema.cstByID.get(id)?.alias ?? String(id);\n\n for (const item of session.items) {\n const normalized = normalizeExpression(item.definitionFormal, item.cstType);\n if (normalized) {\n normalizedDefinitions.set(item.id, normalized);\n }\n }\n\n assignSchemaDiagnostics(schema.items, resolveAlias, normalizedDefinitions);\n\n return session.items.map(item => ({\n item,\n cst: schema.cstByID.get(item.id)!\n }));\n}\n\nfunction toFrontendConstituenta(item: ConstituentaState): Constituenta {\n const effectiveType = (item.analysis.type ?? null) as ExpressionType | null;\n return {\n id: item.id,\n alias: item.alias,\n cst_type: item.cstType,\n definition_formal: item.definitionFormal,\n definition_raw: item.definitionFormal,\n definition_resolved: item.definitionFormal,\n term_raw: item.term,\n term_resolved: item.term,\n term_forms: [],\n convention: item.convention,\n typification_manual: '',\n value_is_property: false,\n crucial: false,\n attributes: [],\n diagnostics: [],\n analysis: {\n success: item.analysis.success,\n type: effectiveType,\n valueClass: item.analysis.valueClass\n },\n effectiveType,\n is_type_mismatch: false,\n schema: 0,\n cst_class: 'derived',\n status: item.analysis.success ? 'verified' : 'incorrect',\n is_template: false,\n is_simple_expression: true,\n parent_schema_index: 0,\n parent_schema: null,\n is_inherited: false,\n has_inherited_children: false,\n spawn: [],\n spawn_alias: []\n } as unknown as Constituenta;\n}\n\nexport function needsBasicMetadata(item: ConstituentaState): boolean {\n return isBasicConcept(item.cstType) && !isLogical(item.cstType);\n}\n","import { DiagnosticKind, expressionDiagnostic } from './diagnostic-assembly';\nimport { type RSErrorDescription, type Value } from '@rsconcept/domain/rslang';\nimport { isBaseSet } from '@rsconcept/domain/library/rsform-api';\nimport { CstType, type RSForm } from '@rsconcept/domain/library/rsform';\nimport { RSEngine, type RSEngineServices } from '@rsconcept/domain/library/rsengine';\nimport { type BasicBinding, EvalStatus, type RSModel } from '@rsconcept/domain/library/rsmodel';\nimport {\n isInferrable,\n isInterpretable,\n toBasicBinding,\n validateBasicBindingData,\n validateValueData\n} from '@rsconcept/domain/library/rsmodel-api';\n\nimport {\n type EvaluationResult,\n type RecalculateModelResult,\n type SessionModelState,\n type SessionState,\n type SetConstituentaValueInput\n} from '../models';\nimport { buildRSFormFromSession } from './rsform-builder';\n\nconst SESSION_MODEL_ID = 0;\n\nexport class ModelAdapter {\n public async setConstituentaValue(\n session: SessionState,\n input: SetConstituentaValueInput\n ): Promise<SessionModelState> {\n this.validateSetInput(session, input);\n const engine = this.createEngine(session);\n const cst = session.items.find(item => item.id === input.target)!;\n const frontendType = cst.cstType;\n\n if (isBaseSet(frontendType)) {\n const binding = toBasicBinding(input.value as Record<string | number, string>);\n await engine.setBasicValue(input.target, binding);\n } else {\n await engine.setStructureValue(input.target, input.value as Value);\n }\n session.updatedAt = new Date().toISOString();\n return structuredClone(session.model);\n }\n\n public async setConstituentaValues(\n session: SessionState,\n input: { items: SetConstituentaValueInput[] }\n ): Promise<SessionModelState> {\n for (const item of input.items) {\n await this.setConstituentaValue(session, item);\n }\n return structuredClone(session.model);\n }\n\n public async clearConstituentaValues(session: SessionState, ids: number[]): Promise<SessionModelState> {\n const engine = this.createEngine(session);\n for (const id of ids) {\n await engine.resetValue(id);\n session.updatedAt = new Date().toISOString();\n }\n return structuredClone(session.model);\n }\n\n public evaluateExpression(session: SessionState, expression: string, cstType: CstType): EvaluationResult {\n const engine = this.createEngine(session);\n const result = engine.evaluateExpression(expression, cstType);\n const status =\n result.value === null\n ? result.errors.length > 0\n ? EvalStatus.EVAL_FAIL\n : EvalStatus.EMPTY\n : EvalStatus.HAS_DATA;\n return toPublicEvaluationResult(\n result.value,\n result.errors,\n result.iterations,\n result.cacheHits,\n status,\n expression\n );\n }\n\n public evaluateConstituenta(session: SessionState, constituentId: number): EvaluationResult {\n const cst = session.items.find(item => item.id === constituentId);\n if (!cst) {\n throw new Error(`Unknown constituent: ${constituentId}`);\n }\n const engine = this.createEngine(session);\n const result = engine.calculateCst(constituentId);\n const status = engine.getCstStatus(constituentId);\n return toPublicEvaluationResult(\n result.value,\n result.errors,\n result.iterations,\n result.cacheHits,\n status,\n cst.definitionFormal,\n { constituentId: cst.id, alias: cst.alias }\n );\n }\n\n public recalculateModel(session: SessionState): RecalculateModelResult {\n const engine = this.createEngine(session);\n engine.recalculateAll();\n const items = session.items.map(item => ({\n id: item.id,\n alias: item.alias,\n value: engine.getCstValue(item.id) as number | number[] | null,\n status: engine.getCstStatus(item.id)\n }));\n return { items };\n }\n\n public createEngine(session: SessionState): RSEngine {\n const schema = buildRSFormFromSession(session);\n const model = buildRSModelFromSession(session);\n const engine = new RSEngine(SESSION_MODEL_ID, createInMemoryServices(session));\n engine.loadData(schema, model);\n return engine;\n }\n\n private validateSetInput(session: SessionState, input: SetConstituentaValueInput): void {\n const cst = session.items.find(item => item.id === input.target);\n if (!cst) {\n throw new Error(`Unknown constituent: ${input.target}`);\n }\n const frontendType = cst.cstType;\n if (!isInterpretable(frontendType)) {\n throw new Error(`Constituent ${cst.alias} is not interpretable`);\n }\n if (isInferrable(frontendType)) {\n throw new Error(`Constituent ${cst.alias} is inferrable and cannot be set directly`);\n }\n if (isBaseSet(frontendType)) {\n if (!validateBasicBindingData(input.value)) {\n throw new Error(`Invalid basic binding for ${cst.alias}`);\n }\n return;\n }\n if (!validateValueData(input.value)) {\n throw new Error(`Invalid structured value for ${cst.alias}`);\n }\n }\n}\n\nfunction createInMemoryServices(session: SessionState): RSEngineServices {\n return {\n setCstValue: async ({ data }) => {\n for (const item of data) {\n const entry = {\n id: item.target,\n type: item.type,\n value: item.data as Value | BasicBinding\n };\n const index = session.model.items.findIndex(existing => existing.id === item.target);\n if (index === -1) {\n session.model.items.push(entry);\n } else {\n session.model.items[index] = entry;\n }\n }\n },\n clearValues: async ({ data }) => {\n const ids = new Set(data.items);\n session.model.items = session.model.items.filter(item => !ids.has(item.id));\n }\n };\n}\n\nfunction buildRSModelFromSession(session: SessionState): RSModel {\n return {\n id: SESSION_MODEL_ID,\n schema: 0,\n editors: [],\n items: session.model.items.map(item => ({\n id: item.id,\n type: item.type,\n value: item.value as Value | BasicBinding\n }))\n } as unknown as RSModel;\n}\n\nfunction toPublicEvaluationResult(\n value: Value | null,\n errors: { code: number; from: number; to: number; params?: readonly string[] }[],\n iterations: number,\n cacheHits: number,\n status: EvalStatus,\n expression: string,\n target?: { constituentId?: number; alias?: string }\n): EvaluationResult {\n const diagnostics = errors.map(error => ({\n ...expressionDiagnostic(error as RSErrorDescription, expression, target),\n kind: DiagnosticKind.MODEL\n }));\n return {\n success: diagnostics.length === 0 && value !== null,\n value: value as EvaluationResult['value'],\n status,\n iterations,\n cacheHits,\n diagnostics\n };\n}\n"],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as RSToolValue, r as EvalStatus, t as BasicBinding } from "./common-D6TFl6l_.js";
|
|
2
2
|
|
|
3
3
|
//#region src/models/model-value.d.ts
|
|
4
4
|
/** Model value for one constituent. */
|
|
@@ -43,4 +43,4 @@ interface RecalculateModelResult {
|
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|
|
45
45
|
export { SetConstituentaValueInput as a, SessionModelState as i, ModelValueState as n, SetConstituentaValuesInput as o, RecalculateModelResult as r, SetModelValuesInput as s, ClearConstituentaValuesInput as t };
|
|
46
|
-
//# sourceMappingURL=model-value-
|
|
46
|
+
//# sourceMappingURL=model-value-BUhr2IjA.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as SessionStateResult, i as SessionStateDetail, n as ApplySchemaPatchInput, o as SessionSummary, r as ApplySchemaPatchResult, s as SessionSummaryItem, t as AgentConstituentaPatch } from "../agent-workflow-
|
|
1
|
+
import { a as SessionStateResult, i as SessionStateDetail, n as ApplySchemaPatchInput, o as SessionSummary, r as ApplySchemaPatchResult, s as SessionSummaryItem, t as AgentConstituentaPatch } from "../agent-workflow-D22FeODL.js";
|
|
2
2
|
export { AgentConstituentaPatch, ApplySchemaPatchInput, ApplySchemaPatchResult, SessionStateDetail, SessionStateResult, SessionSummary, SessionSummaryItem };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as AnalyzeExpressionInput, t as AnalysisResult } from "../analysis-
|
|
1
|
+
import { n as AnalyzeExpressionInput, t as AnalysisResult } from "../analysis-DA44pfgA.js";
|
|
2
2
|
export { AnalysisResult, AnalyzeExpressionInput };
|
package/dist/models/common.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { type BasicBinding, CstType, EvalStatus, RSErrorCode,
|
|
1
|
+
import { a as RSToolValue, i as RSErrorCode, n as CstType, o as ValueClass, r as EvalStatus, t as BasicBinding } from "../common-D6TFl6l_.js";
|
|
2
|
+
export { type BasicBinding, CstType, EvalStatus, RSErrorCode, RSToolValue, ValueClass };
|
package/dist/models/common.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { RSErrorCode } from "@rsconcept/domain/rslang/error";
|
|
1
2
|
import { CstType } from "@rsconcept/domain/library/rsform";
|
|
2
3
|
import { EvalStatus } from "@rsconcept/domain/library/rsmodel";
|
|
3
4
|
import { ValueClass } from "@rsconcept/domain/rslang";
|
|
4
|
-
import { RSErrorCode } from "@rsconcept/domain/rslang/error";
|
|
5
5
|
export { CstType, EvalStatus, RSErrorCode, ValueClass };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ApplyConstituentsResult, i as ApplyConstituentsMode, n as AddOrUpdateConstituentaResult, o as ConstituentaDraft, r as ApplyConstituentsInput, s as ConstituentaState, t as AddOrUpdateConstituentaInput } from "../constituenta-
|
|
1
|
+
import { a as ApplyConstituentsResult, i as ApplyConstituentsMode, n as AddOrUpdateConstituentaResult, o as ConstituentaDraft, r as ApplyConstituentsInput, s as ConstituentaState, t as AddOrUpdateConstituentaInput } from "../constituenta-QY5w1x91.js";
|
|
2
2
|
export { AddOrUpdateConstituentaInput, AddOrUpdateConstituentaResult, ApplyConstituentsInput, ApplyConstituentsMode, ApplyConstituentsResult, ConstituentaDraft, ConstituentaState };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as ListDiagnosticsFilters, t as
|
|
2
|
-
export {
|
|
1
|
+
import { a as Diagnostic, c as expandCstDiagnostic, d as getDiagnosticSeverity, f as modelStatusDiagnostic, i as RSDiagnosticCode, l as expressionDiagnostic, n as DiagnosticKind, o as DiagnosticSeverity, r as ListDiagnosticsFilters, s as DiagnosticTarget, t as CstDiagnostic, u as getDiagnosticName } from "../diagnostic-C6TRoBgt.js";
|
|
2
|
+
export { type CstDiagnostic, type Diagnostic, DiagnosticKind, type DiagnosticSeverity, type DiagnosticTarget, ListDiagnosticsFilters, RSDiagnosticCode, expandCstDiagnostic, expressionDiagnostic, getDiagnosticName, getDiagnosticSeverity, modelStatusDiagnostic };
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { a as getDiagnosticSeverity, i as getDiagnosticName, n as expandCstDiagnostic, o as modelStatusDiagnostic, r as expressionDiagnostic } from "../diagnostic-assembly-DRunIcKQ.js";
|
|
2
|
+
import { DiagnosticKind, RSDiagnosticCode } from "@rsconcept/domain/library";
|
|
3
|
+
export { DiagnosticKind, RSDiagnosticCode, expandCstDiagnostic, expressionDiagnostic, getDiagnosticName, getDiagnosticSeverity, modelStatusDiagnostic };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as EvaluationResult, n as EvaluateExpressionInput, r as EvaluateInput, t as EvaluateConstituentaInput } from "../evaluation-
|
|
1
|
+
import { i as EvaluationResult, n as EvaluateExpressionInput, r as EvaluateInput, t as EvaluateConstituentaInput } from "../evaluation-Cd4S7-3t.js";
|
|
2
2
|
export { EvaluateConstituentaInput, EvaluateExpressionInput, EvaluateInput, EvaluationResult };
|
package/dist/models/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { n as
|
|
3
|
-
import { n as
|
|
4
|
-
import { i as ApplyConstituentsMode, o as ConstituentaDraft, s as ConstituentaState } from "../constituenta-
|
|
5
|
-
import { a as SetConstituentaValueInput, i as SessionModelState, n as ModelValueState, r as RecalculateModelResult, s as SetModelValuesInput } from "../model-value-
|
|
6
|
-
import { n as SessionRevision, r as SessionState, t as SessionHandle } from "../session-
|
|
7
|
-
import { a as SessionStateResult, i as SessionStateDetail, n as ApplySchemaPatchInput, o as SessionSummary, r as ApplySchemaPatchResult, s as SessionSummaryItem, t as AgentConstituentaPatch } from "../agent-workflow-
|
|
8
|
-
import { i as EvaluationResult, r as EvaluateInput } from "../evaluation-
|
|
9
|
-
import { a as ExportPortalInput, c as PortalExportKind, d as PortalModelImportData, f as PortalRsformDetails, g as portalItemToDraft, h as PortalTermForm, i as ExportFormat, l as PORTAL_JSON_CONTRACT_VERSION, m as PortalSchemaImportData, n as RSToolAgentContract, o as ExportPortalResult, p as PortalSchemaConstituenta, r as RSToolAgentOptions, s as ImportDataKind, t as CONTRACT_VERSION, u as PortalImportMetadata } from "../tool-contract-
|
|
10
|
-
import { t as RSToolAgent } from "../rstool-agent-
|
|
11
|
-
export { type AgentConstituentaPatch, type AnalysisResult, type AnalyzeExpressionInput, type ApplyConstituentsMode, type ApplySchemaPatchInput, type ApplySchemaPatchResult, type BasicBinding, CONTRACT_VERSION, type ConstituentaDraft, type ConstituentaState, CstType, type
|
|
1
|
+
import { a as Diagnostic, i as RSDiagnosticCode, n as DiagnosticKind, o as DiagnosticSeverity, r as ListDiagnosticsFilters, t as CstDiagnostic } from "../diagnostic-C6TRoBgt.js";
|
|
2
|
+
import { a as RSToolValue, i as RSErrorCode, n as CstType, o as ValueClass, r as EvalStatus, t as BasicBinding } from "../common-D6TFl6l_.js";
|
|
3
|
+
import { n as AnalyzeExpressionInput, t as AnalysisResult } from "../analysis-DA44pfgA.js";
|
|
4
|
+
import { i as ApplyConstituentsMode, o as ConstituentaDraft, s as ConstituentaState } from "../constituenta-QY5w1x91.js";
|
|
5
|
+
import { a as SetConstituentaValueInput, i as SessionModelState, n as ModelValueState, r as RecalculateModelResult, s as SetModelValuesInput } from "../model-value-BUhr2IjA.js";
|
|
6
|
+
import { n as SessionRevision, r as SessionState, t as SessionHandle } from "../session-CI4rLYby.js";
|
|
7
|
+
import { a as SessionStateResult, i as SessionStateDetail, n as ApplySchemaPatchInput, o as SessionSummary, r as ApplySchemaPatchResult, s as SessionSummaryItem, t as AgentConstituentaPatch } from "../agent-workflow-D22FeODL.js";
|
|
8
|
+
import { i as EvaluationResult, r as EvaluateInput } from "../evaluation-Cd4S7-3t.js";
|
|
9
|
+
import { a as ExportPortalInput, c as PortalExportKind, d as PortalModelImportData, f as PortalRsformDetails, g as portalItemToDraft, h as PortalTermForm, i as ExportFormat, l as PORTAL_JSON_CONTRACT_VERSION, m as PortalSchemaImportData, n as RSToolAgentContract, o as ExportPortalResult, p as PortalSchemaConstituenta, r as RSToolAgentOptions, s as ImportDataKind, t as CONTRACT_VERSION, u as PortalImportMetadata } from "../tool-contract-sQfr-DYD.js";
|
|
10
|
+
import { t as RSToolAgent } from "../rstool-agent-BMVAyMAG.js";
|
|
11
|
+
export { type AgentConstituentaPatch, type AnalysisResult, type AnalyzeExpressionInput, type ApplyConstituentsMode, type ApplySchemaPatchInput, type ApplySchemaPatchResult, type BasicBinding, CONTRACT_VERSION, type ConstituentaDraft, type ConstituentaState, type CstDiagnostic, CstType, type Diagnostic, DiagnosticKind, type DiagnosticSeverity, EvalStatus, type EvaluateInput, type EvaluationResult, type ExportFormat, type ExportPortalInput, type ExportPortalResult, type ImportDataKind, type ListDiagnosticsFilters, type ModelValueState, PORTAL_JSON_CONTRACT_VERSION, type PortalExportKind, type PortalImportMetadata, type PortalModelImportData, type PortalRsformDetails, type PortalSchemaConstituenta, type PortalSchemaImportData, type PortalTermForm, RSDiagnosticCode, RSErrorCode, RSToolAgent, type RSToolAgentContract, type RSToolAgentOptions, type RSToolValue, type RecalculateModelResult, type SessionHandle, type SessionModelState, type SessionRevision, type SessionState, type SessionStateDetail, type SessionStateResult, type SessionSummary, type SessionSummaryItem, type SetConstituentaValueInput, type SetModelValuesInput, ValueClass, portalItemToDraft };
|
package/dist/models/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CstType, EvalStatus, RSErrorCode, ValueClass } from "./common.js";
|
|
2
|
-
import {
|
|
2
|
+
import { DiagnosticKind, RSDiagnosticCode } from "./diagnostic.js";
|
|
3
|
+
import { i as portalItemToDraft, r as PORTAL_JSON_CONTRACT_VERSION, t as RSToolAgent } from "../models-DTLctDmB.js";
|
|
3
4
|
import { CONTRACT_VERSION } from "./tool-contract.js";
|
|
4
|
-
export { CONTRACT_VERSION, CstType, EvalStatus, PORTAL_JSON_CONTRACT_VERSION, RSErrorCode, RSToolAgent, ValueClass, portalItemToDraft };
|
|
5
|
+
export { CONTRACT_VERSION, CstType, DiagnosticKind, EvalStatus, PORTAL_JSON_CONTRACT_VERSION, RSDiagnosticCode, RSErrorCode, RSToolAgent, ValueClass, portalItemToDraft };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as SetConstituentaValueInput, i as SessionModelState, n as ModelValueState, o as SetConstituentaValuesInput, r as RecalculateModelResult, s as SetModelValuesInput, t as ClearConstituentaValuesInput } from "../model-value-
|
|
1
|
+
import { a as SetConstituentaValueInput, i as SessionModelState, n as ModelValueState, o as SetConstituentaValuesInput, r as RecalculateModelResult, s as SetModelValuesInput, t as ClearConstituentaValuesInput } from "../model-value-BUhr2IjA.js";
|
|
2
2
|
export { ClearConstituentaValuesInput, ModelValueState, RecalculateModelResult, SessionModelState, SetConstituentaValueInput, SetConstituentaValuesInput, SetModelValuesInput };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as RSToolAgent } from "../rstool-agent-
|
|
1
|
+
import { t as RSToolAgent } from "../rstool-agent-BMVAyMAG.js";
|
|
2
2
|
export { RSToolAgent };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as RSToolAgent } from "../models-
|
|
1
|
+
import { t as RSToolAgent } from "../models-DTLctDmB.js";
|
|
2
2
|
export { RSToolAgent };
|
package/dist/models/session.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as SessionRevision, r as SessionState, t as SessionHandle } from "../session-
|
|
1
|
+
import { n as SessionRevision, r as SessionState, t as SessionHandle } from "../session-CI4rLYby.js";
|
|
2
2
|
export { SessionHandle, SessionRevision, SessionState };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as RSToolAgentContract, r as RSToolAgentOptions, t as CONTRACT_VERSION } from "../tool-contract-
|
|
1
|
+
import { n as RSToolAgentContract, r as RSToolAgentOptions, t as CONTRACT_VERSION } from "../tool-contract-sQfr-DYD.js";
|
|
2
2
|
export { CONTRACT_VERSION, RSToolAgentContract, RSToolAgentOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-contract.js","names":[],"sources":["../../src/models/tool-contract.ts"],"sourcesContent":["import {\n type ApplySchemaPatchInput,\n type ApplySchemaPatchResult,\n type SessionStateDetail,\n type SessionStateResult\n} from './agent-workflow';\nimport { type AnalysisResult, type AnalyzeExpressionInput } from './analysis';\nimport { type
|
|
1
|
+
{"version":3,"file":"tool-contract.js","names":[],"sources":["../../src/models/tool-contract.ts"],"sourcesContent":["import {\n type ApplySchemaPatchInput,\n type ApplySchemaPatchResult,\n type SessionStateDetail,\n type SessionStateResult\n} from './agent-workflow';\nimport { type AnalysisResult, type AnalyzeExpressionInput } from './analysis';\nimport { type Diagnostic, type ListDiagnosticsFilters } from './diagnostic';\nimport { type EvaluateInput, type EvaluationResult } from './evaluation';\nimport { type ExportPortalInput, type ExportPortalResult, type ImportDataKind } from './import-export';\nimport { type RecalculateModelResult, type SessionModelState, type SetModelValuesInput } from './model-value';\nimport { type SessionHandle, type SessionRevision, type SessionState } from './session';\n\n/** Agent-visible contract version; bump on breaking API changes. */\nexport const CONTRACT_VERSION = '3.0.0';\n\n/** Options for constructing an {@link RSToolAgent}. */\nexport interface RSToolAgentOptions {\n /** When set, sessions are persisted to this directory and survive process restarts. */\n persistenceDir?: string;\n}\n\n/**\n * Public method surface of {@link RSToolAgent}.\n *\n * Each method accepts an optional `sessionId`; when omitted, the current session is used\n * (or a new one is created where noted).\n */\nexport interface RSToolAgentContract {\n /** Current contract version string (same as {@link CONTRACT_VERSION}). */\n readonly contractVersion: string;\n\n /** Return the current session, or create one with optional `initial` metadata. */\n ensureSession(initial?: Partial<SessionState>): SessionHandle;\n\n /** Create a new session and make it current. */\n createSession(initial?: Partial<SessionState>): SessionHandle;\n\n /** Return the current session handle, or `null` when none is active. */\n getCurrentSession(): SessionHandle | null;\n\n /** Switch the active session; throws when `sessionId` is unknown. */\n setCurrentSession(sessionId: string): SessionHandle;\n\n /** Apply constituent patches to the schema (analyze, merge, optionally commit). */\n applySchemaPatch(input: ApplySchemaPatchInput, sessionId?: string): ApplySchemaPatchResult;\n\n /** Return session summary (default) or full cloned state when `detail` is `'full'`. */\n getSessionState(detail?: SessionStateDetail, sessionId?: string): SessionStateResult;\n\n /** List diagnostics for the session, optionally filtered by constituent or kind. */\n listDiagnostics(filters?: ListDiagnosticsFilters, sessionId?: string): Diagnostic[];\n\n /** Parse and type-check an RSLang expression against the current schema context. */\n analyzeExpression(input: AnalyzeExpressionInput, sessionId?: string): AnalysisResult;\n\n /** Record a revision checkpoint with an optional message. */\n commitStep(message?: string, sessionId?: string): SessionRevision;\n\n /** Export the session as a JSON string (state + diagnostics). */\n exportSession(sessionId?: string): string;\n\n /** Export schema or model payload in Portal JSON format. */\n exportPortal(input: ExportPortalInput, sessionId?: string): ExportPortalResult;\n\n /**\n * Import a session export or Portal JSON payload and make the new session current.\n *\n * When `kind` is `'auto'`, the payload shape is detected automatically.\n */\n importData(payload: string | object, kind?: ImportDataKind): SessionHandle;\n\n /** Set or clear model values for constituents; returns the updated model state. */\n setModelValues(input: SetModelValuesInput, sessionId?: string): Promise<SessionModelState>;\n\n /** Return a deep clone of the session model state. */\n getModelState(sessionId?: string): SessionModelState;\n\n /**\n * Evaluate a stored constituent or a scratch expression.\n *\n * Provide `constituentId`, or both `expression` and `cstType`.\n */\n evaluate(input: EvaluateInput, sessionId?: string): EvaluationResult;\n\n /** Recompute derived model values for all constituents. */\n recalculateModel(sessionId?: string): RecalculateModelResult;\n}\n"],"mappings":";;AAcA,MAAa,mBAAmB"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { n as expandCstDiagnostic, o as modelStatusDiagnostic, r as expressionDiagnostic, t as DiagnosticKind } from "./diagnostic-assembly-DRunIcKQ.js";
|
|
1
2
|
import { CstType } from "./models/common.js";
|
|
2
|
-
import
|
|
3
|
+
import "./models/diagnostic.js";
|
|
4
|
+
import { n as enrichSessionConstituents, t as ModelAdapter } from "./model-adapter-D-YmIvQW.js";
|
|
3
5
|
import { SchemaAdapter } from "./mappers/schema-adapter.js";
|
|
4
6
|
import { CONTRACT_VERSION } from "./models/tool-contract.js";
|
|
7
|
+
import { isModelIssue } from "@rsconcept/domain/library/rsmodel-api";
|
|
5
8
|
import { Graph } from "@rsconcept/domain/graph/graph";
|
|
6
9
|
import { extractGlobals } from "@rsconcept/domain/rslang/api";
|
|
7
10
|
import { randomUUID } from "node:crypto";
|
|
@@ -53,6 +56,46 @@ function portalDetailsToDrafts(data) {
|
|
|
53
56
|
return portalItemsToDrafts(data.items);
|
|
54
57
|
}
|
|
55
58
|
//#endregion
|
|
59
|
+
//#region src/mappers/diagnostics-collector.ts
|
|
60
|
+
const modelAdapter = new ModelAdapter();
|
|
61
|
+
/** Collect expression, schema, and model diagnostics for a session (Portal parity). */
|
|
62
|
+
function collectSessionDiagnostics(session) {
|
|
63
|
+
const records = [];
|
|
64
|
+
for (const item of session.items) for (const diagnostic of item.analysis.diagnostics) {
|
|
65
|
+
const base = diagnostic.name ? diagnostic : expressionDiagnostic({
|
|
66
|
+
code: diagnostic.code,
|
|
67
|
+
from: diagnostic.from,
|
|
68
|
+
to: diagnostic.to,
|
|
69
|
+
params: diagnostic.params
|
|
70
|
+
}, item.definitionFormal, {
|
|
71
|
+
constituentId: item.id,
|
|
72
|
+
alias: item.alias
|
|
73
|
+
});
|
|
74
|
+
records.push({
|
|
75
|
+
...base,
|
|
76
|
+
kind: DiagnosticKind.EXPRESSION,
|
|
77
|
+
constituentId: base.constituentId ?? item.id,
|
|
78
|
+
alias: base.alias ?? item.alias
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
const enriched = enrichSessionConstituents(session);
|
|
82
|
+
for (const { cst } of enriched) for (const diagnostic of cst.diagnostics) {
|
|
83
|
+
if (diagnostic.kind !== DiagnosticKind.SCHEMA) continue;
|
|
84
|
+
records.push(expandCstDiagnostic(cst, diagnostic));
|
|
85
|
+
}
|
|
86
|
+
if (session.items.length > 0) {
|
|
87
|
+
const schema = enriched.map((entry) => entry.cst);
|
|
88
|
+
const engine = modelAdapter.createEngine(session);
|
|
89
|
+
engine.recalculateAll();
|
|
90
|
+
for (const cst of schema) {
|
|
91
|
+
if (!isModelIssue(engine, cst)) continue;
|
|
92
|
+
const diagnostic = modelStatusDiagnostic(engine.getCstStatus(cst.id), cst);
|
|
93
|
+
if (diagnostic) records.push(diagnostic);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return records;
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
56
99
|
//#region src/session/batch-apply.ts
|
|
57
100
|
/** Order drafts so suppliers are applied before dependents. */
|
|
58
101
|
function orderDrafts(sessionItems, drafts) {
|
|
@@ -174,7 +217,7 @@ var SessionStore = class {
|
|
|
174
217
|
this.persist(sessionId, envelope);
|
|
175
218
|
return {
|
|
176
219
|
sessionId,
|
|
177
|
-
contractVersion: contractVersion ?? "
|
|
220
|
+
contractVersion: contractVersion ?? "3.0.0"
|
|
178
221
|
};
|
|
179
222
|
}
|
|
180
223
|
get(sessionId) {
|
|
@@ -222,9 +265,11 @@ var SessionStore = class {
|
|
|
222
265
|
this.persist(sessionId, found);
|
|
223
266
|
}
|
|
224
267
|
listDiagnostics(sessionId, filters) {
|
|
225
|
-
|
|
226
|
-
if (filters?.
|
|
227
|
-
|
|
268
|
+
let records = this.get(sessionId).diagnostics;
|
|
269
|
+
if (filters?.kind !== void 0) records = records.filter((record) => record.kind === filters.kind);
|
|
270
|
+
if (filters?.severity !== void 0) records = records.filter((record) => record.severity === filters.severity);
|
|
271
|
+
if (filters?.constituentId === void 0) return [...records];
|
|
272
|
+
return records.filter((record) => record.constituentId === filters.constituentId);
|
|
228
273
|
}
|
|
229
274
|
snapshot(sessionId) {
|
|
230
275
|
const found = this.get(sessionId);
|
|
@@ -405,10 +450,13 @@ var RSToolAgent = class {
|
|
|
405
450
|
cstType: input.cstType,
|
|
406
451
|
definitionFormal: input.expression
|
|
407
452
|
});
|
|
408
|
-
if (input.recordDiagnostics)
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
453
|
+
if (input.recordDiagnostics) {
|
|
454
|
+
const refreshed = collectSessionDiagnostics(envelope.state);
|
|
455
|
+
this.sessions.setDiagnostics(id, [...refreshed, ...diagnostics.map((item) => ({
|
|
456
|
+
...item,
|
|
457
|
+
constituentId: void 0
|
|
458
|
+
}))]);
|
|
459
|
+
}
|
|
412
460
|
return result;
|
|
413
461
|
}
|
|
414
462
|
/** @inheritdoc */
|
|
@@ -463,8 +511,10 @@ var RSToolAgent = class {
|
|
|
463
511
|
model
|
|
464
512
|
};
|
|
465
513
|
this.sessions.replaceState(id, state);
|
|
514
|
+
this.refreshDiagnostics(id);
|
|
466
515
|
return model;
|
|
467
516
|
}
|
|
517
|
+
this.refreshDiagnostics(id);
|
|
468
518
|
return structuredClone(this.sessions.get(id).state.model);
|
|
469
519
|
} catch (error) {
|
|
470
520
|
this.sessions.restore(id, snapshot);
|
|
@@ -485,17 +535,18 @@ var RSToolAgent = class {
|
|
|
485
535
|
}
|
|
486
536
|
/** @inheritdoc */
|
|
487
537
|
recalculateModel(sessionId) {
|
|
488
|
-
const
|
|
489
|
-
|
|
538
|
+
const id = this.resolveSessionId(sessionId);
|
|
539
|
+
const envelope = this.sessions.get(id);
|
|
540
|
+
const result = this.evaluation.recalculateModel(envelope.state);
|
|
541
|
+
this.refreshDiagnostics(id);
|
|
542
|
+
return result;
|
|
490
543
|
}
|
|
491
544
|
addOrUpdateConstituenta(input, sessionId) {
|
|
492
545
|
const id = this.resolveSessionId(sessionId);
|
|
493
546
|
const envelope = this.sessions.get(id);
|
|
494
547
|
const { result, diagnostics } = this.adapter.analyzeAgainstSession(envelope.state, input.draft);
|
|
495
|
-
const state = this.adapter.mergeStateWithDraft(envelope.state, input.draft, result);
|
|
496
|
-
this.sessions.replaceDiagnosticsForConstituent(id, input.draft.id, diagnostics);
|
|
497
548
|
return {
|
|
498
|
-
state,
|
|
549
|
+
state: this.adapter.mergeStateWithDraft(envelope.state, input.draft, result),
|
|
499
550
|
diagnostics
|
|
500
551
|
};
|
|
501
552
|
}
|
|
@@ -530,6 +581,7 @@ var RSToolAgent = class {
|
|
|
530
581
|
const envelope = this.sessions.get(id);
|
|
531
582
|
reorderSessionItemsByDrafts(envelope.state.items, input.drafts, preBatchItemIds);
|
|
532
583
|
this.sessions.replaceState(id, envelope.state);
|
|
584
|
+
this.refreshDiagnostics(id);
|
|
533
585
|
return {
|
|
534
586
|
success: failed.length === 0,
|
|
535
587
|
applied,
|
|
@@ -600,6 +652,7 @@ var RSToolAgent = class {
|
|
|
600
652
|
const data = parsed;
|
|
601
653
|
const handle = this.sessions.create(normalizeImportedState(data.state), this.contractVersion);
|
|
602
654
|
if (data.diagnostics?.length) this.sessions.setDiagnostics(handle.sessionId, data.diagnostics);
|
|
655
|
+
this.refreshDiagnostics(handle.sessionId);
|
|
603
656
|
return this.trackSession(handle);
|
|
604
657
|
}
|
|
605
658
|
importPortalSchemaData(data) {
|
|
@@ -677,8 +730,12 @@ var RSToolAgent = class {
|
|
|
677
730
|
this.sessions.saveCurrentSessionId(handle.sessionId);
|
|
678
731
|
return handle;
|
|
679
732
|
}
|
|
733
|
+
refreshDiagnostics(sessionId) {
|
|
734
|
+
const envelope = this.sessions.get(sessionId);
|
|
735
|
+
this.sessions.setDiagnostics(sessionId, collectSessionDiagnostics(envelope.state));
|
|
736
|
+
}
|
|
680
737
|
};
|
|
681
738
|
//#endregion
|
|
682
739
|
export { portalItemToDraft as i, SessionStore as n, PORTAL_JSON_CONTRACT_VERSION as r, RSToolAgent as t };
|
|
683
740
|
|
|
684
|
-
//# sourceMappingURL=models-
|
|
741
|
+
//# sourceMappingURL=models-DTLctDmB.js.map
|