@rsconcept/rstool 0.1.0 → 0.2.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.
Files changed (77) hide show
  1. package/README.md +21 -26
  2. package/dist/analysis-JiwOYDKx.d.ts +16 -0
  3. package/dist/common-DxLg3eXX.d.ts +17 -0
  4. package/dist/constituenta-Dnd6iToB.d.ts +36 -0
  5. package/dist/diagnostic-BMYvciz8.d.ts +15 -0
  6. package/dist/evaluation-CCVYH0wA.d.ts +21 -0
  7. package/dist/index.d.ts +12 -15
  8. package/dist/index.js +7 -585
  9. package/dist/mappers/model-adapter.d.ts +18 -23
  10. package/dist/mappers/model-adapter.js +183 -231
  11. package/dist/mappers/model-adapter.js.map +1 -1
  12. package/dist/mappers/schema-adapter.d.ts +16 -18
  13. package/dist/mappers/schema-adapter.js +55 -84
  14. package/dist/mappers/schema-adapter.js.map +1 -1
  15. package/dist/mappers/types.d.ts +15 -16
  16. package/dist/mappers/types.js +16 -17
  17. package/dist/mappers/types.js.map +1 -1
  18. package/dist/model-value-SFAVj0dw.d.ts +35 -0
  19. package/dist/models/analysis.d.ts +2 -18
  20. package/dist/models/analysis.js +1 -1
  21. package/dist/models/common.d.ts +2 -15
  22. package/dist/models/common.js +1 -8
  23. package/dist/models/constituenta.d.ts +2 -38
  24. package/dist/models/constituenta.js +1 -1
  25. package/dist/models/diagnostic.d.ts +2 -17
  26. package/dist/models/diagnostic.js +1 -1
  27. package/dist/models/evaluation.d.ts +2 -23
  28. package/dist/models/evaluation.js +1 -1
  29. package/dist/models/index.d.ts +10 -13
  30. package/dist/models/index.js +4 -491
  31. package/dist/models/model-value.d.ts +2 -37
  32. package/dist/models/model-value.js +1 -1
  33. package/dist/models/rstool-agent.d.ts +2 -36
  34. package/dist/models/rstool-agent.js +90 -477
  35. package/dist/models/rstool-agent.js.map +1 -1
  36. package/dist/models/session.d.ts +2 -29
  37. package/dist/models/session.js +1 -1
  38. package/dist/models/tool-contract.d.ts +2 -33
  39. package/dist/models/tool-contract.js +5 -5
  40. package/dist/models/tool-contract.js.map +1 -1
  41. package/dist/rstool-agent-DkeH5Qml.d.ts +33 -0
  42. package/dist/session/session-store.d.ts +14 -21
  43. package/dist/session/session-store.js +59 -63
  44. package/dist/session/session-store.js.map +1 -1
  45. package/dist/session-BHGCCLfQ.d.ts +24 -0
  46. package/dist/tool-contract-CsGqg_0P.d.ts +30 -0
  47. package/dist/wrapper/client.d.ts +26 -24
  48. package/dist/wrapper/client.js +90 -93
  49. package/dist/wrapper/client.js.map +1 -1
  50. package/dist/wrapper/stdio-wrapper.d.ts +1 -1
  51. package/dist/wrapper/stdio-wrapper.js +166 -664
  52. package/dist/wrapper/stdio-wrapper.js.map +1 -1
  53. package/docs/CONCEPTUAL-SCHEMA.md +168 -0
  54. package/docs/CONSTITUENTA.md +46 -23
  55. package/docs/DIAGNOSTICS.md +79 -74
  56. package/docs/DOMAIN.md +32 -30
  57. package/docs/GRAMMAR-REF.md +55 -55
  58. package/docs/PORTAL-API.md +7 -10
  59. package/docs/README.md +1 -0
  60. package/docs/SYNTAX.md +32 -32
  61. package/docs/TYPIFICATION.md +14 -9
  62. package/package.json +8 -7
  63. package/skills/INSTALL.md +35 -0
  64. package/skills/README.md +17 -9
  65. package/skills/rstool-helper/EXAMPLES.md +51 -10
  66. package/skills/rstool-helper/GUIDE.md +141 -0
  67. package/skills/rstool-helper/REFERENCE.md +5 -3
  68. package/skills/rstool-helper/SKILL.md +23 -134
  69. package/dist/index.js.map +0 -1
  70. package/dist/models/analysis.js.map +0 -1
  71. package/dist/models/common.js.map +0 -1
  72. package/dist/models/constituenta.js.map +0 -1
  73. package/dist/models/diagnostic.js.map +0 -1
  74. package/dist/models/evaluation.js.map +0 -1
  75. package/dist/models/index.js.map +0 -1
  76. package/dist/models/model-value.js.map +0 -1
  77. package/dist/models/session.js.map +0 -1
@@ -6,6 +6,10 @@ Install first:
6
6
  npm install @rsconcept/rstool
7
7
  ```
8
8
 
9
+ ## Kinship-lite: structure vs term
10
+
11
+ `S1` carries **typification** `ℬ(X1×X1)` (pairs over people); `D1` is a **definition** `Pr1(S1)` (parents). Do not put `X1×X1` on a `term` — that is the full Cartesian product.
12
+
9
13
  ## In-process
10
14
 
11
15
  ```ts
@@ -19,9 +23,20 @@ tool.addOrUpdateConstituenta(sessionId, {
19
23
  draft: { id: 1, alias: 'X1', cstType: CstType.BASE, definitionFormal: '' }
20
24
  });
21
25
 
22
- // Term referencing base
26
+ // Structure: typification of parent–child pairs (undefined; convention in real schemas)
27
+ tool.addOrUpdateConstituenta(sessionId, {
28
+ draft: {
29
+ id: 2,
30
+ alias: 'S1',
31
+ cstType: CstType.STRUCTURED,
32
+ definitionFormal: 'ℬ(X1×X1)',
33
+ convention: 'Elements are (parent, child) pairs with parent, child ∈ X1.'
34
+ }
35
+ });
36
+
37
+ // Term: derived definition — first projection of S1
23
38
  const { state, diagnostics } = tool.addOrUpdateConstituenta(sessionId, {
24
- draft: { id: 2, alias: 'D1', cstType: CstType.TERM, definitionFormal: 'X1×X1' }
39
+ draft: { id: 3, alias: 'D1', cstType: CstType.TERM, definitionFormal: 'Pr1(S1)' }
25
40
  });
26
41
 
27
42
  console.log(state.analysis.success, diagnostics.length);
@@ -32,7 +47,7 @@ tool.analyzeExpression(sessionId, {
32
47
  cstType: CstType.TERM
33
48
  }); // success: false, syntax diagnostics
34
49
 
