@rsconcept/rstool 0.10.3 → 1.0.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 +61 -33
- package/dist/agent-workflow-Gk0Vfnv1.d.ts +64 -0
- package/dist/analysis-LLnPhmGa.d.ts +23 -0
- package/dist/{common-DxLg3eXX.d.ts → common-DHJalS-Q.d.ts} +6 -1
- package/dist/constituenta-DnGR6bnM.d.ts +54 -0
- package/dist/diagnostic-D9yl_mEL.d.ts +19 -0
- package/dist/evaluation-Cns8BFm4.d.ts +31 -0
- package/dist/index.d.ts +11 -11
- package/dist/index.js +1 -2
- package/dist/mappers/model-adapter.d.ts +3 -3
- package/dist/mappers/schema-adapter.d.ts +4 -4
- package/dist/mappers/types.d.ts +6 -2
- package/dist/mappers/types.js +2 -0
- package/dist/mappers/types.js.map +1 -1
- package/dist/{model-value-SFAVj0dw.d.ts → model-value-BbonPzMz.d.ts} +14 -3
- package/dist/models/agent-workflow.d.ts +2 -0
- package/dist/models/agent-workflow.js +1 -0
- package/dist/models/analysis.d.ts +1 -1
- package/dist/models/common.d.ts +1 -1
- package/dist/models/constituenta.d.ts +2 -2
- package/dist/models/diagnostic.d.ts +1 -1
- package/dist/models/evaluation.d.ts +2 -2
- package/dist/models/index.d.ts +11 -11
- package/dist/models/index.js +2 -2
- package/dist/models/model-value.d.ts +2 -2
- 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 +2 -2
- package/dist/models/tool-contract.js +2 -1
- package/dist/models/tool-contract.js.map +1 -1
- package/dist/models-Bw6Uum8i.js +685 -0
- package/dist/models-Bw6Uum8i.js.map +1 -0
- package/dist/rstool-agent-D2cQze_b.d.ts +71 -0
- package/dist/session/session-store.d.ts +18 -5
- package/dist/session/session-store.js +1 -64
- package/dist/{session-BPgsE80c.d.ts → session-ChexW8i7.d.ts} +11 -8
- package/dist/tool-contract-0uRGhEfW.d.ts +164 -0
- package/dist/wrapper/client.d.ts +23 -0
- package/dist/wrapper/client.js +17 -0
- package/dist/wrapper/client.js.map +1 -1
- package/dist/wrapper/stdio-wrapper.js +75 -63
- package/dist/wrapper/stdio-wrapper.js.map +1 -1
- package/docs/CONSTITUENTA.md +2 -2
- package/docs/DIAGNOSTICS.md +6 -5
- package/docs/MODEL-TESTING.md +3 -3
- package/docs/PORTAL-API.md +24 -18
- package/examples/README.md +1 -1
- package/examples/agent-client.ts +11 -41
- package/examples/build-chocolate-nim-rsform.ts +21 -70
- package/examples/chocolate-nim/build-rsform.ts +23 -18
- package/examples/chocolate-nim/build-rsmodel.ts +10 -12
- package/examples/chocolate-nim/rsform-session.json +290 -290
- package/examples/chocolate-nim/rsmodel-session.json +291 -291
- package/examples/expression-bank/bank-constituents.ts +304 -53
- package/examples/expression-bank/build-rsform.ts +19 -16
- package/examples/expression-bank/rsform-session.json +1551 -1551
- package/examples/kinship/build-rsform.ts +23 -18
- package/examples/kinship/build-rsmodel.ts +16 -16
- package/examples/kinship/rsform-session.json +219 -219
- package/examples/kinship/rsmodel-session.json +221 -221
- package/examples/kinship/session.ts +19 -21
- package/examples/movd/build-rsform.ts +23 -18
- package/examples/movd/build-rsmodel.ts +18 -20
- package/examples/movd/rsform-session.json +262 -262
- package/examples/movd/rsmodel-session.json +264 -264
- package/examples/sample/build-rsform.ts +18 -51
- package/examples/sample/build-rsmodel.ts +25 -44
- package/examples/sample/rsform-session.json +10 -7
- package/examples/sample/rsmodel-session.json +36 -33
- package/examples/template-apply/build-rsform.ts +27 -24
- package/examples/template-apply/rsform-session.json +48 -48
- package/package.json +4 -2
- package/skills/rstool-helper/EXAMPLES.md +44 -116
- package/skills/rstool-helper/GUIDE.md +40 -25
- package/skills/rstool-helper/REFERENCE.md +40 -177
- package/src/index.ts +24 -17
- package/src/mappers/portal-adapter.ts +49 -0
- package/src/mappers/types.ts +4 -0
- package/src/models/agent-workflow.ts +66 -0
- package/src/models/analysis.ts +7 -0
- package/src/models/common.ts +7 -0
- package/src/models/constituenta.ts +24 -6
- package/src/models/diagnostic.ts +4 -0
- package/src/models/evaluation.ts +11 -0
- package/src/models/import-detect.test.ts +66 -0
- package/src/models/import-detect.ts +42 -0
- package/src/models/import-export.ts +24 -0
- package/src/models/index.ts +22 -14
- package/src/models/model-value.ts +12 -0
- package/src/models/portal-json.test.ts +38 -0
- package/src/models/portal-json.ts +54 -1
- package/src/models/rstool-agent.test.ts +698 -146
- package/src/models/rstool-agent.ts +392 -92
- package/src/models/session.ts +8 -5
- package/src/models/tool-contract.ts +81 -42
- package/src/session/batch-apply.test.ts +123 -0
- package/src/session/batch-apply.ts +82 -0
- package/src/session/persistence.test.ts +63 -0
- package/src/session/persistence.ts +69 -0
- package/src/session/session-store.ts +76 -6
- package/src/wrapper/client.test.ts +58 -0
- package/src/wrapper/client.ts +23 -0
- package/src/wrapper/stdio-handler.test.ts +101 -0
- package/src/wrapper/stdio-handler.ts +195 -0
- package/src/wrapper/stdio-wrapper.ts +4 -187
- package/dist/analysis-JiwOYDKx.d.ts +0 -16
- package/dist/constituenta-Dnd6iToB.d.ts +0 -36
- package/dist/diagnostic-BMYvciz8.d.ts +0 -15
- package/dist/evaluation-CCVYH0wA.d.ts +0 -21
- package/dist/index-uhkmwruf.d.ts +0 -46
- package/dist/rstool-agent-BZi5jO1y.js +0 -158
- package/dist/rstool-agent-BZi5jO1y.js.map +0 -1
- package/dist/rstool-agent-pRaPnZay.d.ts +0 -35
- package/dist/session/session-store.js.map +0 -1
- package/dist/tool-contract-n1ghUOrK.d.ts +0 -32
|
@@ -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
|
|
4
|
+
import { CstType, RSToolWrapperClient, type AgentConstituentaPatch, type ApplySchemaPatchResult } from '../../src';
|
|
5
5
|
|
|
6
6
|
async function run() {
|
|
7
7
|
const client = new RSToolWrapperClient({
|
|
@@ -12,61 +12,28 @@ async function run() {
|
|
|
12
12
|
await client.waitUntilReady();
|
|
13
13
|
const session = await client.call<{ sessionId: string; contractVersion: string }>('createSession');
|
|
14
14
|
|
|
15
|
-
const
|
|
15
|
+
const items: AgentConstituentaPatch[] = [
|
|
16
|
+
{ id: 1, alias: 'X1', cstType: CstType.BASE, definitionFormal: '' },
|
|
17
|
+
{ id: 2, alias: 'C1', cstType: CstType.CONSTANT, definitionFormal: '' },
|
|
16
18
|
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
19
|
+
id: 3,
|
|
20
|
+
alias: 'S1',
|
|
21
|
+
cstType: CstType.STRUCTURED,
|
|
22
|
+
definitionFormal: 'ℬ(X1×X1)',
|
|
23
|
+
convention: 'Pairs (parent, child) over X1.'
|
|
23
24
|
},
|
|
24
|
-
{
|
|
25
|
-
|
|
26
|
-
id: 2,
|
|
27
|
-
alias: 'C1',
|
|
28
|
-
cstType: CstType.CONSTANT,
|
|
29
|
-
definitionFormal: ''
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
draft: {
|
|
34
|
-
id: 3,
|
|
35
|
-
alias: 'S1',
|
|
36
|
-
cstType: CstType.STRUCTURED,
|
|
37
|
-
definitionFormal: 'ℬ(X1×X1)',
|
|
38
|
-
convention: 'Pairs (parent, child) over X1.'
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
draft: {
|
|
43
|
-
id: 4,
|
|
44
|
-
alias: 'D1',
|
|
45
|
-
cstType: CstType.TERM,
|
|
46
|
-
definitionFormal: 'Pr1(S1)'
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
draft: {
|
|
51
|
-
id: 5,
|
|
52
|
-
alias: 'A1',
|
|
53
|
-
cstType: CstType.AXIOM,
|
|
54
|
-
definitionFormal: '1=1'
|
|
55
|
-
}
|
|
56
|
-
}
|
|
25
|
+
{ id: 4, alias: 'D1', cstType: CstType.TERM, definitionFormal: 'Pr1(S1)' },
|
|
26
|
+
{ id: 5, alias: 'A1', cstType: CstType.AXIOM, definitionFormal: '1=1' }
|
|
57
27
|
];
|
|
58
28
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
console.log(
|
|
65
|
-
`Added ${input.draft.alias}:`,
|
|
66
|
-
(result as { diagnostics?: unknown[] }).diagnostics?.length ?? 0,
|
|
67
|
-
'diagnostics'
|
|
68
|
-
);
|
|
29
|
+
const result = await client.call<ApplySchemaPatchResult>('applySchemaPatch', {
|
|
30
|
+
sessionId: session.sessionId,
|
|
31
|
+
items
|
|
32
|
+
});
|
|
33
|
+
for (const item of result.summary.items) {
|
|
34
|
+
console.log(`Added ${item.alias}`);
|
|
69
35
|
}
|
|
36
|
+
console.log(`Patch diagnostics: ${result.diagnostics.length}`);
|
|
70
37
|
|
|
71
38
|
await client.call('commitStep', {
|
|
72
39
|
sessionId: session.sessionId,
|
|
@@ -3,7 +3,7 @@ import { resolve } from 'node:path';
|
|
|
3
3
|
|
|
4
4
|
import { TUPLE_ID } from '@rsconcept/domain';
|
|
5
5
|
|
|
6
|
-
import { CstType, RSToolWrapperClient, type
|
|
6
|
+
import { CstType, RSToolWrapperClient, type AgentConstituentaPatch } from '../../src';
|
|
7
7
|
|
|
8
8
|
async function run() {
|
|
9
9
|
const client = new RSToolWrapperClient({
|
|
@@ -14,63 +14,44 @@ async function run() {
|
|
|
14
14
|
await client.waitUntilReady();
|
|
15
15
|
const session = await client.call<{ sessionId: string; contractVersion: string }>('createSession');
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const items: AgentConstituentaPatch[] = [
|
|
18
|
+
{ id: 1, alias: 'X1', cstType: CstType.BASE, definitionFormal: '' },
|
|
19
|
+
{ id: 2, alias: 'C1', cstType: CstType.CONSTANT, definitionFormal: '' },
|
|
18
20
|
{
|
|
19
|
-
|
|
21
|
+
id: 3,
|
|
22
|
+
alias: 'S1',
|
|
23
|
+
cstType: CstType.STRUCTURED,
|
|
24
|
+
definitionFormal: 'ℬ(X1×X1)',
|
|
25
|
+
convention: 'Pairs (parent, child) over X1.'
|
|
20
26
|
},
|
|
21
|
-
{
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
draft: {
|
|
26
|
-
id: 3,
|
|
27
|
-
alias: 'S1',
|
|
28
|
-
cstType: CstType.STRUCTURED,
|
|
29
|
-
definitionFormal: 'ℬ(X1×X1)',
|
|
30
|
-
convention: 'Pairs (parent, child) over X1.'
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
draft: { id: 4, alias: 'D1', cstType: CstType.TERM, definitionFormal: 'Pr1(S1)' }
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
draft: { id: 5, alias: 'A1', cstType: CstType.AXIOM, definitionFormal: '1=1' }
|
|
38
|
-
}
|
|
27
|
+
{ id: 4, alias: 'D1', cstType: CstType.TERM, definitionFormal: 'Pr1(S1)' },
|
|
28
|
+
{ id: 5, alias: 'A1', cstType: CstType.AXIOM, definitionFormal: '1=1' }
|
|
39
29
|
];
|
|
40
30
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
});
|
|
46
|
-
console.log(
|
|
47
|
-
`Added ${input.draft.alias}:`,
|
|
48
|
-
(result as { diagnostics?: unknown[] }).diagnostics?.length ?? 0,
|
|
49
|
-
'diagnostics'
|
|
50
|
-
);
|
|
51
|
-
}
|
|
31
|
+
await client.call('applySchemaPatch', {
|
|
32
|
+
sessionId: session.sessionId,
|
|
33
|
+
items
|
|
34
|
+
});
|
|
52
35
|
|
|
53
|
-
const model = await client.call('
|
|
36
|
+
const model = await client.call('setModelValues', {
|
|
54
37
|
sessionId: session.sessionId,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
]
|
|
61
|
-
}
|
|
38
|
+
set: [
|
|
39
|
+
{ target: 1, value: { 0: 'alice', 1: 'bob' } },
|
|
40
|
+
{ target: 2, value: { 0: 'zero', 1: 'one', 2: 'two' } },
|
|
41
|
+
{ target: 3, value: [[TUPLE_ID, 0, 1]] }
|
|
42
|
+
]
|
|
62
43
|
});
|
|
63
44
|
console.log('Model values set:', model);
|
|
64
45
|
|
|
65
|
-
const d1Eval = await client.call('
|
|
46
|
+
const d1Eval = await client.call('evaluate', {
|
|
66
47
|
sessionId: session.sessionId,
|
|
67
|
-
|
|
48
|
+
constituentId: 4
|
|
68
49
|
});
|
|
69
50
|
console.log('D1 (Pr1(S1)) evaluation:', d1Eval);
|
|
70
51
|
|
|
71
|
-
const a1Eval = await client.call('
|
|
52
|
+
const a1Eval = await client.call('evaluate', {
|
|
72
53
|
sessionId: session.sessionId,
|
|
73
|
-
|
|
54
|
+
constituentId: 5
|
|
74
55
|
});
|
|
75
56
|
console.log('A1 (1=1) evaluation:', a1Eval);
|
|
76
57
|
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
"contractVersion": "
|
|
2
|
+
"contractVersion": "2.0.0",
|
|
3
3
|
"state": {
|
|
4
|
-
"sessionId": "
|
|
5
|
-
"
|
|
6
|
-
"
|
|
4
|
+
"sessionId": "a03eec4c-6519-4088-9d8c-0a9c11611583",
|
|
5
|
+
"alias": "",
|
|
6
|
+
"title": "",
|
|
7
|
+
"comment": "",
|
|
8
|
+
"createdAt": "2026-07-01T21:33:21.321Z",
|
|
9
|
+
"updatedAt": "2026-07-01T21:33:21.332Z",
|
|
7
10
|
"revisions": [
|
|
8
11
|
{
|
|
9
|
-
"revisionId": "
|
|
10
|
-
"at": "2026-
|
|
12
|
+
"revisionId": "4ec113d2-1d28-4bac-bed8-6a593bb6b0e2",
|
|
13
|
+
"at": "2026-07-01T21:33:21.332Z",
|
|
11
14
|
"message": "Built sample RSForm"
|
|
12
15
|
}
|
|
13
16
|
],
|
|
@@ -62,9 +65,9 @@
|
|
|
62
65
|
"alias": "S1",
|
|
63
66
|
"cstType": "structure",
|
|
64
67
|
"definitionFormal": "ℬ(X1×X1)",
|
|
65
|
-
"convention": "Pairs (parent, child) over X1.",
|
|
66
68
|
"term": "",
|
|
67
69
|
"definitionText": "",
|
|
70
|
+
"convention": "Pairs (parent, child) over X1.",
|
|
68
71
|
"analysis": {
|
|
69
72
|
"success": true,
|
|
70
73
|
"type": {
|
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
{
|
|
2
|
-
"contractVersion": "
|
|
2
|
+
"contractVersion": "2.0.0",
|
|
3
3
|
"state": {
|
|
4
|
-
"sessionId": "
|
|
5
|
-
"
|
|
6
|
-
"
|
|
4
|
+
"sessionId": "4de6414b-d6a7-45c9-b950-2e622e0caa0e",
|
|
5
|
+
"alias": "",
|
|
6
|
+
"title": "",
|
|
7
|
+
"comment": "",
|
|
8
|
+
"createdAt": "2026-07-01T17:13:04.299Z",
|
|
9
|
+
"updatedAt": "2026-07-01T17:13:04.322Z",
|
|
7
10
|
"revisions": [
|
|
8
11
|
{
|
|
9
|
-
"revisionId": "
|
|
10
|
-
"at": "2026-
|
|
12
|
+
"revisionId": "9a11d6ff-a181-4680-b706-1507d776c5ac",
|
|
13
|
+
"at": "2026-07-01T17:13:04.322Z",
|
|
11
14
|
"message": "Built sample RSModel"
|
|
12
15
|
}
|
|
13
16
|
],
|
|
14
17
|
"items": [
|
|
15
18
|
{
|
|
16
|
-
"id":
|
|
17
|
-
"alias": "
|
|
18
|
-
"cstType": "
|
|
19
|
-
"definitionFormal": "",
|
|
19
|
+
"id": 5,
|
|
20
|
+
"alias": "A1",
|
|
21
|
+
"cstType": "axiom",
|
|
22
|
+
"definitionFormal": "1=1",
|
|
20
23
|
"term": "",
|
|
21
24
|
"definitionText": "",
|
|
22
25
|
"convention": "",
|
|
23
26
|
"analysis": {
|
|
24
27
|
"success": true,
|
|
25
28
|
"type": {
|
|
26
|
-
"typeID":
|
|
27
|
-
"base": {
|
|
28
|
-
"typeID": 3,
|
|
29
|
-
"baseID": "X1"
|
|
30
|
-
}
|
|
29
|
+
"typeID": 6
|
|
31
30
|
},
|
|
32
31
|
"valueClass": "value",
|
|
33
32
|
"diagnostics": []
|
|
@@ -57,14 +56,35 @@
|
|
|
57
56
|
"diagnostics": []
|
|
58
57
|
}
|
|
59
58
|
},
|
|
59
|
+
{
|
|
60
|
+
"id": 1,
|
|
61
|
+
"alias": "X1",
|
|
62
|
+
"cstType": "basic",
|
|
63
|
+
"definitionFormal": "",
|
|
64
|
+
"term": "",
|
|
65
|
+
"definitionText": "",
|
|
66
|
+
"convention": "",
|
|
67
|
+
"analysis": {
|
|
68
|
+
"success": true,
|
|
69
|
+
"type": {
|
|
70
|
+
"typeID": 5,
|
|
71
|
+
"base": {
|
|
72
|
+
"typeID": 3,
|
|
73
|
+
"baseID": "X1"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"valueClass": "value",
|
|
77
|
+
"diagnostics": []
|
|
78
|
+
}
|
|
79
|
+
},
|
|
60
80
|
{
|
|
61
81
|
"id": 3,
|
|
62
82
|
"alias": "S1",
|
|
63
83
|
"cstType": "structure",
|
|
64
84
|
"definitionFormal": "ℬ(X1×X1)",
|
|
65
|
-
"convention": "Pairs (parent, child) over X1.",
|
|
66
85
|
"term": "",
|
|
67
86
|
"definitionText": "",
|
|
87
|
+
"convention": "Pairs (parent, child) over X1.",
|
|
68
88
|
"analysis": {
|
|
69
89
|
"success": true,
|
|
70
90
|
"type": {
|
|
@@ -107,23 +127,6 @@
|
|
|
107
127
|
"valueClass": "value",
|
|
108
128
|
"diagnostics": []
|
|
109
129
|
}
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
"id": 5,
|
|
113
|
-
"alias": "A1",
|
|
114
|
-
"cstType": "axiom",
|
|
115
|
-
"definitionFormal": "1=1",
|
|
116
|
-
"term": "",
|
|
117
|
-
"definitionText": "",
|
|
118
|
-
"convention": "",
|
|
119
|
-
"analysis": {
|
|
120
|
-
"success": true,
|
|
121
|
-
"type": {
|
|
122
|
-
"typeID": 6
|
|
123
|
-
},
|
|
124
|
-
"valueClass": "value",
|
|
125
|
-
"diagnostics": []
|
|
126
|
-
}
|
|
127
130
|
}
|
|
128
131
|
],
|
|
129
132
|
"model": {
|
|
@@ -3,7 +3,9 @@ import { resolve } from 'node:path';
|
|
|
3
3
|
|
|
4
4
|
import { TUPLE_ID } from '@rsconcept/domain';
|
|
5
5
|
|
|
6
|
-
import { CstType, EvalStatus, RSToolWrapperClient, type
|
|
6
|
+
import { CstType, EvalStatus, RSToolWrapperClient, type AgentConstituentaPatch } from '../../src';
|
|
7
|
+
|
|
8
|
+
type DraftBatch = { draft: AgentConstituentaPatch };
|
|
7
9
|
|
|
8
10
|
import {
|
|
9
11
|
D1_ID,
|
|
@@ -42,7 +44,7 @@ const S2_VALUE = [
|
|
|
42
44
|
async function buildSchema(client: RSToolWrapperClient): Promise<string> {
|
|
43
45
|
const session = await client.call<{ sessionId: string }>('createSession');
|
|
44
46
|
|
|
45
|
-
const drafts:
|
|
47
|
+
const drafts: DraftBatch[] = [
|
|
46
48
|
{
|
|
47
49
|
draft: {
|
|
48
50
|
id: T1_ID,
|
|
@@ -144,18 +146,21 @@ async function buildSchema(client: RSToolWrapperClient): Promise<string> {
|
|
|
144
146
|
}
|
|
145
147
|
];
|
|
146
148
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
149
|
+
const patch = await client.call<{
|
|
150
|
+
success: boolean;
|
|
151
|
+
summary: { items: Array<{ alias: string; analysisSuccess: boolean }> };
|
|
152
|
+
failed: Array<{ draft: { alias: string } }>;
|
|
153
|
+
}>('applySchemaPatch', {
|
|
154
|
+
sessionId: session.sessionId,
|
|
155
|
+
mode: 'atomic',
|
|
156
|
+
items: drafts.map(entry => entry.draft)
|
|
157
|
+
});
|
|
158
|
+
if (!patch.success) {
|
|
159
|
+
const failedAlias = patch.failed[0]?.draft.alias ?? 'unknown';
|
|
160
|
+
throw new Error(`${failedAlias}: analysis failed`);
|
|
161
|
+
}
|
|
162
|
+
for (const item of patch.summary.items) {
|
|
163
|
+
console.log(`${item.alias}: OK`);
|
|
159
164
|
}
|
|
160
165
|
|
|
161
166
|
await client.call('commitStep', {
|
|
@@ -167,20 +172,18 @@ async function buildSchema(client: RSToolWrapperClient): Promise<string> {
|
|
|
167
172
|
}
|
|
168
173
|
|
|
169
174
|
async function verifyModel(client: RSToolWrapperClient, schemaJson: string) {
|
|
170
|
-
const imported = await client.call<{ sessionId: string }>('
|
|
175
|
+
const imported = await client.call<{ sessionId: string }>('importData', {
|
|
171
176
|
payload: schemaJson
|
|
172
177
|
});
|
|
173
178
|
|
|
174
|
-
await client.call('
|
|
179
|
+
await client.call('setModelValues', {
|
|
175
180
|
sessionId: imported.sessionId,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
]
|
|
183
|
-
}
|
|
181
|
+
set: [
|
|
182
|
+
{ target: X1_ID, value: X1_BINDING },
|
|
183
|
+
{ target: X2_ID, value: X2_BINDING },
|
|
184
|
+
{ target: S1_ID, value: S1_VALUE },
|
|
185
|
+
{ target: S2_ID, value: S2_VALUE }
|
|
186
|
+
]
|
|
184
187
|
});
|
|
185
188
|
|
|
186
189
|
const recalculated = await client.call<{
|
|
@@ -1,43 +1,26 @@
|
|
|
1
1
|
{
|
|
2
|
-
"contractVersion": "
|
|
2
|
+
"contractVersion": "2.0.0",
|
|
3
3
|
"state": {
|
|
4
|
-
"sessionId": "
|
|
4
|
+
"sessionId": "b72f75c0-4f17-4bef-9ff3-913ea16191db",
|
|
5
5
|
"alias": "",
|
|
6
6
|
"title": "",
|
|
7
7
|
"comment": "",
|
|
8
|
-
"createdAt": "2026-
|
|
9
|
-
"updatedAt": "2026-
|
|
8
|
+
"createdAt": "2026-07-01T17:12:54.696Z",
|
|
9
|
+
"updatedAt": "2026-07-01T17:12:54.714Z",
|
|
10
10
|
"revisions": [
|
|
11
11
|
{
|
|
12
|
-
"revisionId": "
|
|
13
|
-
"at": "2026-
|
|
12
|
+
"revisionId": "e85ad551-0aa0-42d9-b55d-01719aed6533",
|
|
13
|
+
"at": "2026-07-01T17:12:54.714Z",
|
|
14
14
|
"message": "Применение шаблонов БВ: сотрудники, проекты, F6/F9/F20/P5"
|
|
15
15
|
}
|
|
16
16
|
],
|
|
17
17
|
"items": [
|
|
18
18
|
{
|
|
19
|
-
"id":
|
|
20
|
-
"alias": "
|
|
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",
|
|
19
|
+
"id": 3,
|
|
20
|
+
"alias": "X2",
|
|
38
21
|
"cstType": "basic",
|
|
39
22
|
"definitionFormal": "",
|
|
40
|
-
"term": "
|
|
23
|
+
"term": "проекты",
|
|
41
24
|
"definitionText": "",
|
|
42
25
|
"convention": "",
|
|
43
26
|
"analysis": {
|
|
@@ -46,7 +29,7 @@
|
|
|
46
29
|
"typeID": 5,
|
|
47
30
|
"base": {
|
|
48
31
|
"typeID": 3,
|
|
49
|
-
"baseID": "
|
|
32
|
+
"baseID": "X2"
|
|
50
33
|
}
|
|
51
34
|
},
|
|
52
35
|
"valueClass": "value",
|
|
@@ -54,11 +37,11 @@
|
|
|
54
37
|
}
|
|
55
38
|
},
|
|
56
39
|
{
|
|
57
|
-
"id":
|
|
58
|
-
"alias": "
|
|
40
|
+
"id": 2,
|
|
41
|
+
"alias": "X1",
|
|
59
42
|
"cstType": "basic",
|
|
60
43
|
"definitionFormal": "",
|
|
61
|
-
"term": "
|
|
44
|
+
"term": "сотрудники",
|
|
62
45
|
"definitionText": "",
|
|
63
46
|
"convention": "",
|
|
64
47
|
"analysis": {
|
|
@@ -67,7 +50,7 @@
|
|
|
67
50
|
"typeID": 5,
|
|
68
51
|
"base": {
|
|
69
52
|
"typeID": 3,
|
|
70
|
-
"baseID": "
|
|
53
|
+
"baseID": "X1"
|
|
71
54
|
}
|
|
72
55
|
},
|
|
73
56
|
"valueClass": "value",
|
|
@@ -80,8 +63,8 @@
|
|
|
80
63
|
"cstType": "structure",
|
|
81
64
|
"definitionFormal": "ℬ(X1×X2)",
|
|
82
65
|
"term": "назначение на проект",
|
|
83
|
-
"convention": "σ в шаблонах БВ для бинарных отношений двух множеств",
|
|
84
66
|
"definitionText": "",
|
|
67
|
+
"convention": "σ в шаблонах БВ для бинарных отношений двух множеств",
|
|
85
68
|
"analysis": {
|
|
86
69
|
"success": true,
|
|
87
70
|
"type": {
|
|
@@ -110,8 +93,8 @@
|
|
|
110
93
|
"cstType": "structure",
|
|
111
94
|
"definitionFormal": "ℬ(X1×X1)",
|
|
112
95
|
"term": "подчинённость",
|
|
113
|
-
"convention": "σ в шаблонах БВ для бинарных отношений на одном множестве",
|
|
114
96
|
"definitionText": "",
|
|
97
|
+
"convention": "σ в шаблонах БВ для бинарных отношений на одном множестве",
|
|
115
98
|
"analysis": {
|
|
116
99
|
"success": true,
|
|
117
100
|
"type": {
|
|
@@ -134,14 +117,35 @@
|
|
|
134
117
|
"diagnostics": []
|
|
135
118
|
}
|
|
136
119
|
},
|
|
120
|
+
{
|
|
121
|
+
"id": 10,
|
|
122
|
+
"alias": "D2",
|
|
123
|
+
"cstType": "term",
|
|
124
|
+
"definitionFormal": "Pr1(S2) \\ Pr2(S2)",
|
|
125
|
+
"term": "глава иерархии",
|
|
126
|
+
"definitionText": "",
|
|
127
|
+
"convention": "БВ F20: применение к S2 (развёрнуто в D2, т.к. вызов F# в терме не анализируется)",
|
|
128
|
+
"analysis": {
|
|
129
|
+
"success": true,
|
|
130
|
+
"type": {
|
|
131
|
+
"typeID": 5,
|
|
132
|
+
"base": {
|
|
133
|
+
"typeID": 3,
|
|
134
|
+
"baseID": "X1"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"valueClass": "value",
|
|
138
|
+
"diagnostics": []
|
|
139
|
+
}
|
|
140
|
+
},
|
|
137
141
|
{
|
|
138
142
|
"id": 6,
|
|
139
143
|
"alias": "F_IMAGE",
|
|
140
144
|
"cstType": "function",
|
|
141
145
|
"definitionFormal": "[α∈X1, σ∈ℬ(X1×X2)] Pr2(Fi1[{α}](σ))",
|
|
142
146
|
"term": "проекты сотрудника",
|
|
143
|
-
"convention": "БВ F6: R1→X1, R2→X2",
|
|
144
147
|
"definitionText": "",
|
|
148
|
+
"convention": "БВ F6: R1→X1, R2→X2",
|
|
145
149
|
"analysis": {
|
|
146
150
|
"success": true,
|
|
147
151
|
"type": {
|
|
@@ -192,8 +196,8 @@
|
|
|
192
196
|
"cstType": "function",
|
|
193
197
|
"definitionFormal": "[σ∈ℬ(X1×X1)] Pr1(σ) \\ Pr2(σ)",
|
|
194
198
|
"term": "вершины без предшественников",
|
|
195
|
-
"convention": "БВ F20 (истоки графа подчинённости)",
|
|
196
199
|
"definitionText": "",
|
|
200
|
+
"convention": "БВ F20 (истоки графа подчинённости)",
|
|
197
201
|
"analysis": {
|
|
198
202
|
"success": true,
|
|
199
203
|
"type": {
|
|
@@ -237,8 +241,8 @@
|
|
|
237
241
|
"cstType": "predicate",
|
|
238
242
|
"definitionFormal": "[α∈ℬ(X1), σ∈ℬ(X1×X2)] card(Pr1(σ)) = card(σ) & Pr1(σ) = α",
|
|
239
243
|
"term": "тотальная функция X1→X2",
|
|
240
|
-
"convention": "БВ P5",
|
|
241
244
|
"definitionText": "",
|
|
245
|
+
"convention": "БВ P5",
|
|
242
246
|
"analysis": {
|
|
243
247
|
"success": true,
|
|
244
248
|
"type": {
|
|
@@ -288,8 +292,8 @@
|
|
|
288
292
|
"cstType": "term",
|
|
289
293
|
"definitionFormal": "Pr2(Fi1[X1](S1))",
|
|
290
294
|
"term": "все назначенные проекты",
|
|
291
|
-
"convention": "БВ F9: образ множества X1 по S1",
|
|
292
295
|
"definitionText": "",
|
|
296
|
+
"convention": "БВ F9: образ множества X1 по S1",
|
|
293
297
|
"analysis": {
|
|
294
298
|
"success": true,
|
|
295
299
|
"type": {
|
|
@@ -304,21 +308,17 @@
|
|
|
304
308
|
}
|
|
305
309
|
},
|
|
306
310
|
{
|
|
307
|
-
"id":
|
|
308
|
-
"alias": "
|
|
309
|
-
"cstType": "
|
|
310
|
-
"definitionFormal": "
|
|
311
|
-
"term": "
|
|
312
|
-
"convention": "БВ F20: применение к S2 (развёрнуто в D2, т.к. вызов F# в терме не анализируется)",
|
|
311
|
+
"id": 1,
|
|
312
|
+
"alias": "T1",
|
|
313
|
+
"cstType": "statement",
|
|
314
|
+
"definitionFormal": "1=1",
|
|
315
|
+
"term": "Применение шаблонов банка выражений",
|
|
313
316
|
"definitionText": "",
|
|
317
|
+
"convention": "Подстановка радикалов БВ: R1→X1, R2→X2. Отношение σ→S1 или S2. Примеры: БВ F6→F_IMAGE, БВ F20→F_SOURCES, БВ P5→P_FUNCTION",
|
|
314
318
|
"analysis": {
|
|
315
319
|
"success": true,
|
|
316
320
|
"type": {
|
|
317
|
-
"typeID":
|
|
318
|
-
"base": {
|
|
319
|
-
"typeID": 3,
|
|
320
|
-
"baseID": "X1"
|
|
321
|
-
}
|
|
321
|
+
"typeID": 6
|
|
322
322
|
},
|
|
323
323
|
"valueClass": "value",
|
|
324
324
|
"diagnostics": []
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsconcept/rstool",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Agent-facing library for incremental RSForm construction, RSLang analysis, diagnostics, modeling, and evaluation. Wraps @rsconcept/domain with a deterministic session contract
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Agent-facing library for incremental RSForm construction, RSLang analysis, diagnostics, modeling, and evaluation. Wraps @rsconcept/domain with a deterministic session contract.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "IRBorisov",
|
|
7
7
|
"repository": {
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"build": "tsdown",
|
|
55
55
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
56
56
|
"test": "vitest run",
|
|
57
|
+
"test:coverage": "vitest run --coverage",
|
|
57
58
|
"wrapper": "tsx src/wrapper/stdio-wrapper.ts",
|
|
58
59
|
"example:client": "tsx examples/agent-client.ts",
|
|
59
60
|
"example:build-schema": "tsx examples/sample/build-rsform.ts",
|
|
@@ -74,6 +75,7 @@
|
|
|
74
75
|
},
|
|
75
76
|
"devDependencies": {
|
|
76
77
|
"@types/node": "^26.0.1",
|
|
78
|
+
"@vitest/coverage-v8": "^4.1.9",
|
|
77
79
|
"tsdown": "^0.22.3",
|
|
78
80
|
"tsx": "^4.22.4",
|
|
79
81
|
"typescript": "^6.0.3",
|