@rsconcept/rstool 0.7.2 → 0.8.1
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 +1 -1
- package/docs/CONSTITUENTA.md +1 -1
- package/docs/DIAGNOSTICS.md +8 -5
- package/docs/MODEL-TESTING.md +1 -1
- package/docs/PORTAL-API.md +20 -0
- package/examples/README.md +52 -29
- package/examples/build-chocolate-nim-rsform.ts +311 -0
- package/examples/chocolate-nim/build-rsform.ts +311 -0
- package/examples/chocolate-nim/build-rsmodel.ts +100 -0
- package/examples/chocolate-nim/constants.ts +10 -0
- package/examples/chocolate-nim/rsform-session.json +778 -0
- package/examples/chocolate-nim/rsmodel-session.json +802 -0
- package/examples/expression-bank/bank-constituents.ts +370 -0
- package/examples/expression-bank/build-rsform.ts +59 -0
- package/examples/expression-bank/constants.ts +1 -0
- package/examples/expression-bank/rsform-session.json +4006 -0
- package/examples/{build-kinship-rsform.ts → kinship/build-rsform.ts} +276 -54
- package/examples/{build-kinship-rsmodel.ts → kinship/build-rsmodel.ts} +18 -7
- package/examples/kinship/constants.ts +5 -3
- package/examples/{kinship-rsmodel-session.json → kinship/rsform-session.json} +614 -92
- package/examples/{kinship-rsform-session.json → kinship/rsmodel-session.json} +704 -50
- package/examples/kinship/x1-actions.test.ts +2 -1
- package/examples/movd/build-rsform.ts +325 -0
- package/examples/movd/build-rsmodel.ts +159 -0
- package/examples/movd/constants.ts +18 -0
- package/examples/movd/rsform-session.json +738 -0
- package/examples/movd/rsmodel-session.json +832 -0
- package/examples/{build-sample-rsform.ts → sample/build-rsform.ts} +2 -2
- package/examples/{build-sample-rsmodel.ts → sample/build-rsmodel.ts} +3 -4
- package/examples/template-apply/build-rsform.ts +236 -0
- package/examples/template-apply/constants.ts +13 -0
- package/examples/template-apply/rsform-session.json +333 -0
- package/package.json +12 -6
- package/skills/rstool-helper/EXAMPLES.md +2 -2
- /package/examples/{sample-rsform-session.json → sample/rsform-session.json} +0 -0
- /package/examples/{sample-rsmodel-session.json → sample/rsmodel-session.json} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { writeFile } from 'node:fs/promises';
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
3
|
|
|
4
|
-
import { CstType, RSToolWrapperClient, type AddOrUpdateConstituentaInput } from '
|
|
4
|
+
import { CstType, RSToolWrapperClient, type AddOrUpdateConstituentaInput } from '../../src';
|
|
5
5
|
|
|
6
6
|
async function run() {
|
|
7
7
|
const client = new RSToolWrapperClient({
|
|
@@ -76,7 +76,7 @@ async function run() {
|
|
|
76
76
|
const exported = await client.call<string>('exportSession', {
|
|
77
77
|
sessionId: session.sessionId
|
|
78
78
|
});
|
|
79
|
-
const outputPath = resolve(process.cwd(), 'examples', 'sample
|
|
79
|
+
const outputPath = resolve(process.cwd(), 'examples', 'sample', 'rsform-session.json');
|
|
80
80
|
await writeFile(outputPath, exported, 'utf8');
|
|
81
81
|
console.log(`Sample RSForm exported: ${outputPath}`);
|
|
82
82
|
} finally {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { writeFile } from 'node:fs/promises';
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { TUPLE_ID } from '@rsconcept/domain';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
const TUPLE_ID = -111;
|
|
6
|
+
import { CstType, RSToolWrapperClient, type AddOrUpdateConstituentaInput } from '../../src';
|
|
8
7
|
|
|
9
8
|
async function run() {
|
|
10
9
|
const client = new RSToolWrapperClient({
|
|
@@ -92,7 +91,7 @@ async function run() {
|
|
|
92
91
|
const exported = await client.call<string>('exportSession', {
|
|
93
92
|
sessionId: session.sessionId
|
|
94
93
|
});
|
|
95
|
-
const outputPath = resolve(process.cwd(), 'examples', 'sample
|
|
94
|
+
const outputPath = resolve(process.cwd(), 'examples', 'sample', 'rsmodel-session.json');
|
|
96
95
|
await writeFile(outputPath, exported, 'utf8');
|
|
97
96
|
console.log(`Sample RSModel exported: ${outputPath}`);
|
|
98
97
|
} finally {
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { writeFile } from 'node:fs/promises';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { TUPLE_ID } from '@rsconcept/domain';
|
|
5
|
+
|
|
6
|
+
import { CstType, EvalStatus, RSToolWrapperClient, type AddOrUpdateConstituentaInput } from '../../src';
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
D1_ID,
|
|
10
|
+
D2_ID,
|
|
11
|
+
DEFAULT_RSFORM_SESSION_PATH,
|
|
12
|
+
F_IMAGE_ID,
|
|
13
|
+
F_SOURCES_ID,
|
|
14
|
+
P_FUNCTION_ID,
|
|
15
|
+
S1_ID,
|
|
16
|
+
S2_ID,
|
|
17
|
+
T1_ID,
|
|
18
|
+
X1_ID,
|
|
19
|
+
X2_ID
|
|
20
|
+
} from './constants';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Учебная схема: применение шаблонов БВ (rsforms/42) к предметной области.
|
|
24
|
+
* Подстановка R1→X1 (сотрудники), R2→X2 (проекты), σ→S1/S2.
|
|
25
|
+
*/
|
|
26
|
+
const X1_BINDING = { 0: 'Алиса', 1: 'Боб', 2: 'Кэрол' } as const;
|
|
27
|
+
const X2_BINDING = { 0: 'ПроектA', 1: 'ПроектB' } as const;
|
|
28
|
+
|
|
29
|
+
/** S1: назначение сотрудников на проекты. */
|
|
30
|
+
const S1_VALUE = [
|
|
31
|
+
[TUPLE_ID, 0, 0],
|
|
32
|
+
[TUPLE_ID, 0, 1],
|
|
33
|
+
[TUPLE_ID, 1, 0]
|
|
34
|
+
] as const;
|
|
35
|
+
|
|
36
|
+
/** S2: подчинённость (цепочка 0→1→2). */
|
|
37
|
+
const S2_VALUE = [
|
|
38
|
+
[TUPLE_ID, 0, 1],
|
|
39
|
+
[TUPLE_ID, 1, 2]
|
|
40
|
+
] as const;
|
|
41
|
+
|
|
42
|
+
async function buildSchema(client: RSToolWrapperClient): Promise<string> {
|
|
43
|
+
const session = await client.call<{ sessionId: string }>('createSession');
|
|
44
|
+
|
|
45
|
+
const drafts: AddOrUpdateConstituentaInput[] = [
|
|
46
|
+
{
|
|
47
|
+
draft: {
|
|
48
|
+
id: T1_ID,
|
|
49
|
+
alias: 'T1',
|
|
50
|
+
cstType: CstType.STATEMENT,
|
|
51
|
+
definitionFormal: '1=1',
|
|
52
|
+
term: 'Применение шаблонов банка выражений',
|
|
53
|
+
convention:
|
|
54
|
+
'Подстановка радикалов БВ: R1→X1, R2→X2. Отношение σ→S1 или S2. Примеры: БВ F6→F_IMAGE, БВ F20→F_SOURCES, БВ P5→P_FUNCTION'
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
draft: {
|
|
59
|
+
id: X1_ID,
|
|
60
|
+
alias: 'X1',
|
|
61
|
+
cstType: CstType.BASE,
|
|
62
|
+
definitionFormal: '',
|
|
63
|
+
term: 'сотрудники'
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
draft: {
|
|
68
|
+
id: X2_ID,
|
|
69
|
+
alias: 'X2',
|
|
70
|
+
cstType: CstType.BASE,
|
|
71
|
+
definitionFormal: '',
|
|
72
|
+
term: 'проекты'
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
draft: {
|
|
77
|
+
id: S1_ID,
|
|
78
|
+
alias: 'S1',
|
|
79
|
+
cstType: CstType.STRUCTURED,
|
|
80
|
+
definitionFormal: 'ℬ(X1×X2)',
|
|
81
|
+
term: 'назначение на проект',
|
|
82
|
+
convention: 'σ в шаблонах БВ для бинарных отношений двух множеств'
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
draft: {
|
|
87
|
+
id: S2_ID,
|
|
88
|
+
alias: 'S2',
|
|
89
|
+
cstType: CstType.STRUCTURED,
|
|
90
|
+
definitionFormal: 'ℬ(X1×X1)',
|
|
91
|
+
term: 'подчинённость',
|
|
92
|
+
convention: 'σ в шаблонах БВ для бинарных отношений на одном множестве'
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
draft: {
|
|
97
|
+
id: F_IMAGE_ID,
|
|
98
|
+
alias: 'F_IMAGE',
|
|
99
|
+
cstType: CstType.FUNCTION,
|
|
100
|
+
definitionFormal: '[α∈X1, σ∈ℬ(X1×X2)] Pr2(Fi1[{α}](σ))',
|
|
101
|
+
term: 'проекты сотрудника',
|
|
102
|
+
convention: 'БВ F6: R1→X1, R2→X2'
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
draft: {
|
|
107
|
+
id: F_SOURCES_ID,
|
|
108
|
+
alias: 'F_SOURCES',
|
|
109
|
+
cstType: CstType.FUNCTION,
|
|
110
|
+
definitionFormal: '[σ∈ℬ(X1×X1)] Pr1(σ) \\ Pr2(σ)',
|
|
111
|
+
term: 'вершины без предшественников',
|
|
112
|
+
convention: 'БВ F20 (истоки графа подчинённости)'
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
draft: {
|
|
117
|
+
id: P_FUNCTION_ID,
|
|
118
|
+
alias: 'P_FUNCTION',
|
|
119
|
+
cstType: CstType.PREDICATE,
|
|
120
|
+
definitionFormal: '[α∈ℬ(X1), σ∈ℬ(X1×X2)] card(Pr1(σ)) = card(σ) & Pr1(σ) = α',
|
|
121
|
+
term: 'тотальная функция X1→X2',
|
|
122
|
+
convention: 'БВ P5'
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
draft: {
|
|
127
|
+
id: D1_ID,
|
|
128
|
+
alias: 'D1',
|
|
129
|
+
cstType: CstType.TERM,
|
|
130
|
+
definitionFormal: 'Pr2(Fi1[X1](S1))',
|
|
131
|
+
term: 'все назначенные проекты',
|
|
132
|
+
convention: 'БВ F9: образ множества X1 по S1'
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
draft: {
|
|
137
|
+
id: D2_ID,
|
|
138
|
+
alias: 'D2',
|
|
139
|
+
cstType: CstType.TERM,
|
|
140
|
+
definitionFormal: 'Pr1(S2) \\ Pr2(S2)',
|
|
141
|
+
term: 'глава иерархии',
|
|
142
|
+
convention: 'БВ F20: применение к S2 (развёрнуто в D2, т.к. вызов F# в терме не анализируется)'
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
];
|
|
146
|
+
|
|
147
|
+
for (const input of drafts) {
|
|
148
|
+
const result = await client.call<{
|
|
149
|
+
state: { analysis: { success: boolean } };
|
|
150
|
+
diagnostics: unknown[];
|
|
151
|
+
}>('addOrUpdateConstituenta', {
|
|
152
|
+
sessionId: session.sessionId,
|
|
153
|
+
input
|
|
154
|
+
});
|
|
155
|
+
if (!result.state.analysis.success) {
|
|
156
|
+
throw new Error(`${input.draft.alias}: analysis failed`);
|
|
157
|
+
}
|
|
158
|
+
console.log(`${input.draft.alias}: OK`);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
await client.call('commitStep', {
|
|
162
|
+
sessionId: session.sessionId,
|
|
163
|
+
message: 'Применение шаблонов БВ: сотрудники, проекты, F6/F9/F20/P5'
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
return session.sessionId;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
async function verifyModel(client: RSToolWrapperClient, schemaJson: string) {
|
|
170
|
+
const imported = await client.call<{ sessionId: string }>('importSession', {
|
|
171
|
+
payload: schemaJson
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
await client.call('setConstituentaValues', {
|
|
175
|
+
sessionId: imported.sessionId,
|
|
176
|
+
input: {
|
|
177
|
+
items: [
|
|
178
|
+
{ target: X1_ID, value: X1_BINDING },
|
|
179
|
+
{ target: X2_ID, value: X2_BINDING },
|
|
180
|
+
{ target: S1_ID, value: S1_VALUE },
|
|
181
|
+
{ target: S2_ID, value: S2_VALUE }
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
const recalculated = await client.call<{
|
|
187
|
+
items: { id: number; alias: string; value: unknown; status: number }[];
|
|
188
|
+
}>('recalculateModel', {
|
|
189
|
+
sessionId: imported.sessionId
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
const d1 = recalculated.items.find(item => item.id === D1_ID);
|
|
193
|
+
const d2 = recalculated.items.find(item => item.id === D2_ID);
|
|
194
|
+
|
|
195
|
+
console.log('D1 (все проекты):', d1);
|
|
196
|
+
console.log('D2 (истоки S2):', d2);
|
|
197
|
+
|
|
198
|
+
if (!Array.isArray(d1?.value) || !d1.value.includes(0) || !d1.value.includes(1)) {
|
|
199
|
+
throw new Error(`Expected D1 to include projects 0 and 1; got ${JSON.stringify(d1)}`);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (!Array.isArray(d2?.value) || d2.value.length !== 1 || d2.value[0] !== 0) {
|
|
203
|
+
throw new Error(`Expected D2 = {0}; got ${JSON.stringify(d2)}`);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (d1?.status !== EvalStatus.HAS_DATA) {
|
|
207
|
+
throw new Error(`Expected D1 status HAS_DATA; got ${d1?.status}`);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
console.log('Model verification: OK');
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
async function run() {
|
|
214
|
+
const client = new RSToolWrapperClient({
|
|
215
|
+
cwd: resolve(process.cwd())
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
try {
|
|
219
|
+
await client.waitUntilReady();
|
|
220
|
+
const sessionId = await buildSchema(client);
|
|
221
|
+
|
|
222
|
+
const exported = await client.call<string>('exportSession', { sessionId });
|
|
223
|
+
const outputPath = resolve(process.cwd(), DEFAULT_RSFORM_SESSION_PATH);
|
|
224
|
+
await writeFile(outputPath, exported, 'utf8');
|
|
225
|
+
console.log(`Exported: ${outputPath}`);
|
|
226
|
+
|
|
227
|
+
await verifyModel(client, exported);
|
|
228
|
+
} finally {
|
|
229
|
+
await client.close();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
run().catch(error => {
|
|
234
|
+
console.error(error);
|
|
235
|
+
process.exit(1);
|
|
236
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Constituent ids in template-apply RSForm (instantiation of БВ rsforms/42). */
|
|
2
|
+
export const T1_ID = 1;
|
|
3
|
+
export const X1_ID = 2;
|
|
4
|
+
export const X2_ID = 3;
|
|
5
|
+
export const S1_ID = 4;
|
|
6
|
+
export const S2_ID = 5;
|
|
7
|
+
export const F_IMAGE_ID = 6;
|
|
8
|
+
export const F_SOURCES_ID = 7;
|
|
9
|
+
export const P_FUNCTION_ID = 8;
|
|
10
|
+
export const D1_ID = 9;
|
|
11
|
+
export const D2_ID = 10;
|
|
12
|
+
|
|
13
|
+
export const DEFAULT_RSFORM_SESSION_PATH = 'examples/template-apply/rsform-session.json';
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
{
|
|
2
|
+
"contractVersion": "1.4.0",
|
|
3
|
+
"state": {
|
|
4
|
+
"sessionId": "04678669-0343-4a1c-8238-3f0de2fc12f7",
|
|
5
|
+
"alias": "",
|
|
6
|
+
"title": "",
|
|
7
|
+
"comment": "",
|
|
8
|
+
"createdAt": "2026-06-22T11:29:09.607Z",
|
|
9
|
+
"updatedAt": "2026-06-22T11:29:09.628Z",
|
|
10
|
+
"revisions": [
|
|
11
|
+
{
|
|
12
|
+
"revisionId": "b577a24d-20ff-4056-992e-7662cb2e56cf",
|
|
13
|
+
"at": "2026-06-22T11:29:09.628Z",
|
|
14
|
+
"message": "Применение шаблонов БВ: сотрудники, проекты, F6/F9/F20/P5"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"items": [
|
|
18
|
+
{
|
|
19
|
+
"id": 1,
|
|
20
|
+
"alias": "T1",
|
|
21
|
+
"cstType": "statement",
|
|
22
|
+
"definitionFormal": "1=1",
|
|
23
|
+
"term": "Применение шаблонов банка выражений",
|
|
24
|
+
"convention": "Подстановка радикалов БВ: R1→X1, R2→X2. Отношение σ→S1 или S2. Примеры: БВ F6→F_IMAGE, БВ F20→F_SOURCES, БВ P5→P_FUNCTION",
|
|
25
|
+
"definitionText": "",
|
|
26
|
+
"analysis": {
|
|
27
|
+
"success": true,
|
|
28
|
+
"type": {
|
|
29
|
+
"typeID": 6
|
|
30
|
+
},
|
|
31
|
+
"valueClass": "value",
|
|
32
|
+
"diagnostics": []
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"id": 2,
|
|
37
|
+
"alias": "X1",
|
|
38
|
+
"cstType": "basic",
|
|
39
|
+
"definitionFormal": "",
|
|
40
|
+
"term": "сотрудники",
|
|
41
|
+
"definitionText": "",
|
|
42
|
+
"convention": "",
|
|
43
|
+
"analysis": {
|
|
44
|
+
"success": true,
|
|
45
|
+
"type": {
|
|
46
|
+
"typeID": 5,
|
|
47
|
+
"base": {
|
|
48
|
+
"typeID": 3,
|
|
49
|
+
"baseID": "X1"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"valueClass": "value",
|
|
53
|
+
"diagnostics": []
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"id": 3,
|
|
58
|
+
"alias": "X2",
|
|
59
|
+
"cstType": "basic",
|
|
60
|
+
"definitionFormal": "",
|
|
61
|
+
"term": "проекты",
|
|
62
|
+
"definitionText": "",
|
|
63
|
+
"convention": "",
|
|
64
|
+
"analysis": {
|
|
65
|
+
"success": true,
|
|
66
|
+
"type": {
|
|
67
|
+
"typeID": 5,
|
|
68
|
+
"base": {
|
|
69
|
+
"typeID": 3,
|
|
70
|
+
"baseID": "X2"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"valueClass": "value",
|
|
74
|
+
"diagnostics": []
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id": 4,
|
|
79
|
+
"alias": "S1",
|
|
80
|
+
"cstType": "structure",
|
|
81
|
+
"definitionFormal": "ℬ(X1×X2)",
|
|
82
|
+
"term": "назначение на проект",
|
|
83
|
+
"convention": "σ в шаблонах БВ для бинарных отношений двух множеств",
|
|
84
|
+
"definitionText": "",
|
|
85
|
+
"analysis": {
|
|
86
|
+
"success": true,
|
|
87
|
+
"type": {
|
|
88
|
+
"typeID": 5,
|
|
89
|
+
"base": {
|
|
90
|
+
"typeID": 4,
|
|
91
|
+
"factors": [
|
|
92
|
+
{
|
|
93
|
+
"typeID": 3,
|
|
94
|
+
"baseID": "X1"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"typeID": 3,
|
|
98
|
+
"baseID": "X2"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"valueClass": "value",
|
|
104
|
+
"diagnostics": []
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"id": 5,
|
|
109
|
+
"alias": "S2",
|
|
110
|
+
"cstType": "structure",
|
|
111
|
+
"definitionFormal": "ℬ(X1×X1)",
|
|
112
|
+
"term": "подчинённость",
|
|
113
|
+
"convention": "σ в шаблонах БВ для бинарных отношений на одном множестве",
|
|
114
|
+
"definitionText": "",
|
|
115
|
+
"analysis": {
|
|
116
|
+
"success": true,
|
|
117
|
+
"type": {
|
|
118
|
+
"typeID": 5,
|
|
119
|
+
"base": {
|
|
120
|
+
"typeID": 4,
|
|
121
|
+
"factors": [
|
|
122
|
+
{
|
|
123
|
+
"typeID": 3,
|
|
124
|
+
"baseID": "X1"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"typeID": 3,
|
|
128
|
+
"baseID": "X1"
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"valueClass": "value",
|
|
134
|
+
"diagnostics": []
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"id": 6,
|
|
139
|
+
"alias": "F_IMAGE",
|
|
140
|
+
"cstType": "function",
|
|
141
|
+
"definitionFormal": "[α∈X1, σ∈ℬ(X1×X2)] Pr2(Fi1[{α}](σ))",
|
|
142
|
+
"term": "проекты сотрудника",
|
|
143
|
+
"convention": "БВ F6: R1→X1, R2→X2",
|
|
144
|
+
"definitionText": "",
|
|
145
|
+
"analysis": {
|
|
146
|
+
"success": true,
|
|
147
|
+
"type": {
|
|
148
|
+
"typeID": 7,
|
|
149
|
+
"result": {
|
|
150
|
+
"typeID": 5,
|
|
151
|
+
"base": {
|
|
152
|
+
"typeID": 3,
|
|
153
|
+
"baseID": "X2"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"args": [
|
|
157
|
+
{
|
|
158
|
+
"alias": "α",
|
|
159
|
+
"type": {
|
|
160
|
+
"typeID": 3,
|
|
161
|
+
"baseID": "X1"
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"alias": "σ",
|
|
166
|
+
"type": {
|
|
167
|
+
"typeID": 5,
|
|
168
|
+
"base": {
|
|
169
|
+
"typeID": 4,
|
|
170
|
+
"factors": [
|
|
171
|
+
{
|
|
172
|
+
"typeID": 3,
|
|
173
|
+
"baseID": "X1"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"typeID": 3,
|
|
177
|
+
"baseID": "X2"
|
|
178
|
+
}
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
},
|
|
185
|
+
"valueClass": "value",
|
|
186
|
+
"diagnostics": []
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"id": 7,
|
|
191
|
+
"alias": "F_SOURCES",
|
|
192
|
+
"cstType": "function",
|
|
193
|
+
"definitionFormal": "[σ∈ℬ(X1×X1)] Pr1(σ) \\ Pr2(σ)",
|
|
194
|
+
"term": "вершины без предшественников",
|
|
195
|
+
"convention": "БВ F20 (истоки графа подчинённости)",
|
|
196
|
+
"definitionText": "",
|
|
197
|
+
"analysis": {
|
|
198
|
+
"success": true,
|
|
199
|
+
"type": {
|
|
200
|
+
"typeID": 7,
|
|
201
|
+
"result": {
|
|
202
|
+
"typeID": 5,
|
|
203
|
+
"base": {
|
|
204
|
+
"typeID": 3,
|
|
205
|
+
"baseID": "X1"
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"args": [
|
|
209
|
+
{
|
|
210
|
+
"alias": "σ",
|
|
211
|
+
"type": {
|
|
212
|
+
"typeID": 5,
|
|
213
|
+
"base": {
|
|
214
|
+
"typeID": 4,
|
|
215
|
+
"factors": [
|
|
216
|
+
{
|
|
217
|
+
"typeID": 3,
|
|
218
|
+
"baseID": "X1"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"typeID": 3,
|
|
222
|
+
"baseID": "X1"
|
|
223
|
+
}
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
},
|
|
230
|
+
"valueClass": "value",
|
|
231
|
+
"diagnostics": []
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"id": 8,
|
|
236
|
+
"alias": "P_FUNCTION",
|
|
237
|
+
"cstType": "predicate",
|
|
238
|
+
"definitionFormal": "[α∈ℬ(X1), σ∈ℬ(X1×X2)] card(Pr1(σ)) = card(σ) & Pr1(σ) = α",
|
|
239
|
+
"term": "тотальная функция X1→X2",
|
|
240
|
+
"convention": "БВ P5",
|
|
241
|
+
"definitionText": "",
|
|
242
|
+
"analysis": {
|
|
243
|
+
"success": true,
|
|
244
|
+
"type": {
|
|
245
|
+
"typeID": 8,
|
|
246
|
+
"result": {
|
|
247
|
+
"typeID": 6
|
|
248
|
+
},
|
|
249
|
+
"args": [
|
|
250
|
+
{
|
|
251
|
+
"alias": "α",
|
|
252
|
+
"type": {
|
|
253
|
+
"typeID": 5,
|
|
254
|
+
"base": {
|
|
255
|
+
"typeID": 3,
|
|
256
|
+
"baseID": "X1"
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"alias": "σ",
|
|
262
|
+
"type": {
|
|
263
|
+
"typeID": 5,
|
|
264
|
+
"base": {
|
|
265
|
+
"typeID": 4,
|
|
266
|
+
"factors": [
|
|
267
|
+
{
|
|
268
|
+
"typeID": 3,
|
|
269
|
+
"baseID": "X1"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"typeID": 3,
|
|
273
|
+
"baseID": "X2"
|
|
274
|
+
}
|
|
275
|
+
]
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
]
|
|
280
|
+
},
|
|
281
|
+
"valueClass": "value",
|
|
282
|
+
"diagnostics": []
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"id": 9,
|
|
287
|
+
"alias": "D1",
|
|
288
|
+
"cstType": "term",
|
|
289
|
+
"definitionFormal": "Pr2(Fi1[X1](S1))",
|
|
290
|
+
"term": "все назначенные проекты",
|
|
291
|
+
"convention": "БВ F9: образ множества X1 по S1",
|
|
292
|
+
"definitionText": "",
|
|
293
|
+
"analysis": {
|
|
294
|
+
"success": true,
|
|
295
|
+
"type": {
|
|
296
|
+
"typeID": 5,
|
|
297
|
+
"base": {
|
|
298
|
+
"typeID": 3,
|
|
299
|
+
"baseID": "X2"
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
"valueClass": "value",
|
|
303
|
+
"diagnostics": []
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"id": 10,
|
|
308
|
+
"alias": "D2",
|
|
309
|
+
"cstType": "term",
|
|
310
|
+
"definitionFormal": "Pr1(S2) \\ Pr2(S2)",
|
|
311
|
+
"term": "глава иерархии",
|
|
312
|
+
"convention": "БВ F20: применение к S2 (развёрнуто в D2, т.к. вызов F# в терме не анализируется)",
|
|
313
|
+
"definitionText": "",
|
|
314
|
+
"analysis": {
|
|
315
|
+
"success": true,
|
|
316
|
+
"type": {
|
|
317
|
+
"typeID": 5,
|
|
318
|
+
"base": {
|
|
319
|
+
"typeID": 3,
|
|
320
|
+
"baseID": "X1"
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
"valueClass": "value",
|
|
324
|
+
"diagnostics": []
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
],
|
|
328
|
+
"model": {
|
|
329
|
+
"items": []
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
"diagnostics": []
|
|
333
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsconcept/rstool",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Agent-facing library for incremental RSForm construction, RSLang analysis, diagnostics, modeling, and evaluation. Wraps @rsconcept/domain with a deterministic session contract and stdio wrapper.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "IRBorisov",
|
|
@@ -56,15 +56,21 @@
|
|
|
56
56
|
"test": "vitest run",
|
|
57
57
|
"wrapper": "tsx src/wrapper/stdio-wrapper.ts",
|
|
58
58
|
"example:client": "tsx examples/agent-client.ts",
|
|
59
|
-
"example:build-schema": "tsx examples/build-
|
|
60
|
-
"example:build-rsmodel": "tsx examples/build-
|
|
61
|
-
"example:build-kinship-schema": "tsx examples/build-
|
|
62
|
-
"example:build-kinship-rsmodel": "tsx examples/build-
|
|
59
|
+
"example:build-schema": "tsx examples/sample/build-rsform.ts",
|
|
60
|
+
"example:build-rsmodel": "tsx examples/sample/build-rsmodel.ts",
|
|
61
|
+
"example:build-kinship-schema": "tsx examples/kinship/build-rsform.ts",
|
|
62
|
+
"example:build-kinship-rsmodel": "tsx examples/kinship/build-rsmodel.ts",
|
|
63
|
+
"example:build-chocolate-nim-schema": "tsx examples/chocolate-nim/build-rsform.ts",
|
|
64
|
+
"example:build-chocolate-nim-rsmodel": "tsx examples/chocolate-nim/build-rsmodel.ts",
|
|
65
|
+
"example:build-movd-schema": "tsx examples/movd/build-rsform.ts",
|
|
66
|
+
"example:build-movd-rsmodel": "tsx examples/movd/build-rsmodel.ts",
|
|
67
|
+
"example:build-expression-bank-schema": "tsx examples/expression-bank/build-rsform.ts",
|
|
68
|
+
"example:build-template-apply-schema": "tsx examples/template-apply/build-rsform.ts",
|
|
63
69
|
"kinship:cli": "tsx examples/kinship/cli.ts",
|
|
64
70
|
"prepublishOnly": "npm run build"
|
|
65
71
|
},
|
|
66
72
|
"dependencies": {
|
|
67
|
-
"@rsconcept/domain": "^1.4.
|
|
73
|
+
"@rsconcept/domain": "^1.4.3"
|
|
68
74
|
},
|
|
69
75
|
"devDependencies": {
|
|
70
76
|
"@types/node": "^25.9.4",
|
|
@@ -20,7 +20,7 @@ tool.addOrUpdateConstituenta(sessionId, {
|
|
|
20
20
|
alias: 'S1',
|
|
21
21
|
cstType: CstType.STRUCTURED,
|
|
22
22
|
definitionFormal: 'ℬ(X1×X1)',
|
|
23
|
-
convention: '
|
|
23
|
+
convention: 'Множество пар: родитель и его ребёнок из людей. Порядок в паре задаётся конвенцией.'
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
|
|
@@ -71,9 +71,9 @@ console.log(scratch.success, scratch.value); // true, 3
|
|
|
71
71
|
Синтаксис верен, но смысл неочевиден — собери маленькую модель и проверь значение.
|
|
72
72
|
|
|
73
73
|
```ts
|
|
74
|
+
import { TUPLE_ID } from '@rsconcept/domain';
|
|
74
75
|
import { CstType, EvalStatus, RSToolAgent } from '@rsconcept/rstool';
|
|
75
76
|
|
|
76
|
-
const TUPLE_ID = -111;
|
|
77
77
|
const tool = new RSToolAgent();
|
|
78
78
|
const { sessionId } = tool.createSession();
|
|
79
79
|
|
|
File without changes
|
|
File without changes
|