35
- // Set base binding and evaluate a term
50
+ // Set base binding and evaluate a scratch arithmetic term
36
51
  tool.setConstituentaValue(sessionId, {
37
52
  target: 1,
38
53
  value: { 0: 'zero', 1: 'one' }
@@ -60,11 +75,21 @@ await client.call('addOrUpdateConstituenta', {
60
75
  draft: { id: 1, alias: 'X1', cstType: CstType.BASE, definitionFormal: '' }
61
76
  }
62
77
  });
63
-
64
78
  await client.call('addOrUpdateConstituenta', {
65
79
  sessionId,
66
80
  input: {
67
- draft: { id: 2, alias: 'D1', cstType: CstType.TERM, definitionFormal: 'X1×X1' }
81
+ draft: {
82
+ id: 2,
83
+ alias: 'S1',
84
+ cstType: CstType.STRUCTURED,
85
+ definitionFormal: 'ℬ(X1×X1)'
86
+ }
87
+ }
88
+ });
89
+ await client.call('addOrUpdateConstituenta', {
90
+ sessionId,
91
+ input: {
92
+ draft: { id: 3, alias: 'D1', cstType: CstType.TERM, definitionFormal: 'Pr1(S1)' }
68
93
  }
69
94
  });
70
95
 
@@ -92,8 +117,9 @@ Use the returned `sessionId` in subsequent lines:
92
117
 
93
118
  ```json
94
119
  { "id": "2", "method": "addOrUpdateConstituenta", "params": { "sessionId": "...", "input": { "draft": { "id": 1, "alias": "X1", "cstType": "basic", "definitionFormal": "" } } } }
95
- { "id": "3", "method": "addOrUpdateConstituenta", "params": { "sessionId": "...", "input": { "draft": { "id": 2, "alias": "D1", "cstType": "term", "definitionFormal": "X1×X1" } } } }
96
- { "id": "4", "method": "listDiagnostics", "params": { "sessionId": "..." } }
120
+ { "id": "3", "method": "addOrUpdateConstituenta", "params": { "sessionId": "...", "input": { "draft": { "id": 2, "alias": "S1", "cstType": "structure", "definitionFormal": "ℬ(X1×X1)" } } } }
121
+ { "id": "4", "method": "addOrUpdateConstituenta", "params": { "sessionId": "...", "input": { "draft": { "id": 3, "alias": "D1", "cstType": "term", "definitionFormal": "Pr1(S1)" } } } }
122
+ { "id": "5", "method": "listDiagnostics", "params": { "sessionId": "..." } }
97
123
  ```
98
124
 
99
125
  ## Export a small RSForm session
@@ -111,10 +137,19 @@ tool.addOrUpdateConstituenta(sessionId, {
111
137
  draft: { id: 2, alias: 'C1', cstType: CstType.CONSTANT, definitionFormal: '' }
112
138
  });
113
139
  tool.addOrUpdateConstituenta(sessionId, {
114
- draft: { id: 3, alias: 'D1', cstType: CstType.TERM, definitionFormal: 'X1×X1' }
140
+ draft: {
141
+ id: 3,
142
+ alias: 'S1',
143
+ cstType: CstType.STRUCTURED,
144
+ definitionFormal: 'ℬ(X1×X1)',
145
+ convention: 'Pairs (parent, child) over X1.'
146
+ }
147
+ });
148
+ tool.addOrUpdateConstituenta(sessionId, {
149
+ draft: { id: 4, alias: 'D1', cstType: CstType.TERM, definitionFormal: 'Pr1(S1)' }
115
150
  });
116
151
  tool.addOrUpdateConstituenta(sessionId, {
117
- draft: { id: 4, alias: 'A1', cstType: CstType.AXIOM, definitionFormal: '1=1' }
152
+ draft: { id: 5, alias: 'A1', cstType: CstType.AXIOM, definitionFormal: '1=1' }
118
153
  });
119
154
 
120
155
  const payload = tool.exportSession(sessionId);
@@ -123,6 +158,10 @@ console.log(payload);
123
158
 
124
159
  ## Model and evaluation
125
160
 
161
+ Full kinship modeling (`S1` values as tuples, `Pr1(S1)`, …): `examples/build-kinship-rsmodel.ts`.
162
+
163
+ Minimal evaluation after bindings:
164
+
126
165
  ```ts
127
166
  tool.setConstituentaValue(sessionId, {
128
167
  target: 1,
@@ -130,7 +169,7 @@ tool.setConstituentaValue(sessionId, {
130
169
  });
131
170
 
132
171
  const evaluated = tool.evaluateConstituenta(sessionId, {
133
- constituentId: 3
172
+ constituentId: 4 // D1 = Pr1(S1); needs S1 interpreted — see kinship example
134
173
  });
135
174
  console.log(evaluated.success, evaluated.value);
136
175
  ```
@@ -143,6 +182,8 @@ console.log(evaluated.success, evaluated.value);
143
182
  | `D1` uses `D2` before `D2` exists | globalNotTyped / undeclared global |
144
183
  | `analyzeExpression` with wrong `cstType` | Role-specific semantic errors |
145
184
  | Non-empty formal on `C1` (`constant`) | Same as basic — definition not allowed |
185
+ | `term` with `X1×X1` when modeling a **relation** | Full Cartesian product instead of typed pairs in `S#` |
186
+ | `structure` with `Pr1(S1)` instead of a grade | Wrong role — projections belong on `term` / `F#` |
146
187
  | `setConstituentaValue` on inferrable `D1` (`term`) | Error: inferrable and cannot be set directly |
147
188
  | Evaluating before base binding set | May fail or return empty depending on expression |
148
189
 
@@ -0,0 +1,141 @@
1
+ # RS Language & rstool — Compact Guide for Agents
2
+
3
+ **RS language** is a formal scheme notation for concepts, relations, operations—extends FOL, core: membership `x∈y`; typification via set-theoretic/logical expressions.
4
+
5
+ **rstool** is the agent API for sessions, upserts, analysis, diagnostics, modeling/evaluation, (de)serialization.
6
+
7
+ - Library: `@rsconcept/rstool` (npm)
8
+ - Analyzer: `@rsconcept/domain` (dependency of rstool)
9
+ - Language reference: `docs/*.md` next to this package (see table below)
10
+
11
+ ## Docs / hints (canonical paths)
12
+
13
+ Paths below are relative to **this file** (`skills/rstool-helper/GUIDE.md`).
14
+
15
+ | Info | Location |
16
+ | :--- | :--- |
17
+ | rstool API, methods, error codes | [REFERENCE.md](REFERENCE.md) |
18
+ | Worked examples, common mistakes | [EXAMPLES.md](EXAMPLES.md) |
19
+ | Domain vocabulary (English) | [../../docs/DOMAIN.md](../../docs/DOMAIN.md) |
20
+ | Designing/reviewing conceptual schemas (agent recommendations) | [../../docs/CONCEPTUAL-SCHEMA.md](../../docs/CONCEPTUAL-SCHEMA.md) |
21
+ | Constituenta fields, validation, ordering | [../../docs/CONSTITUENTA.md](../../docs/CONSTITUENTA.md) |
22
+ | RSLang syntax (operators, quantifiers) | [../../docs/SYNTAX.md](../../docs/SYNTAX.md) |
23
+ | Typification grades, radicals | [../../docs/TYPIFICATION.md](../../docs/TYPIFICATION.md) |
24
+ | Diagnostic code → fix table | [../../docs/DIAGNOSTICS.md](../../docs/DIAGNOSTICS.md) |
25
+ | Portal REST API (live data) | [../../docs/PORTAL-API.md](../../docs/PORTAL-API.md) |
26
+ | Lezer grammar pointers | [../../docs/GRAMMAR-REF.md](../../docs/GRAMMAR-REF.md) |
27
+ | Package README | [../../README.md](../../README.md) |
28
+
29
+ When working from **npm**, the same tree lives under `node_modules/@rsconcept/rstool/` (use the Read tool on those paths from the project root).
30
+
31
+ ## Protocol Summary
32
+
33
+ 1. **Start session**: `createSession`
34
+ 2. **Add bases/constants**: type `basic` (`X*`), `constant` (`C*`) — `definitionFormal: ''`
35
+ 3. **Add derived**: terms, axioms, etc.—only after dependencies present
36
+ 4. **Analyze scratch**: `analyzeExpression`
37
+ 5. **Process diagnostics**: check `analysis.diagnostics`/`listDiagnostics`; fix by range
38
+ 6. **Checkpoint**: `commitStep` (message optional)
39
+ 7. **Model values**: `setConstituentaValue` / `setConstituentaValues` for base bindings (`{0:"a",1:"b"}`) or structured values; `getModelState`
40
+ 8. **Evaluate**: `evaluateExpression` (scratch) or `evaluateConstituenta` / `recalculateModel` (stored definitions)
41
+ 9. **Export/import**: persist with `exportSession`/`importSession` (includes `state.model`)
42
+
43
+ **Clients**:
44
+
45
+ - Node: use `RSToolWrapperClient`
46
+ - Stdio process: `npx rstool-wrapper` — JSON per line
47
+
48
+ ## API/REST
49
+
50
+ For full reference see [../../docs/PORTAL-API.md](../../docs/PORTAL-API.md). Short form:
51
+
52
+ - **Portal UI**: `https://portal.acconcept.ru`
53
+ - **API**: `https://api.portal.acconcept.ru`
54
+ - Endpoints: `GET /api/rsforms/{id}`, `GET /api/rsforms/{id}/details`, `GET /api/library/{id}/versions/{v}`, `GET /api/oss/{id}`, `GET /api/models/{id}`, OpenAPI at `GET /schema`.
55
+ - Don't scrape SPA or use UI query params (`tab=`, etc.).
56
+ - rstool itself never calls the REST API; bring data in via `addOrUpdateConstituenta` after fetching.
57
+
58
+ ## Constituent Types (`cstType`)
59
+
60
+ | cstType | Example | Formal | Notes |
61
+ | :-------- | :------ | :-------- | :-------------------------------------------------------- |
62
+ | basic | X1 | **empty** | Required |
63
+ | constant | C1 | **empty** | Required |
64
+ | nominal | S1 | allowed | Naming |
65
+ | structure | S1 | allowed | Typification grade; base concept + `convention` |
66
+ | term | D1 | allowed | Formal **definition**; derived concept, computed in model |
67
+ | axiom | A1 | allowed | Logical; computed in model; required to be TRUE |
68
+ | statement | T1 | allowed | Logical; computed in model |
69
+ | function | F1 | allowed | Parameterized; derived concept |
70
+ | predicate | P1 | allowed | Parameterized; derived concept |
71
+
72
+ - Non-empty formal for `basic`/`constant` ⇒ error `0x8862` (`definitionNotAllowed`)
73
+ - Empty `basic`/`constant` always typified
74
+ - **Interpretable** (can set value): `basic`, `constant`, `structure`
75
+ - **Inferrable** (computed, do not set directly): `term`, `axiom`, `statement`
76
+
77
+ ## Structure (`S#`) vs term (`D#`)
78
+
79
+ The same field `definitionFormal` has **different roles** depending on `cstType`:
80
+
81
+ | | `structure` (`S#`) | `term` (`D#`) |
82
+ | -------------------------- | ------------------------------------------------------------------------------------ | --------------------------------------------------------------------- |
83
+ | Role of `definitionFormal` | **Typification** — declares grade `H` (element structure) | **Definition** — declares how the concept is built from suppliers |
84
+ | Concept class | **Undefined** — meaning from `convention` (+ axioms on `S#`) | **Derived** — meaning from the expression; no convention required |
85
+ | Model interpretation | Values are **assigned** (or constrained by axioms); domain fills `S#` per convention | Value is **computed** via `evaluateConstituenta` / `recalculateModel` |
86
+
87
+ **Same syntax, different semantics:** in `ℬ(X1×X1)` the fragment `X1×X1` is a **grade** (one ordered pair of base elements). On a **term** with body `X1×X1` alone, `×` builds the **full Cartesian product** — the set of all pairs from `X1`, not a relation typification.
88
+
89
+ **Agent rule:** for a relation over `X1` (e.g. parent–child), upsert `S1` with `definitionFormal: 'ℬ(X1×X1)'` and a `convention`, then derive terms with projections/filters (`Pr1(S1)`, `Fi2[{ξ}](S1)`, …). Do not use bare `X1×X1` on a `term` when you meant the structure’s typification.
90
+
91
+ See [EXAMPLES.md](EXAMPLES.md) (kinship-lite) and `../../examples/build-kinship-rsform.ts`.
92
+
93
+ ## Syntax
94
+
95
+ - **Globals**: `X1`, `C1`, `D1`, `F1`, `P1`, `A1`, `R1`
96
+ - **Locals**: `x`, `ξ`, `μ2`
97
+ - **Literals**: `42`, `Z`, `∅`
98
+ - Full operator + precedence table: [../../docs/SYNTAX.md](../../docs/SYNTAX.md)
99
+ - Grammar pointers: [../../docs/GRAMMAR-REF.md](../../docs/GRAMMAR-REF.md)
100
+
101
+ ## Expression Types
102
+
103
+ - **Set-theoretic**: `∪`, `∩`, `\`, `∆`, `×`, `∈`, `⊆`, `ℬ(...)`, tuples
104
+ - **Logical**: `¬`, `&`, `∨`, `⇒`, `⇔`, `∀`, `∃`, comparisons `=`, `≠`, `<`
105
+ - **Parameterized**: `[arg1∈H1, arg2∈H2] body`
106
+ - Detailed semantics in [../../docs/SYNTAX.md](../../docs/SYNTAX.md); typification grades and radicals in [../../docs/TYPIFICATION.md](../../docs/TYPIFICATION.md).
107
+
108
+ Always set `cstType` in upserts/analysis to true role.
109
+
110
+ ## Diagnostics Loop
111
+
112
+ 1. Check `analysis.success`
113
+ 2. If not, see `analysis.diagnostics` / `listDiagnostics`
114
+ 3. Map `code` → cause → fix via [../../docs/DIAGNOSTICS.md](../../docs/DIAGNOSTICS.md)
115
+ 4. Use `from`, `to` to patch `definitionFormal`; re-send
116
+
117
+ Don't infer types—always read tool output.
118
+
119
+ ## Declaration Order
120
+
121
+ 1. All `basic`, `constant`
122
+ 2. Core/critical first
123
+ 3. Topological: dependencies before dependents (e.g. `D1` before `D2` if `D2` refers to `D1`)
124
+ 4. Derived right after their sources
125
+
126
+ ## Natural-language fields: keep one language
127
+
128
+ When you create new constituents (concepts) or build a schema from scratch, the fields `term`, `definitionText`, and `convention` must be written **in one consistent natural language**:
129
+
130
+ - If you are extending an existing schema/session, write these fields in the **same language that is already used** in the schema’s text fields.
131
+ - If you are creating a new schema from zero, write these fields in the **language of the user’s request**.
132
+
133
+ ## Checklist
134
+
135
+ - [ ] `sessionId` obtained & tracked
136
+ - [ ] Bases/constants are empty formal
137
+ - [ ] All dependencies exist before upsert
138
+ - [ ] Matching `cstType`
139
+ - [ ] Diagnostics handled before commit/export
140
+ - [ ] Base bindings set before evaluating expressions that reference base elements
141
+ - [ ] For other details, open [REFERENCE.md](REFERENCE.md) or linked `docs/*.md`
@@ -33,7 +33,7 @@
33
33
  {
34
34
  id: number; // stable id within session
35
35
  alias: string; // e.g. "D1", "X1"
36
- cstType: CstType; // see SKILL.md table
36
+ cstType: CstType; // see GUIDE.md table
37
37
  definitionFormal: string;
38
38
  term?: string;
39
39
  definitionText?: string;
@@ -79,7 +79,8 @@ Example chain:
79
79
 
80
80
  ```json
81
81
  {"id":"1","method":"createSession","params":{}}
82
- {"id":"2","method":"addOrUpdateConstituenta","params":{"sessionId":"…","input":{"draft":{"id":3,"alias":"D1","cstType":"term","definitionFormal":"X1×X1"}}}}
82
+ {"id":"2","method":"addOrUpdateConstituenta","params":{"sessionId":"…","input":{"draft":{"id":2,"alias":"S1","cstType":"structure","definitionFormal":"ℬ(X1×X1)"}}}}
83
+ {"id":"2b","method":"addOrUpdateConstituenta","params":{"sessionId":"…","input":{"draft":{"id":3,"alias":"D1","cstType":"term","definitionFormal":"Pr1(S1)"}}}}
83
84
  {"id":"3","method":"analyzeExpression","params":{"sessionId":"…","input":{"expression":"1+2","cstType":"term"}}}
84
85
  {"id":"4","method":"listDiagnostics","params":{"sessionId":"…"}}
85
86
  {"id":"5","method":"commitStep","params":{"sessionId":"…","message":"checkpoint"}}
@@ -104,8 +105,9 @@ interface AnalysisResult {
104
105
 
105
106
  ## RS language — conceptual model
106
107
 
107
- - **Typification**: computed structure type from a formal definition; grades include elements (`Xi`, `Ci`), `Z`, tuples `(H1×…×Hn)`, sets `ℬ(H)`, logic `Logic`, parameterized `Hr 🠔 [H1,…,Hi]`.
108
+ - **Typification**: structure type of an expression; grades include elements (`Xi`, `Ci`), `Z`, tuples `(H1×…×Hn)`, sets `ℬ(H)`, logic `Logic`, parameterized `Hr 🠔 [H1,…,Hi]`. On `structure` (`S#`), `definitionFormal` **is** the typification. On `term` (`D#`), typification is **inferred from** the definition.
108
109
  - **Term graph**: directed dependencies between constituenta via alias references in definitions.
110
+ - **`S#` vs `D#`**: same `×` token — in `ℬ(X1×X1)` on `S#` it forms a **grade** (pair type); in `X1×X1` on `D#` it is the **Cartesian product** (all pairs). Relations: `S#` + `convention`, then derived `D#` (`Pr1(S1)`, …).
109
111
 
110
112
  Intro (help): language is FOL-based; set vs logic expression split; parameterized templates for term/predicate functions; structural expressions reshape stages.
111
113
 
@@ -1,148 +1,37 @@
1
1
  ---
2
2
  name: rstool-helper
3
- description: RS language and @rsconcept/rstool for AI agents: incremental RSForm construction, formal definitions, typification, diagnostics, modeling, evaluation.
3
+ description: >-
4
+ RS language and @rsconcept/rstool for agents. After npm install, read GUIDE and
5
+ docs from node_modules. If the entry skill is not installed in the project yet,
6
+ follow skills/INSTALL.md in this package.
4
7
  ---
5
8
 
6
- # RS Language & rstool Compact Guide for Agents
9
+ # rstool-helper (npm install)
7
10
 
8
- **RS language** is a formal scheme notation for concepts, relations, operationsextends FOL, core: membership `x∈y`; typification via set-theoretic/logical expressions.
11
+ Thin **entry** skill. Full guide and docs stay in the package use the Read tool on the paths below (from the project root).
9
12
 
10
- **rstool** is the agent API for sessions, upserts, analysis, diagnostics, modeling/evaluation, (de)serialization.
13
+ ## If the entry skill is not installed yet
11
14
 
12
- - Library: `@rsconcept/rstool` (npm)
13
- - Analyzer: `@rsconcept/domain` (installed automatically as a dependency)
14
- - Language and API reference: bundled `docs/*.md` copied into this skill during installation
15
+ The user ran `npm install @rsconcept/rstool` but has not registered the agent skill in the project. **Run the install procedure** in:
15
16
 
16
- ## Installing This Skill
17
+ `node_modules/@rsconcept/rstool/skills/INSTALL.md`
17
18
 
18
- After installing the package in an agent project:
19
+ Then continue with the canonical files below.
19
20
 
20
- ```bash
21
- npm install @rsconcept/rstool
22
- ```
21
+ ## Canonical files (read before rstool work)
23
22
 
24
- copy the skill into your agent host's skill directory.
23
+ | What | Path |
24
+ | :--- | :--- |
25
+ | **Start here** — workflow, cstType, S# vs D# | `node_modules/@rsconcept/rstool/skills/rstool-helper/GUIDE.md` |
26
+ | API, stdio, contract | `node_modules/@rsconcept/rstool/skills/rstool-helper/REFERENCE.md` |
27
+ | Examples, pitfalls | `node_modules/@rsconcept/rstool/skills/rstool-helper/EXAMPLES.md` |
28
+ | Language / domain docs | `node_modules/@rsconcept/rstool/docs/*.md` |
29
+ | Install procedure | `node_modules/@rsconcept/rstool/skills/INSTALL.md` |
25
30
 
26
- Cursor per-project skills:
31
+ Always open **GUIDE.md** first when starting a rstool task, then **REFERENCE.md** / **EXAMPLES.md** / relevant `docs/*.md` as needed.
27
32
 
28
- ```bash
29
- mkdir -p .agents/skills
30
- cp -R node_modules/@rsconcept/rstool/skills/rstool-helper .agents/skills/rstool-helper
31
- cp -R node_modules/@rsconcept/rstool/docs .agents/skills/rstool-helper/docs
32
- ```
33
+ ## Quick facts
33
34
 
34
- PowerShell:
35
-
36
- ```powershell
37
- New-Item -ItemType Directory -Force .agents/skills
38
- Copy-Item -Recurse -Force node_modules/@rsconcept/rstool/skills/rstool-helper .agents/skills/rstool-helper
39
- Copy-Item -Recurse -Force node_modules/@rsconcept/rstool/docs .agents/skills/rstool-helper/docs
40
- ```
41
-
42
- This makes the skill self-contained for hosts that only read files under the skill directory.
43
-
44
- ## Docs/Hints Reference
45
-
46
- | Info | Location |
47
- | :---------------------------------------- | :---------------------------------------------------------------- |
48
- | rstool API, methods, error codes | [REFERENCE.md](REFERENCE.md) |
49
- | Worked examples, common mistakes | [EXAMPLES.md](EXAMPLES.md) |
50
- | Domain vocabulary (English) | `docs/DOMAIN.md` (bundled with the npm package) |
51
- | Constituenta fields, validation, ordering | `docs/CONSTITUENTA.md` |
52
- | RSLang syntax (operators, quantifiers) | `docs/SYNTAX.md` |
53
- | Typification grades, radicals | `docs/TYPIFICATION.md` |
54
- | Diagnostic code → fix table | `docs/DIAGNOSTICS.md` |
55
- | Portal REST API (live data) | `docs/PORTAL-API.md` |
56
- | Lezer grammar pointers | `docs/GRAMMAR-REF.md` (full grammar lives in `@rsconcept/domain`) |
57
- | Code samples | [EXAMPLES.md](EXAMPLES.md), package README |
58
-
59
- If you installed `@rsconcept/rstool` from npm, the source docs ship inside `node_modules/@rsconcept/rstool/docs/`; the install commands above copy them into this skill folder.
60
-
61
- ## Protocol Summary
62
-
63
- 1. **Start session**: `createSession`
64
- 2. **Add bases/constants**: type `basic` (`X*`), `constant` (`C*`) — `definitionFormal: ''`
65
- 3. **Add derived**: terms, axioms, etc.—only after dependencies present
66
- 4. **Analyze scratch**: `analyzeExpression`
67
- 5. **Process diagnostics**: check `analysis.diagnostics`/`listDiagnostics`; fix by range
68
- 6. **Checkpoint**: `commitStep` (message optional)
69
- 7. **Model values**: `setConstituentaValue` / `setConstituentaValues` for base bindings (`{0:"a",1:"b"}`) or structured values; `getModelState`
70
- 8. **Evaluate**: `evaluateExpression` (scratch) or `evaluateConstituenta` / `recalculateModel` (stored definitions)
71
- 9. **Export/import**: persist with `exportSession`/`importSession` (includes `state.model`)
72
-
73
- **Clients**:
74
-
75
- - Node: use `RSToolWrapperClient`
76
- - Stdio process: `npx rstool-wrapper` — JSON per line
77
-
78
- ## API/REST
79
-
80
- For full reference see `docs/PORTAL-API.md`. Short form:
81
-
82
- - **Portal UI**: `https://portal.acconcept.ru`
83
- - **API**: `https://api.portal.acconcept.ru`
84
- - Endpoints: `GET /api/rsforms/{id}`, `GET /api/rsforms/{id}/details`, `GET /api/library/{id}/versions/{v}`, `GET /api/oss/{id}`, `GET /api/models/{id}`, OpenAPI at `GET /schema`.
85
- - Don't scrape SPA or use UI query params (`tab=`, etc.).
86
- - rstool itself never calls the REST API; bring data in via `addOrUpdateConstituenta` after fetching.
87
-
88
- ## Constituent Types (`cstType`)
89
-
90
- | cstType | Example | Formal | Notes |
91
- | :-------- | :------ | :-------- | :------------------- |
92
- | basic | X1 | **empty** | Required |
93
- | constant | C1 | **empty** | Required |
94
- | nominal | S1 | allowed | Naming |
95
- | structure | custom | allowed | Structured genus |
96
- | term | D1 | allowed | Set/term |
97
- | axiom | A1 | allowed | Logical (type=Logic) |
98
- | statement | T1 | allowed | Logical (type=Logic) |
99
- | function | F1 | allowed | Parameterized |
100
- | predicate | P1 | allowed | Parameterized |
101
-
102
- - Non-empty formal for `basic`/`constant` ⇒ error `0x8862` (`definitionNotAllowed`)
103
- - Empty `basic`/`constant` always typified
104
- - **Interpretable** (can set value): `basic`, `constant`, `structure`, `axiom`, `term`, `statement`
105
- - **Inferrable** (computed, do not set directly): `term`, `axiom`, `statement`
106
-
107
- ## Syntax
108
-
109
- - **Globals**: `X1`, `C1`, `D1`, `F1`, `P1`, `A1`, `R1`
110
- - **Locals**: `x`, `ξ`, `μ2`
111
- - **Literals**: `42`, `Z`, `∅`
112
- - Full operator + precedence table: `docs/SYNTAX.md`
113
- - Grammar pointers: `docs/GRAMMAR-REF.md`
114
-
115
- ## Expression Types
116
-
117
- - **Set-theoretic**: `∪`, `∩`, `\`, `∆`, `×`, `∈`, `⊆`, `ℬ(...)`, tuples
118
- - **Logical**: `¬`, `&`, `∨`, `⇒`, `⇔`, `∀`, `∃`, comparisons `=`, `≠`, `<`
119
- - **Parameterized**: `[arg1∈H1, arg2∈H2] body`
120
- - Detailed semantics in `docs/SYNTAX.md`; typification grades and radicals in `docs/TYPIFICATION.md`.
121
-
122
- Always set `cstType` in upserts/analysis to true role.
123
-
124
- ## Diagnostics Loop
125
-
126
- 1. Check `analysis.success`
127
- 2. If not, see `analysis.diagnostics` / `listDiagnostics`
128
- 3. Map `code` → cause → fix via `docs/DIAGNOSTICS.md`
129
- 4. Use `from`, `to` to patch `definitionFormal`; re-send
130
-
131
- Don’t infer types—always read tool output.
132
-
133
- ## Declaration Order
134
-
135
- 1. All `basic`, `constant`
136
- 2. Core/critical first
137
- 3. Topological: dependencies before dependents (e.g. `D1` before `D2` if `D2` refers to `D1`)
138
- 4. Derived right after their sources
139
-
140
- ## Checklist
141
-
142
- - [ ] `sessionId` obtained & tracked
143
- - [ ] Bases/constants are empty formal
144
- - [ ] All dependencies exist before upsert
145
- - [ ] Matching `cstType`
146
- - [ ] Diagnostics handled before commit/export
147
- - [ ] Base bindings set before evaluating expressions that reference base elements
148
- - [ ] For other details, check help topics or [REFERENCE.md](REFERENCE.md)
35
+ - Package: `@rsconcept/rstool`; wrapper: `npx rstool-wrapper`
36
+ - `@rsconcept/domain` is installed as a dependency (analyzer, errors in `src/rslang/error.ts`)
37
+ - Do not copy GUIDE, REFERENCE, EXAMPLES, or `docs/` into the project skills folder — read them from `node_modules` paths above
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/mappers/types.ts","../src/models/common.ts","../src/mappers/model-adapter.ts","../src/mappers/schema-adapter.ts","../src/session/session-store.ts","../src/models/tool-contract.ts","../src/models/rstool-agent.ts","../src/wrapper/client.ts"],"sourcesContent":["import { type ValueClass } from '@rsconcept/domain/rslang';\n\nimport { type AnalysisResult, type RSToolErrorDescription } from '../models';\n\nexport interface DomainErrorLike {\n code: number;\n from: number;\n to: number;\n params?: readonly string[];\n}\n\nexport interface DomainAnalysisLike {\n success: boolean;\n type: Record<string, unknown> | null;\n valueClass: ValueClass | null;\n errors: DomainErrorLike[];\n}\n\nexport function toPublicError(error: DomainErrorLike): RSToolErrorDescription {\n return {\n code: error.code,\n from: error.from,\n to: error.to,\n params: error.params\n };\n}\n\nexport function toPublicAnalysis(analysis: DomainAnalysisLike): AnalysisResult {\n return {\n success: analysis.success,\n type: analysis.type,\n valueClass: analysis.valueClass,\n diagnostics: analysis.errors.map(toPublicError)\n };\n}\n","import { CstType } from '@rsconcept/domain/library/rsform';\nimport { EvalStatus, type BasicBinding } from '@rsconcept/domain/library/rsmodel';\nimport { ValueClass } from '@rsconcept/domain/rslang';\nimport { RSErrorCode } from '@rsconcept/domain/rslang/error';\n\nexport { CstType, EvalStatus, RSErrorCode, ValueClass };\nexport type { BasicBinding };\n\n/** Runtime evaluation value: number, nested array (set/tuple), or boolean 0/1. */\nexport type RSToolValue = number | RSToolValue[];\n\nexport interface RSToolErrorDescription {\n code: number;\n from: number;\n to: number;\n params?: readonly string[];\n}\n","import { Graph } from '@rsconcept/domain/graph/graph';\nimport { extractGlobals } from '@rsconcept/domain/rslang/api';\nimport { type ExpressionType, RSLangAnalyzer, type Value, type ValueClass } from '@rsconcept/domain/rslang';\nimport { isBaseSet } from '@rsconcept/domain/library/rsform-api';\nimport { type Constituenta, 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 ConstituentaState,\n type EvaluationResult,\n type RecalculateModelResult,\n type SessionModelState,\n type SessionState,\n type SetConstituentaValueInput\n} from '../models';\nimport { toPublicError } from './types';\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(result.value, result.errors, result.iterations, result.cacheHits, status);\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(result.value, result.errors, result.iterations, result.cacheHits, status);\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 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\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 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 homonyms: [],\n formalDuplicates: [],\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\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): EvaluationResult {\n const diagnostics = errors.map(toPublicError);\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","import { RSLangAnalyzer, type AnalysisFull, type ValueClass } from '@rsconcept/domain/rslang';\nimport { getAnalysisFor } from '@rsconcept/domain/library/rsform-api';\nimport { CstType, type RSForm } from '@rsconcept/domain/library/rsform';\n\nimport {\n type AnalysisResult,\n type ConstituentaDraft,\n type ConstituentaState,\n type DiagnosticRecord,\n type SessionState\n} from '../models';\nimport { toPublicAnalysis, toPublicError } from './types';\n\nexport class SchemaAdapter {\n public analyzeAgainstSession(\n session: SessionState,\n draft: ConstituentaDraft\n ): { result: AnalysisResult; diagnostics: DiagnosticRecord[] } {\n const analyzer = this.buildAnalyzer(session);\n const schema = this.toPseudoRSFormState(session, analyzer);\n const analysis = getAnalysisFor(draft.definitionFormal, draft.cstType, schema as unknown as RSForm, draft.alias);\n const result = toPublicAnalysis({\n success: analysis.success,\n type: analysis.type as Record<string, unknown> | null,\n valueClass: analysis.valueClass,\n errors: analysis.errors\n });\n return {\n result,\n diagnostics: analysis.errors.map(error => ({\n sessionId: session.sessionId,\n constituentId: draft.id,\n expression: draft.definitionFormal,\n error: toPublicError(error)\n }))\n };\n }\n\n public mergeStateWithDraft(\n session: SessionState,\n draft: ConstituentaDraft,\n analysis: AnalysisResult\n ): ConstituentaState {\n const state: ConstituentaState = {\n ...draft,\n term: draft.term ?? '',\n definitionText: draft.definitionText ?? '',\n convention: draft.convention ?? '',\n analysis\n };\n const index = session.items.findIndex(item => item.id === draft.id);\n if (index === -1) {\n session.items.push(state);\n } else {\n session.items[index] = state;\n }\n session.updatedAt = new Date().toISOString();\n return state;\n }\n\n public toPseudoRSFormState(\n session: SessionState,\n analyzer: RSLangAnalyzer\n ): Pick<RSForm, 'items' | 'cstByAlias' | 'analyzer'> {\n const cstByAlias = new Map(session.items.map(item => [item.alias, item]));\n return {\n items: session.items as unknown as RSForm['items'],\n cstByAlias: cstByAlias as unknown as RSForm['cstByAlias'],\n analyzer\n };\n }\n\n private buildAnalyzer(session: SessionState): RSLangAnalyzer {\n const analyzer = new RSLangAnalyzer();\n for (const item of session.items) {\n if (item.cstType === CstType.BASE) {\n analyzer.addBase(item.alias);\n }\n analyzer.setGlobal(\n item.alias,\n item.analysis.type as AnalysisFull['type'],\n item.analysis.valueClass as ValueClass | null\n );\n }\n return analyzer;\n }\n}\n","import { randomUUID } from 'node:crypto';\n\nimport {\n type DiagnosticRecord,\n type ListDiagnosticsFilters,\n type SessionHandle,\n type SessionRevision,\n type SessionState\n} from '../models';\n\ninterface SessionEnvelope {\n state: SessionState;\n diagnostics: DiagnosticRecord[];\n}\n\nexport class SessionStore {\n private sessions = new Map<string, SessionEnvelope>();\n\n public create(initial?: Partial<SessionState>, contractVersion?: string): SessionHandle {\n const now = new Date().toISOString();\n const sessionId = initial?.sessionId ?? randomUUID();\n const state: SessionState = {\n sessionId,\n createdAt: initial?.createdAt ?? now,\n updatedAt: now,\n revisions: initial?.revisions ?? [],\n items: initial?.items ?? [],\n model: initial?.model ?? { items: [] }\n };\n this.sessions.set(sessionId, {\n state,\n diagnostics: []\n });\n return {\n sessionId,\n contractVersion: contractVersion ?? '1.0.0'\n };\n }\n\n public get(sessionId: string): SessionEnvelope {\n const found = this.sessions.get(sessionId);\n if (!found) {\n throw new Error(`Unknown session: ${sessionId}`);\n }\n return found;\n }\n\n public replaceState(sessionId: string, nextState: SessionState): void {\n const found = this.get(sessionId);\n found.state = {\n ...nextState,\n updatedAt: new Date().toISOString()\n };\n }\n\n public addRevision(sessionId: string, message?: string): SessionRevision {\n const found = this.get(sessionId);\n const revision: SessionRevision = {\n revisionId: randomUUID(),\n at: new Date().toISOString(),\n message\n };\n found.state.revisions.push(revision);\n found.state.updatedAt = revision.at;\n return revision;\n }\n\n public appendDiagnostics(sessionId: string, records: DiagnosticRecord[]): void {\n const found = this.get(sessionId);\n found.diagnostics.push(...records);\n found.state.updatedAt = new Date().toISOString();\n }\n\n public listDiagnostics(sessionId: string, filters?: ListDiagnosticsFilters): DiagnosticRecord[] {\n const found = this.get(sessionId);\n if (!filters?.constituentId) {\n return [...found.diagnostics];\n }\n return found.diagnostics.filter(record => record.constituentId === filters.constituentId);\n }\n}\n","import { type AnalysisResult, type AnalyzeExpressionInput } from './analysis';\nimport {\n type AddOrUpdateConstituentaInput,\n type AddOrUpdateConstituentaResult\n} from './constituenta';\nimport {\n type DiagnosticRecord,\n type ListDiagnosticsFilters\n} from './diagnostic';\nimport {\n type EvaluateConstituentaInput,\n type EvaluateExpressionInput,\n type EvaluationResult\n} from './evaluation';\nimport {\n type ClearConstituentaValuesInput,\n type RecalculateModelResult,\n type SessionModelState,\n type SetConstituentaValueInput,\n type SetConstituentaValuesInput\n} from './model-value';\nimport {\n type SessionHandle,\n type SessionRevision,\n type SessionState\n} from './session';\n\nexport const CONTRACT_VERSION = '1.2.0';\n\nexport interface RSToolAgentContract {\n readonly contractVersion: string;\n createSession(initial?: Partial<SessionState>): SessionHandle;\n addOrUpdateConstituenta(sessionId: string, input: AddOrUpdateConstituentaInput): AddOrUpdateConstituentaResult;\n analyzeExpression(sessionId: string, input: AnalyzeExpressionInput): AnalysisResult;\n getFormState(sessionId: string): SessionState;\n listDiagnostics(sessionId: string, filters?: ListDiagnosticsFilters): DiagnosticRecord[];\n commitStep(sessionId: string, message?: string): SessionRevision;\n exportSession(sessionId: string): string;\n importSession(payload: string): SessionHandle;\n setConstituentaValue(sessionId: string, input: SetConstituentaValueInput): Promise<SessionModelState>;\n setConstituentaValues(sessionId: string, input: SetConstituentaValuesInput): Promise<SessionModelState>;\n clearConstituentaValues(sessionId: string, input: ClearConstituentaValuesInput): Promise<SessionModelState>;\n getModelState(sessionId: string): SessionModelState;\n evaluateExpression(sessionId: string, input: EvaluateExpressionInput): EvaluationResult;\n evaluateConstituenta(sessionId: string, input: EvaluateConstituentaInput): EvaluationResult;\n recalculateModel(sessionId: string): RecalculateModelResult;\n}\n","import { ModelAdapter } from '../mappers/model-adapter';\nimport { SchemaAdapter } from '../mappers/schema-adapter';\nimport { SessionStore } from '../session/session-store';\nimport { type AnalysisResult, type AnalyzeExpressionInput } from './analysis';\nimport {\n type AddOrUpdateConstituentaInput,\n type AddOrUpdateConstituentaResult\n} from './constituenta';\nimport { type ListDiagnosticsFilters } from './diagnostic';\nimport {\n type EvaluateConstituentaInput,\n type EvaluateExpressionInput,\n type EvaluationResult\n} from './evaluation';\nimport {\n type ClearConstituentaValuesInput,\n type RecalculateModelResult,\n type SessionModelState,\n type SetConstituentaValueInput,\n type SetConstituentaValuesInput\n} from './model-value';\nimport { type SessionHandle, type SessionRevision, type SessionState } from './session';\nimport { CONTRACT_VERSION, type RSToolAgentContract } from './tool-contract';\n\nexport class RSToolAgent implements RSToolAgentContract {\n public readonly contractVersion = CONTRACT_VERSION;\n private readonly sessions = new SessionStore();\n private readonly adapter = new SchemaAdapter();\n private readonly evaluation = new ModelAdapter();\n\n public createSession(initial?: Partial<SessionState>): SessionHandle {\n return this.sessions.create(initial, this.contractVersion);\n }\n\n public addOrUpdateConstituenta(\n sessionId: string,\n input: AddOrUpdateConstituentaInput\n ): AddOrUpdateConstituentaResult {\n const envelope = this.sessions.get(sessionId);\n const { result, diagnostics } = this.adapter.analyzeAgainstSession(envelope.state, input.draft);\n const state = this.adapter.mergeStateWithDraft(envelope.state, input.draft, result);\n this.sessions.appendDiagnostics(sessionId, diagnostics);\n return {\n state,\n diagnostics\n };\n }\n\n public analyzeExpression(sessionId: string, input: AnalyzeExpressionInput): AnalysisResult {\n const envelope = this.sessions.get(sessionId);\n const { result, diagnostics } = this.adapter.analyzeAgainstSession(envelope.state, {\n id: -1,\n alias: '_analysis',\n cstType: input.cstType,\n definitionFormal: input.expression\n });\n this.sessions.appendDiagnostics(\n sessionId,\n diagnostics.map(item => ({ ...item, constituentId: undefined }))\n );\n return result;\n }\n\n public getFormState(sessionId: string): SessionState {\n const envelope = this.sessions.get(sessionId);\n return structuredClone(envelope.state);\n }\n\n public listDiagnostics(sessionId: string, filters?: ListDiagnosticsFilters) {\n return this.sessions.listDiagnostics(sessionId, filters);\n }\n\n public commitStep(sessionId: string, message?: string): SessionRevision {\n return this.sessions.addRevision(sessionId, message);\n }\n\n public exportSession(sessionId: string): string {\n const envelope = this.sessions.get(sessionId);\n return JSON.stringify(\n {\n contractVersion: this.contractVersion,\n state: envelope.state,\n diagnostics: envelope.diagnostics\n },\n null,\n 2\n );\n }\n\n public importSession(payload: string): SessionHandle {\n const parsed = JSON.parse(payload) as {\n state: SessionState;\n };\n if (!parsed.state.model) {\n parsed.state.model = { items: [] };\n }\n return this.sessions.create(parsed.state, this.contractVersion);\n }\n\n public async setConstituentaValue(\n sessionId: string,\n input: SetConstituentaValueInput\n ): Promise<SessionModelState> {\n const envelope = this.sessions.get(sessionId);\n return this.evaluation.setConstituentaValue(envelope.state, input);\n }\n\n public async setConstituentaValues(\n sessionId: string,\n input: SetConstituentaValuesInput\n ): Promise<SessionModelState> {\n const envelope = this.sessions.get(sessionId);\n return this.evaluation.setConstituentaValues(envelope.state, input);\n }\n\n public async clearConstituentaValues(\n sessionId: string,\n input: ClearConstituentaValuesInput\n ): Promise<SessionModelState> {\n const envelope = this.sessions.get(sessionId);\n return this.evaluation.clearConstituentaValues(envelope.state, input.items);\n }\n\n public getModelState(sessionId: string): SessionModelState {\n const envelope = this.sessions.get(sessionId);\n return structuredClone(envelope.state.model);\n }\n\n public evaluateExpression(sessionId: string, input: EvaluateExpressionInput): EvaluationResult {\n const envelope = this.sessions.get(sessionId);\n return this.evaluation.evaluateExpression(envelope.state, input.expression, input.cstType);\n }\n\n public evaluateConstituenta(sessionId: string, input: EvaluateConstituentaInput): EvaluationResult {\n const envelope = this.sessions.get(sessionId);\n return this.evaluation.evaluateConstituenta(envelope.state, input.constituentId);\n }\n\n public recalculateModel(sessionId: string): RecalculateModelResult {\n const envelope = this.sessions.get(sessionId);\n return this.evaluation.recalculateModel(envelope.state);\n }\n}\n","import { spawn, type ChildProcessByStdio } from 'node:child_process';\nimport readline from 'node:readline';\nimport { type Readable, type Writable } from 'node:stream';\n\nexport interface WrapperResponse<T = unknown> {\n id: string | number | null;\n ok: boolean;\n result?: T;\n error?: {\n code: string;\n message: string;\n details?: unknown;\n };\n}\n\nexport interface RSToolWrapperClientOptions {\n command?: string;\n args?: string[];\n cwd?: string;\n shell?: boolean;\n}\n\nexport class RSToolWrapperClient {\n private process: ChildProcessByStdio<Writable, Readable, null>;\n private input: readline.Interface;\n private pending = new Map<string, (value: WrapperResponse) => void>();\n private requestCounter = 1;\n\n public constructor(options: RSToolWrapperClientOptions = {}) {\n this.process = spawn(options.command ?? 'npm', options.args ?? ['run', 'wrapper'], {\n cwd: options.cwd ?? process.cwd(),\n shell: options.shell ?? true,\n stdio: ['pipe', 'pipe', 'inherit']\n });\n this.input = readline.createInterface({\n input: this.process.stdout,\n crlfDelay: Infinity\n });\n this.input.on('line', line => this.handleLine(line));\n }\n\n public async waitUntilReady(): Promise<void> {\n for (;;) {\n const line = await this.readOneEvent();\n let response: WrapperResponse<{ ready: boolean }> | null = null;\n try {\n response = JSON.parse(line) as WrapperResponse<{ ready: boolean }>;\n } catch {\n continue;\n }\n if (response.ok && response.result?.ready) {\n return;\n }\n }\n }\n\n public async call<T>(method: string, params: unknown = {}): Promise<T> {\n const id = String(this.requestCounter++);\n const payload = JSON.stringify({ id, method, params });\n const responsePromise = new Promise<WrapperResponse>(resolve => {\n this.pending.set(id, resolve);\n });\n this.process.stdin.write(`${payload}\\n`);\n const response = await responsePromise;\n if (!response.ok) {\n throw new Error(`${response.error?.code ?? 'UNKNOWN'}: ${response.error?.message ?? 'Request failed'}`);\n }\n return response.result as T;\n }\n\n public async close(): Promise<void> {\n this.input.close();\n this.process.stdin.end();\n if (!this.process.killed) {\n this.process.kill();\n }\n }\n\n private async readOneEvent(): Promise<string> {\n return new Promise((resolve, reject) => {\n const onLine = (line: string) => {\n cleanup();\n resolve(line);\n };\n const onExit = () => {\n cleanup();\n reject(new Error('Wrapper exited before ready'));\n };\n const cleanup = () => {\n this.input.off('line', onLine);\n this.process.off('exit', onExit);\n };\n this.input.on('line', onLine);\n this.process.on('exit', onExit);\n });\n }\n\n private handleLine(line: string): void {\n let parsed: WrapperResponse;\n try {\n parsed = JSON.parse(line) as WrapperResponse;\n } catch {\n return;\n }\n if (parsed.id === null || parsed.id === undefined) {\n return;\n }\n const id = String(parsed.id);\n const resolver = this.pending.get(id);\n if (!resolver) {\n return;\n }\n this.pending.delete(id);\n resolver(parsed);\n }\n}\n"],"mappings":";AAkBO,SAAS,cAAc,OAAgD;AAC5E,SAAO;AAAA,IACL,MAAM,MAAM;AAAA,IACZ,MAAM,MAAM;AAAA,IACZ,IAAI,MAAM;AAAA,IACV,QAAQ,MAAM;AAAA,EAChB;AACF;AAEO,SAAS,iBAAiB,UAA8C;AAC7E,SAAO;AAAA,IACL,SAAS,SAAS;AAAA,IAClB,MAAM,SAAS;AAAA,IACf,YAAY,SAAS;AAAA,IACrB,aAAa,SAAS,OAAO,IAAI,aAAa;AAAA,EAChD;AACF;;;AClCA,SAAS,eAAe;AACxB,SAAS,kBAAqC;AAC9C,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;;;ACH5B,SAAS,aAAa;AACtB,SAAS,sBAAsB;AAC/B,SAA8B,sBAAmD;AACjF,SAAS,iBAAiB;AAC1B,SAA4B,WAAAA,gBAA4B;AACxD,SAAS,gBAAuC;AAChD,SAA4B,cAAAC,mBAAgC;AAC5D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAYP,I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,GAAG,QAAQ,MAAM;AAC5B,WAAK,QAAQ,GAAG,QAAQ,MAAM;AAAA,IAChC,CAAC;AAAA,EACH;AAAA,EAEQ,WAAW,MAAoB;AACrC,QAAI;AACJ,QAAI;AACF,eAAS,KAAK,MAAM,IAAI;AAAA,IAC1B,QAAQ;AACN;AAAA,IACF;AACA,QAAI,OAAO,OAAO,QAAQ,OAAO,OAAO,QAAW;AACjD;AAAA,IACF;AACA,UAAM,KAAK,OAAO,OAAO,EAAE;AAC3B,UAAM,WAAW,KAAK,QAAQ,IAAI,EAAE;AACpC,QAAI,CAAC,UAAU;AACb;AAAA,IACF;AACA,SAAK,QAAQ,OAAO,EAAE;AACtB,aAAS,MAAM;AAAA,EACjB;AACF;","names":["CstType","EvalStatus","EvalStatus","CstType","RSLangAnalyzer","CstType","RSLangAnalyzer","CstType"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/models/common.ts"],"sourcesContent":["import { CstType } from '@rsconcept/domain/library/rsform';\nimport { EvalStatus, type BasicBinding } from '@rsconcept/domain/library/rsmodel';\nimport { ValueClass } from '@rsconcept/domain/rslang';\nimport { RSErrorCode } from '@rsconcept/domain/rslang/error';\n\nexport { CstType, EvalStatus, RSErrorCode, ValueClass };\nexport type { BasicBinding };\n\n/** Runtime evaluation value: number, nested array (set/tuple), or boolean 0/1. */\nexport type RSToolValue = number | RSToolValue[];\n\nexport interface RSToolErrorDescription {\n code: number;\n from: number;\n to: number;\n params?: readonly string[];\n}\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,SAAS,kBAAqC;AAC9C,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}