@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
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # @rsconcept/rstool
2
2
 
3
- Agent-facing library for **incremental RSForm construction**, **RSLang expression analysis**, **diagnostics**, **modeling**, and **evaluation**. It wraps [`@rsconcept/domain`](https://www.npmjs.com/package/@rsconcept/domain) with a deterministic session contract and a stdio JSON wrapper that LLM agents and Cursor/Claude clients can call directly.
3
+ Agent-facing library for **incremental RSForm construction**, **RSLang expression analysis**, **diagnostics**, **modeling**, and **evaluation**. It wraps [`@rsconcept/domain`](https://www.npmjs.com/package/@rsconcept/domain) with a deterministic session contract and a stdio JSON wrapper that LLM agents and MCP clients can call directly.
4
4
 
5
5
  ## Agent skill
6
6
 
7
- RS language + rstool workflows for agents: `skills/rstool-helper/` (`SKILL.md`, `REFERENCE.md`, `EXAMPLES.md`). The companion language reference in `docs/` (`DOMAIN.md`, `SYNTAX.md`, `TYPIFICATION.md`, `CONSTITUENTA.md`, `DIAGNOSTICS.md`, `PORTAL-API.md`, `GRAMMAR-REF.md`) is distilled from the Portal manuals and ships with the npm package, so standalone agents never need to read the Portal frontend source.
7
+ RS language + rstool workflows for agents: `skills/rstool-helper/` (`GUIDE.md`, `REFERENCE.md`, `EXAMPLES.md`) and `docs/` (`DOMAIN.md`, `SYNTAX.md`, …). A **thin** entry skill is installed into the project’s agent skills folder; see [Installing the agent skill](#installing-the-agent-skill) below.
8
8
 
9
9
  ## Install
10
10
 
@@ -52,16 +52,20 @@ await client.close();
52
52
  - Deterministic diagnostics and export/import for reproducible agent workflows.
53
53
  - Library API + stdio JSON wrapper as the only supported transports (MCP adapter lives in [`@rsconcept/rstool-mcp`](../rstool-mcp/)).
54
54
 
55
+ ## Publishing
56
+
57
+ Maintainers: see [PUBLISHING.md](./PUBLISHING.md) for npm release steps.
58
+
55
59
  ## Repo scripts
56
60
 
57
- This package is part of the [Concept Portal](https://github.com/IRBorisov/ConceptPortal) npm workspaces. From the repo root:
61
+ From `rsconcept/rstool` (or run `powershell -File scripts/dev/LocalDevSetup.ps1` from the repo root on Windows):
58
62
 
59
- - `npm install` — install all workspaces (`@rsconcept/domain`, `frontend`, `@rsconcept/rstool`)
60
- - `npm run typecheck -w @rsconcept/rstool`
61
- - `npm test -w @rsconcept/rstool`
62
- - `npm run build -w @rsconcept/rstool` — produce `dist/` via tsup
63
- - `npm run wrapper -w @rsconcept/rstool` — dev stdio wrapper via `tsx`
64
- - `npm run example:client -w @rsconcept/rstool`, `npm run example:build-schema -w @rsconcept/rstool`, `npm run example:build-rsmodel -w @rsconcept/rstool`
63
+ - `npm install` / `npm ci`
64
+ - `npm run typecheck`
65
+ - `npm test`
66
+ - `npm run build` — produce `dist/` via tsdown
67
+ - `npm run wrapper` — dev stdio wrapper via `tsx`
68
+ - `npm run example:client`, `npm run example:build-schema`, `npm run example:build-rsmodel`
65
69
 
66
70
  ## Stdio protocol
67
71
 
@@ -107,7 +111,7 @@ Example response:
107
111
  Run:
108
112
 
109
113
  ```bash
110
- npm run example:client -w @rsconcept/rstool
114
+ npm run example:client
111
115
  ```
112
116
 
113
117
  File: [`examples/agent-client.ts`](examples/agent-client.ts)
@@ -122,28 +126,19 @@ The example:
122
126
  - sets a base binding and evaluates a term
123
127
  - fetches diagnostics
124
128
 
125
- ## Installing the skill into an agent host
129
+ ## Installing the agent skill
126
130
 
127
- The package ships the skill files in `skills/rstool-helper/`. After install, copy or symlink them into your agent host's skill directory:
131
+ After `npm install @rsconcept/rstool`, **you do not copy files yourself**. Ask your agent, for example:
128
132
 
129
- ```bash
130
- # Cursor (per-project skills)
131
- mkdir -p .agents/skills
132
- cp -r node_modules/@rsconcept/rstool/skills/rstool-helper .agents/skills/rstool-helper
133
- cp -r node_modules/@rsconcept/rstool/docs .agents/skills/rstool-helper/docs
133
+ > Install the rstool agent skill according to the package instructions.
134
134
 
135
- # Claude Code or other hosts: consult host-specific docs
136
- ```
135
+ The agent should read and follow:
137
136
 
138
- PowerShell:
137
+ `node_modules/@rsconcept/rstool/skills/INSTALL.md`
139
138
 
140
- ```powershell
141
- New-Item -ItemType Directory -Force .agents/skills
142
- Copy-Item -Recurse -Force node_modules/@rsconcept/rstool/skills/rstool-helper .agents/skills/rstool-helper
143
- Copy-Item -Recurse -Force node_modules/@rsconcept/rstool/docs .agents/skills/rstool-helper/docs
144
- ```
139
+ That copies `skills/rstool-helper/SKILL.md` from the package into your host’s project skills directory (for example `.agents/skills/rstool-helper/SKILL.md`). Full guidance stays in the package (`skills/rstool-helper/GUIDE.md`, `docs/*.md`) and is read from `node_modules` when needed.
145
140
 
146
- The skill defers to the bundled `docs/*.md` for language reference. Copying both the skill and docs makes the installed agent skill self-contained.
141
+ Details: `skills/README.md`.
147
142
 
148
143
  ## License
149
144
 
@@ -0,0 +1,16 @@
1
+ import { a as RSToolErrorDescription, n as CstType, s as ValueClass } from "./common-DxLg3eXX.js";
2
+
3
+ //#region src/models/analysis.d.ts
4
+ interface AnalyzeExpressionInput {
5
+ expression: string;
6
+ cstType: CstType;
7
+ }
8
+ interface AnalysisResult {
9
+ success: boolean;
10
+ type: Record<string, unknown> | null;
11
+ valueClass: ValueClass | null;
12
+ diagnostics: RSToolErrorDescription[];
13
+ }
14
+ //#endregion
15
+ export { AnalyzeExpressionInput as n, AnalysisResult as t };
16
+ //# sourceMappingURL=analysis-JiwOYDKx.d.ts.map
@@ -0,0 +1,17 @@
1
+ import { CstType as CstType$1 } from "@rsconcept/domain/library/rsform";
2
+ import { BasicBinding, EvalStatus as EvalStatus$1 } from "@rsconcept/domain/library/rsmodel";
3
+ import { ValueClass as ValueClass$1 } from "@rsconcept/domain/rslang";
4
+ import { RSErrorCode } from "@rsconcept/domain/rslang/error";
5
+
6
+ //#region src/models/common.d.ts
7
+ /** Runtime evaluation value: number, nested array (set/tuple), or boolean 0/1. */
8
+ type RSToolValue = number | RSToolValue[];
9
+ interface RSToolErrorDescription {
10
+ code: number;
11
+ from: number;
12
+ to: number;
13
+ params?: readonly string[];
14
+ }
15
+ //#endregion
16
+ export { RSToolErrorDescription as a, RSErrorCode as i, CstType$1 as n, RSToolValue as o, EvalStatus$1 as r, ValueClass$1 as s, BasicBinding as t };
17
+ //# sourceMappingURL=common-DxLg3eXX.d.ts.map
@@ -0,0 +1,36 @@
1
+ import { n as CstType } from "./common-DxLg3eXX.js";
2
+ import { t as AnalysisResult } from "./analysis-JiwOYDKx.js";
3
+ import { t as DiagnosticRecord } from "./diagnostic-BMYvciz8.js";
4
+
5
+ //#region src/models/constituenta.d.ts
6
+ interface ConstituentaDraft {
7
+ id: number;
8
+ /** Alias */
9
+ alias: string;
10
+ /** CST type */
11
+ cstType: CstType;
12
+ /** Formal definition */
13
+ definitionFormal: string;
14
+ /** Natural-language term */
15
+ term?: string;
16
+ /** Natural-language definition */
17
+ definitionText?: string;
18
+ /** Convention or comment */
19
+ convention?: string;
20
+ }
21
+ interface ConstituentaState extends Omit<ConstituentaDraft, 'term' | 'definitionText' | 'convention'> {
22
+ term: string;
23
+ definitionText: string;
24
+ convention: string;
25
+ analysis: AnalysisResult;
26
+ }
27
+ interface AddOrUpdateConstituentaInput {
28
+ draft: ConstituentaDraft;
29
+ }
30
+ interface AddOrUpdateConstituentaResult {
31
+ state: ConstituentaState;
32
+ diagnostics: DiagnosticRecord[];
33
+ }
34
+ //#endregion
35
+ export { ConstituentaState as i, AddOrUpdateConstituentaResult as n, ConstituentaDraft as r, AddOrUpdateConstituentaInput as t };
36
+ //# sourceMappingURL=constituenta-Dnd6iToB.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { a as RSToolErrorDescription } from "./common-DxLg3eXX.js";
2
+
3
+ //#region src/models/diagnostic.d.ts
4
+ interface DiagnosticRecord {
5
+ sessionId: string;
6
+ constituentId?: number;
7
+ expression: string;
8
+ error: RSToolErrorDescription;
9
+ }
10
+ interface ListDiagnosticsFilters {
11
+ constituentId?: number;
12
+ }
13
+ //#endregion
14
+ export { ListDiagnosticsFilters as n, DiagnosticRecord as t };
15
+ //# sourceMappingURL=diagnostic-BMYvciz8.d.ts.map
@@ -0,0 +1,21 @@
1
+ import { a as RSToolErrorDescription, n as CstType, o as RSToolValue, r as EvalStatus, t as BasicBinding } from "./common-DxLg3eXX.js";
2
+
3
+ //#region src/models/evaluation.d.ts
4
+ interface EvaluateExpressionInput {
5
+ expression: string;
6
+ cstType: CstType;
7
+ }
8
+ interface EvaluateConstituentaInput {
9
+ constituentId: number;
10
+ }
11
+ interface EvaluationResult {
12
+ success: boolean;
13
+ value: RSToolValue | BasicBinding | null;
14
+ status: EvalStatus;
15
+ iterations: number;
16
+ cacheHits: number;
17
+ diagnostics: RSToolErrorDescription[];
18
+ }
19
+ //#endregion
20
+ export { EvaluateExpressionInput as n, EvaluationResult as r, EvaluateConstituentaInput as t };
21
+ //# sourceMappingURL=evaluation-CCVYH0wA.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,15 +1,12 @@
1
- export { DomainAnalysisLike, DomainErrorLike, toPublicAnalysis, toPublicError } from './mappers/types.js';
2
- export { AnalysisResult, AnalyzeExpressionInput } from './models/analysis.js';
3
- export { RSToolErrorDescription, RSToolValue } from './models/common.js';
4
- export { AddOrUpdateConstituentaInput, AddOrUpdateConstituentaResult, ConstituentaDraft, ConstituentaState } from './models/constituenta.js';
5
- export { DiagnosticRecord, ListDiagnosticsFilters } from './models/diagnostic.js';
6
- export { EvaluateConstituentaInput, EvaluateExpressionInput, EvaluationResult } from './models/evaluation.js';
7
- export { ClearConstituentaValuesInput, ModelValueState, RecalculateModelResult, SessionModelState, SetConstituentaValueInput, SetConstituentaValuesInput } from './models/model-value.js';
8
- export { RSToolAgent } from './models/rstool-agent.js';
9
- export { SessionHandle, SessionRevision, SessionState } from './models/session.js';
10
- export { CONTRACT_VERSION, RSToolAgentContract } from './models/tool-contract.js';
11
- export { RSToolWrapperClient, RSToolWrapperClientOptions, WrapperResponse } from './wrapper/client.js';
12
- export { BasicBinding, EvalStatus } from '@rsconcept/domain/library/rsmodel';
13
- export { CstType } from '@rsconcept/domain/library/rsform';
14
- export { RSErrorCode } from '@rsconcept/domain/rslang/error';
15
- export { ValueClass } from '@rsconcept/domain/rslang';
1
+ import { a as RSToolErrorDescription, i as RSErrorCode, n as CstType, o as RSToolValue, r as EvalStatus, s as ValueClass, t as BasicBinding } from "./common-DxLg3eXX.js";
2
+ import { n as AnalyzeExpressionInput, t as AnalysisResult } from "./analysis-JiwOYDKx.js";
3
+ import { n as ListDiagnosticsFilters, t as DiagnosticRecord } from "./diagnostic-BMYvciz8.js";
4
+ import { i as ConstituentaState, n as AddOrUpdateConstituentaResult, r as ConstituentaDraft, t as AddOrUpdateConstituentaInput } from "./constituenta-Dnd6iToB.js";
5
+ import { n as EvaluateExpressionInput, r as EvaluationResult, t as EvaluateConstituentaInput } from "./evaluation-CCVYH0wA.js";
6
+ import { a as SetConstituentaValueInput, i as SessionModelState, n as ModelValueState, o as SetConstituentaValuesInput, r as RecalculateModelResult, t as ClearConstituentaValuesInput } from "./model-value-SFAVj0dw.js";
7
+ import { n as SessionRevision, r as SessionState, t as SessionHandle } from "./session-BHGCCLfQ.js";
8
+ import { n as RSToolAgentContract, t as CONTRACT_VERSION } from "./tool-contract-CsGqg_0P.js";
9
+ import { t as RSToolAgent } from "./rstool-agent-DkeH5Qml.js";
10
+ import { DomainAnalysisLike, DomainErrorLike, toPublicAnalysis, toPublicError } from "./mappers/types.js";
11
+ import { RSToolWrapperClient, RSToolWrapperClientOptions, WrapperResponse } from "./wrapper/client.js";
12
+ export { type AddOrUpdateConstituentaInput, type AddOrUpdateConstituentaResult, type AnalysisResult, type AnalyzeExpressionInput, type BasicBinding, CONTRACT_VERSION, type ClearConstituentaValuesInput, type ConstituentaDraft, type ConstituentaState, CstType, type DiagnosticRecord, type DomainAnalysisLike, type DomainErrorLike, EvalStatus, type EvaluateConstituentaInput, type EvaluateExpressionInput, type EvaluationResult, type ListDiagnosticsFilters, type ModelValueState, RSErrorCode, RSToolAgent, type RSToolAgentContract, type RSToolErrorDescription, type RSToolValue, RSToolWrapperClient, type RSToolWrapperClientOptions, type RecalculateModelResult, type SessionHandle, type SessionModelState, type SessionRevision, type SessionState, type SetConstituentaValueInput, type SetConstituentaValuesInput, ValueClass, type WrapperResponse, toPublicAnalysis, toPublicError };