@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.
- package/README.md +21 -26
- package/dist/analysis-JiwOYDKx.d.ts +16 -0
- package/dist/common-DxLg3eXX.d.ts +17 -0
- package/dist/constituenta-Dnd6iToB.d.ts +36 -0
- package/dist/diagnostic-BMYvciz8.d.ts +15 -0
- package/dist/evaluation-CCVYH0wA.d.ts +21 -0
- package/dist/index.d.ts +12 -15
- package/dist/index.js +7 -585
- package/dist/mappers/model-adapter.d.ts +18 -23
- package/dist/mappers/model-adapter.js +183 -231
- package/dist/mappers/model-adapter.js.map +1 -1
- package/dist/mappers/schema-adapter.d.ts +16 -18
- package/dist/mappers/schema-adapter.js +55 -84
- package/dist/mappers/schema-adapter.js.map +1 -1
- package/dist/mappers/types.d.ts +15 -16
- package/dist/mappers/types.js +16 -17
- package/dist/mappers/types.js.map +1 -1
- package/dist/model-value-SFAVj0dw.d.ts +35 -0
- package/dist/models/analysis.d.ts +2 -18
- package/dist/models/analysis.js +1 -1
- package/dist/models/common.d.ts +2 -15
- package/dist/models/common.js +1 -8
- package/dist/models/constituenta.d.ts +2 -38
- package/dist/models/constituenta.js +1 -1
- package/dist/models/diagnostic.d.ts +2 -17
- package/dist/models/diagnostic.js +1 -1
- package/dist/models/evaluation.d.ts +2 -23
- package/dist/models/evaluation.js +1 -1
- package/dist/models/index.d.ts +10 -13
- package/dist/models/index.js +4 -491
- package/dist/models/model-value.d.ts +2 -37
- package/dist/models/model-value.js +1 -1
- package/dist/models/rstool-agent.d.ts +2 -36
- package/dist/models/rstool-agent.js +90 -477
- package/dist/models/rstool-agent.js.map +1 -1
- package/dist/models/session.d.ts +2 -29
- package/dist/models/session.js +1 -1
- package/dist/models/tool-contract.d.ts +2 -33
- package/dist/models/tool-contract.js +5 -5
- package/dist/models/tool-contract.js.map +1 -1
- package/dist/rstool-agent-DkeH5Qml.d.ts +33 -0
- package/dist/session/session-store.d.ts +14 -21
- package/dist/session/session-store.js +59 -63
- package/dist/session/session-store.js.map +1 -1
- package/dist/session-BHGCCLfQ.d.ts +24 -0
- package/dist/tool-contract-CsGqg_0P.d.ts +30 -0
- package/dist/wrapper/client.d.ts +26 -24
- package/dist/wrapper/client.js +90 -93
- package/dist/wrapper/client.js.map +1 -1
- package/dist/wrapper/stdio-wrapper.d.ts +1 -1
- package/dist/wrapper/stdio-wrapper.js +166 -664
- package/dist/wrapper/stdio-wrapper.js.map +1 -1
- package/docs/CONCEPTUAL-SCHEMA.md +168 -0
- package/docs/CONSTITUENTA.md +46 -23
- package/docs/DIAGNOSTICS.md +79 -74
- package/docs/DOMAIN.md +32 -30
- package/docs/GRAMMAR-REF.md +55 -55
- package/docs/PORTAL-API.md +7 -10
- package/docs/README.md +1 -0
- package/docs/SYNTAX.md +32 -32
- package/docs/TYPIFICATION.md +14 -9
- package/package.json +8 -7
- package/skills/INSTALL.md +35 -0
- package/skills/README.md +17 -9
- package/skills/rstool-helper/EXAMPLES.md +51 -10
- package/skills/rstool-helper/GUIDE.md +141 -0
- package/skills/rstool-helper/REFERENCE.md +5 -3
- package/skills/rstool-helper/SKILL.md +23 -134
- package/dist/index.js.map +0 -1
- package/dist/models/analysis.js.map +0 -1
- package/dist/models/common.js.map +0 -1
- package/dist/models/constituenta.js.map +0 -1
- package/dist/models/diagnostic.js.map +0 -1
- package/dist/models/evaluation.js.map +0 -1
- package/dist/models/index.js.map +0 -1
- package/dist/models/model-value.js.map +0 -1
- package/dist/models/session.js.map +0 -1
package/dist/models/session.d.ts
CHANGED
|
@@ -1,29 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import './analysis.js';
|
|
4
|
-
import './common.js';
|
|
5
|
-
import '@rsconcept/domain/library/rsform';
|
|
6
|
-
import '@rsconcept/domain/library/rsmodel';
|
|
7
|
-
import '@rsconcept/domain/rslang';
|
|
8
|
-
import '@rsconcept/domain/rslang/error';
|
|
9
|
-
import './diagnostic.js';
|
|
10
|
-
|
|
11
|
-
interface SessionHandle {
|
|
12
|
-
sessionId: string;
|
|
13
|
-
contractVersion: string;
|
|
14
|
-
}
|
|
15
|
-
interface SessionRevision {
|
|
16
|
-
revisionId: string;
|
|
17
|
-
at: string;
|
|
18
|
-
message?: string;
|
|
19
|
-
}
|
|
20
|
-
interface SessionState {
|
|
21
|
-
sessionId: string;
|
|
22
|
-
createdAt: string;
|
|
23
|
-
updatedAt: string;
|
|
24
|
-
revisions: SessionRevision[];
|
|
25
|
-
items: ConstituentaState[];
|
|
26
|
-
model: SessionModelState;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type { SessionHandle, SessionRevision, SessionState };
|
|
1
|
+
import { n as SessionRevision, r as SessionState, t as SessionHandle } from "../session-BHGCCLfQ.js";
|
|
2
|
+
export { SessionHandle, SessionRevision, SessionState };
|
package/dist/models/session.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { ListDiagnosticsFilters, DiagnosticRecord } from './diagnostic.js';
|
|
4
|
-
import { EvaluateExpressionInput, EvaluationResult, EvaluateConstituentaInput } from './evaluation.js';
|
|
5
|
-
import { SetConstituentaValueInput, SessionModelState, SetConstituentaValuesInput, ClearConstituentaValuesInput, RecalculateModelResult } from './model-value.js';
|
|
6
|
-
import { SessionState, SessionHandle, SessionRevision } from './session.js';
|
|
7
|
-
import './common.js';
|
|
8
|
-
import '@rsconcept/domain/library/rsform';
|
|
9
|
-
import '@rsconcept/domain/library/rsmodel';
|
|
10
|
-
import '@rsconcept/domain/rslang';
|
|
11
|
-
import '@rsconcept/domain/rslang/error';
|
|
12
|
-
|
|
13
|
-
declare const CONTRACT_VERSION = "1.2.0";
|
|
14
|
-
interface RSToolAgentContract {
|
|
15
|
-
readonly contractVersion: string;
|
|
16
|
-
createSession(initial?: Partial<SessionState>): SessionHandle;
|
|
17
|
-
addOrUpdateConstituenta(sessionId: string, input: AddOrUpdateConstituentaInput): AddOrUpdateConstituentaResult;
|
|
18
|
-
analyzeExpression(sessionId: string, input: AnalyzeExpressionInput): AnalysisResult;
|
|
19
|
-
getFormState(sessionId: string): SessionState;
|
|
20
|
-
listDiagnostics(sessionId: string, filters?: ListDiagnosticsFilters): DiagnosticRecord[];
|
|
21
|
-
commitStep(sessionId: string, message?: string): SessionRevision;
|
|
22
|
-
exportSession(sessionId: string): string;
|
|
23
|
-
importSession(payload: string): SessionHandle;
|
|
24
|
-
setConstituentaValue(sessionId: string, input: SetConstituentaValueInput): Promise<SessionModelState>;
|
|
25
|
-
setConstituentaValues(sessionId: string, input: SetConstituentaValuesInput): Promise<SessionModelState>;
|
|
26
|
-
clearConstituentaValues(sessionId: string, input: ClearConstituentaValuesInput): Promise<SessionModelState>;
|
|
27
|
-
getModelState(sessionId: string): SessionModelState;
|
|
28
|
-
evaluateExpression(sessionId: string, input: EvaluateExpressionInput): EvaluationResult;
|
|
29
|
-
evaluateConstituenta(sessionId: string, input: EvaluateConstituentaInput): EvaluationResult;
|
|
30
|
-
recalculateModel(sessionId: string): RecalculateModelResult;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { CONTRACT_VERSION, type RSToolAgentContract };
|
|
1
|
+
import { n as RSToolAgentContract, t as CONTRACT_VERSION } from "../tool-contract-CsGqg_0P.js";
|
|
2
|
+
export { CONTRACT_VERSION, RSToolAgentContract };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/models/tool-contract.ts
|
|
2
|
+
const CONTRACT_VERSION = "1.2.0";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { CONTRACT_VERSION };
|
|
5
|
+
|
|
6
6
|
//# sourceMappingURL=tool-contract.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/models/tool-contract.ts"],"sourcesContent":["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"],"mappings":";
|
|
1
|
+
{"version":3,"file":"tool-contract.js","names":[],"sources":["../../src/models/tool-contract.ts"],"sourcesContent":["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"],"mappings":";AA2BA,MAAa,mBAAmB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { n as AnalyzeExpressionInput, t as AnalysisResult } from "./analysis-JiwOYDKx.js";
|
|
2
|
+
import { n as ListDiagnosticsFilters, t as DiagnosticRecord } from "./diagnostic-BMYvciz8.js";
|
|
3
|
+
import { n as AddOrUpdateConstituentaResult, t as AddOrUpdateConstituentaInput } from "./constituenta-Dnd6iToB.js";
|
|
4
|
+
import { n as EvaluateExpressionInput, r as EvaluationResult, t as EvaluateConstituentaInput } from "./evaluation-CCVYH0wA.js";
|
|
5
|
+
import { a as SetConstituentaValueInput, i as SessionModelState, o as SetConstituentaValuesInput, r as RecalculateModelResult, t as ClearConstituentaValuesInput } from "./model-value-SFAVj0dw.js";
|
|
6
|
+
import { n as SessionRevision, r as SessionState, t as SessionHandle } from "./session-BHGCCLfQ.js";
|
|
7
|
+
import { n as RSToolAgentContract } from "./tool-contract-CsGqg_0P.js";
|
|
8
|
+
|
|
9
|
+
//#region src/models/rstool-agent.d.ts
|
|
10
|
+
declare class RSToolAgent implements RSToolAgentContract {
|
|
11
|
+
readonly contractVersion = "1.2.0";
|
|
12
|
+
private readonly sessions;
|
|
13
|
+
private readonly adapter;
|
|
14
|
+
private readonly evaluation;
|
|
15
|
+
createSession(initial?: Partial<SessionState>): SessionHandle;
|
|
16
|
+
addOrUpdateConstituenta(sessionId: string, input: AddOrUpdateConstituentaInput): AddOrUpdateConstituentaResult;
|
|
17
|
+
analyzeExpression(sessionId: string, input: AnalyzeExpressionInput): AnalysisResult;
|
|
18
|
+
getFormState(sessionId: string): SessionState;
|
|
19
|
+
listDiagnostics(sessionId: string, filters?: ListDiagnosticsFilters): DiagnosticRecord[];
|
|
20
|
+
commitStep(sessionId: string, message?: string): SessionRevision;
|
|
21
|
+
exportSession(sessionId: string): string;
|
|
22
|
+
importSession(payload: string): SessionHandle;
|
|
23
|
+
setConstituentaValue(sessionId: string, input: SetConstituentaValueInput): Promise<SessionModelState>;
|
|
24
|
+
setConstituentaValues(sessionId: string, input: SetConstituentaValuesInput): Promise<SessionModelState>;
|
|
25
|
+
clearConstituentaValues(sessionId: string, input: ClearConstituentaValuesInput): Promise<SessionModelState>;
|
|
26
|
+
getModelState(sessionId: string): SessionModelState;
|
|
27
|
+
evaluateExpression(sessionId: string, input: EvaluateExpressionInput): EvaluationResult;
|
|
28
|
+
evaluateConstituenta(sessionId: string, input: EvaluateConstituentaInput): EvaluationResult;
|
|
29
|
+
recalculateModel(sessionId: string): RecalculateModelResult;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { RSToolAgent as t };
|
|
33
|
+
//# sourceMappingURL=rstool-agent-DkeH5Qml.d.ts.map
|
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SessionState, SessionHandle
|
|
3
|
-
|
|
4
|
-
import '@rsconcept/domain/library/rsform';
|
|
5
|
-
import '@rsconcept/domain/library/rsmodel';
|
|
6
|
-
import '@rsconcept/domain/rslang';
|
|
7
|
-
import '@rsconcept/domain/rslang/error';
|
|
8
|
-
import '../models/constituenta.js';
|
|
9
|
-
import '../models/analysis.js';
|
|
10
|
-
import '../models/model-value.js';
|
|
11
|
-
|
|
1
|
+
import { n as ListDiagnosticsFilters, t as DiagnosticRecord } from "../diagnostic-BMYvciz8.js";
|
|
2
|
+
import { n as SessionRevision, r as SessionState, t as SessionHandle } from "../session-BHGCCLfQ.js";
|
|
3
|
+
//#region src/session/session-store.d.ts
|
|
12
4
|
interface SessionEnvelope {
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
state: SessionState;
|
|
6
|
+
diagnostics: DiagnosticRecord[];
|
|
15
7
|
}
|
|
16
8
|
declare class SessionStore {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
private sessions;
|
|
10
|
+
create(initial?: Partial<SessionState>, contractVersion?: string): SessionHandle;
|
|
11
|
+
get(sessionId: string): SessionEnvelope;
|
|
12
|
+
replaceState(sessionId: string, nextState: SessionState): void;
|
|
13
|
+
addRevision(sessionId: string, message?: string): SessionRevision;
|
|
14
|
+
appendDiagnostics(sessionId: string, records: DiagnosticRecord[]): void;
|
|
15
|
+
listDiagnostics(sessionId: string, filters?: ListDiagnosticsFilters): DiagnosticRecord[];
|
|
24
16
|
}
|
|
25
|
-
|
|
17
|
+
//#endregion
|
|
26
18
|
export { SessionStore };
|
|
19
|
+
//# sourceMappingURL=session-store.d.ts.map
|
|
@@ -1,66 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
//#region src/session/session-store.ts
|
|
3
3
|
var SessionStore = class {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return [...found.diagnostics];
|
|
59
|
-
}
|
|
60
|
-
return found.diagnostics.filter((record) => record.constituentId === filters.constituentId);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
export {
|
|
64
|
-
SessionStore
|
|
4
|
+
sessions = /* @__PURE__ */ new Map();
|
|
5
|
+
create(initial, contractVersion) {
|
|
6
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7
|
+
const sessionId = initial?.sessionId ?? randomUUID();
|
|
8
|
+
const state = {
|
|
9
|
+
sessionId,
|
|
10
|
+
createdAt: initial?.createdAt ?? now,
|
|
11
|
+
updatedAt: now,
|
|
12
|
+
revisions: initial?.revisions ?? [],
|
|
13
|
+
items: initial?.items ?? [],
|
|
14
|
+
model: initial?.model ?? { items: [] }
|
|
15
|
+
};
|
|
16
|
+
this.sessions.set(sessionId, {
|
|
17
|
+
state,
|
|
18
|
+
diagnostics: []
|
|
19
|
+
});
|
|
20
|
+
return {
|
|
21
|
+
sessionId,
|
|
22
|
+
contractVersion: contractVersion ?? "1.0.0"
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
get(sessionId) {
|
|
26
|
+
const found = this.sessions.get(sessionId);
|
|
27
|
+
if (!found) throw new Error(`Unknown session: ${sessionId}`);
|
|
28
|
+
return found;
|
|
29
|
+
}
|
|
30
|
+
replaceState(sessionId, nextState) {
|
|
31
|
+
const found = this.get(sessionId);
|
|
32
|
+
found.state = {
|
|
33
|
+
...nextState,
|
|
34
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
addRevision(sessionId, message) {
|
|
38
|
+
const found = this.get(sessionId);
|
|
39
|
+
const revision = {
|
|
40
|
+
revisionId: randomUUID(),
|
|
41
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
42
|
+
message
|
|
43
|
+
};
|
|
44
|
+
found.state.revisions.push(revision);
|
|
45
|
+
found.state.updatedAt = revision.at;
|
|
46
|
+
return revision;
|
|
47
|
+
}
|
|
48
|
+
appendDiagnostics(sessionId, records) {
|
|
49
|
+
const found = this.get(sessionId);
|
|
50
|
+
found.diagnostics.push(...records);
|
|
51
|
+
found.state.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
52
|
+
}
|
|
53
|
+
listDiagnostics(sessionId, filters) {
|
|
54
|
+
const found = this.get(sessionId);
|
|
55
|
+
if (!filters?.constituentId) return [...found.diagnostics];
|
|
56
|
+
return found.diagnostics.filter((record) => record.constituentId === filters.constituentId);
|
|
57
|
+
}
|
|
65
58
|
};
|
|
59
|
+
//#endregion
|
|
60
|
+
export { SessionStore };
|
|
61
|
+
|
|
66
62
|
//# sourceMappingURL=session-store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/session/session-store.ts"],"sourcesContent":["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"],"mappings":"
|
|
1
|
+
{"version":3,"file":"session-store.js","names":[],"sources":["../../src/session/session-store.ts"],"sourcesContent":["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"],"mappings":";;AAeA,IAAa,eAAb,MAA0B;CACxB,2BAAmB,IAAI,IAA6B;CAEpD,OAAc,SAAiC,iBAAyC;EACtF,MAAM,uBAAM,IAAI,KAAK,GAAE,YAAY;EACnC,MAAM,YAAY,SAAS,aAAa,WAAW;EACnD,MAAM,QAAsB;GAC1B;GACA,WAAW,SAAS,aAAa;GACjC,WAAW;GACX,WAAW,SAAS,aAAa,CAAC;GAClC,OAAO,SAAS,SAAS,CAAC;GAC1B,OAAO,SAAS,SAAS,EAAE,OAAO,CAAC,EAAE;EACvC;EACA,KAAK,SAAS,IAAI,WAAW;GAC3B;GACA,aAAa,CAAC;EAChB,CAAC;EACD,OAAO;GACL;GACA,iBAAiB,mBAAmB;EACtC;CACF;CAEA,IAAW,WAAoC;EAC7C,MAAM,QAAQ,KAAK,SAAS,IAAI,SAAS;EACzC,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,oBAAoB,WAAW;EAEjD,OAAO;CACT;CAEA,aAAoB,WAAmB,WAA+B;EACpE,MAAM,QAAQ,KAAK,IAAI,SAAS;EAChC,MAAM,QAAQ;GACZ,GAAG;GACH,4BAAW,IAAI,KAAK,GAAE,YAAY;EACpC;CACF;CAEA,YAAmB,WAAmB,SAAmC;EACvE,MAAM,QAAQ,KAAK,IAAI,SAAS;EAChC,MAAM,WAA4B;GAChC,YAAY,WAAW;GACvB,qBAAI,IAAI,KAAK,GAAE,YAAY;GAC3B;EACF;EACA,MAAM,MAAM,UAAU,KAAK,QAAQ;EACnC,MAAM,MAAM,YAAY,SAAS;EACjC,OAAO;CACT;CAEA,kBAAyB,WAAmB,SAAmC;EAC7E,MAAM,QAAQ,KAAK,IAAI,SAAS;EAChC,MAAM,YAAY,KAAK,GAAG,OAAO;EACjC,MAAM,MAAM,6BAAY,IAAI,KAAK,GAAE,YAAY;CACjD;CAEA,gBAAuB,WAAmB,SAAsD;EAC9F,MAAM,QAAQ,KAAK,IAAI,SAAS;EAChC,IAAI,CAAC,SAAS,eACZ,OAAO,CAAC,GAAG,MAAM,WAAW;EAE9B,OAAO,MAAM,YAAY,QAAO,WAAU,OAAO,kBAAkB,QAAQ,aAAa;CAC1F;AACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { i as ConstituentaState } from "./constituenta-Dnd6iToB.js";
|
|
2
|
+
import { i as SessionModelState } from "./model-value-SFAVj0dw.js";
|
|
3
|
+
|
|
4
|
+
//#region src/models/session.d.ts
|
|
5
|
+
interface SessionHandle {
|
|
6
|
+
sessionId: string;
|
|
7
|
+
contractVersion: string;
|
|
8
|
+
}
|
|
9
|
+
interface SessionRevision {
|
|
10
|
+
revisionId: string;
|
|
11
|
+
at: string;
|
|
12
|
+
message?: string;
|
|
13
|
+
}
|
|
14
|
+
interface SessionState {
|
|
15
|
+
sessionId: string;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
revisions: SessionRevision[];
|
|
19
|
+
items: ConstituentaState[];
|
|
20
|
+
model: SessionModelState;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { SessionRevision as n, SessionState as r, SessionHandle as t };
|
|
24
|
+
//# sourceMappingURL=session-BHGCCLfQ.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { n as AnalyzeExpressionInput, t as AnalysisResult } from "./analysis-JiwOYDKx.js";
|
|
2
|
+
import { n as ListDiagnosticsFilters, t as DiagnosticRecord } from "./diagnostic-BMYvciz8.js";
|
|
3
|
+
import { n as AddOrUpdateConstituentaResult, t as AddOrUpdateConstituentaInput } from "./constituenta-Dnd6iToB.js";
|
|
4
|
+
import { n as EvaluateExpressionInput, r as EvaluationResult, t as EvaluateConstituentaInput } from "./evaluation-CCVYH0wA.js";
|
|
5
|
+
import { a as SetConstituentaValueInput, i as SessionModelState, o as SetConstituentaValuesInput, r as RecalculateModelResult, t as ClearConstituentaValuesInput } from "./model-value-SFAVj0dw.js";
|
|
6
|
+
import { n as SessionRevision, r as SessionState, t as SessionHandle } from "./session-BHGCCLfQ.js";
|
|
7
|
+
|
|
8
|
+
//#region src/models/tool-contract.d.ts
|
|
9
|
+
declare const CONTRACT_VERSION = "1.2.0";
|
|
10
|
+
interface RSToolAgentContract {
|
|
11
|
+
readonly contractVersion: string;
|
|
12
|
+
createSession(initial?: Partial<SessionState>): SessionHandle;
|
|
13
|
+
addOrUpdateConstituenta(sessionId: string, input: AddOrUpdateConstituentaInput): AddOrUpdateConstituentaResult;
|
|
14
|
+
analyzeExpression(sessionId: string, input: AnalyzeExpressionInput): AnalysisResult;
|
|
15
|
+
getFormState(sessionId: string): SessionState;
|
|
16
|
+
listDiagnostics(sessionId: string, filters?: ListDiagnosticsFilters): DiagnosticRecord[];
|
|
17
|
+
commitStep(sessionId: string, message?: string): SessionRevision;
|
|
18
|
+
exportSession(sessionId: string): string;
|
|
19
|
+
importSession(payload: string): SessionHandle;
|
|
20
|
+
setConstituentaValue(sessionId: string, input: SetConstituentaValueInput): Promise<SessionModelState>;
|
|
21
|
+
setConstituentaValues(sessionId: string, input: SetConstituentaValuesInput): Promise<SessionModelState>;
|
|
22
|
+
clearConstituentaValues(sessionId: string, input: ClearConstituentaValuesInput): Promise<SessionModelState>;
|
|
23
|
+
getModelState(sessionId: string): SessionModelState;
|
|
24
|
+
evaluateExpression(sessionId: string, input: EvaluateExpressionInput): EvaluationResult;
|
|
25
|
+
evaluateConstituenta(sessionId: string, input: EvaluateConstituentaInput): EvaluationResult;
|
|
26
|
+
recalculateModel(sessionId: string): RecalculateModelResult;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { RSToolAgentContract as n, CONTRACT_VERSION as t };
|
|
30
|
+
//# sourceMappingURL=tool-contract-CsGqg_0P.d.ts.map
|
package/dist/wrapper/client.d.ts
CHANGED
|
@@ -1,30 +1,32 @@
|
|
|
1
|
+
//#region src/wrapper/client.d.ts
|
|
1
2
|
interface WrapperResponse<T = unknown> {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
id: string | number | null;
|
|
4
|
+
ok: boolean;
|
|
5
|
+
result?: T;
|
|
6
|
+
error?: {
|
|
7
|
+
code: string;
|
|
8
|
+
message: string;
|
|
9
|
+
details?: unknown;
|
|
10
|
+
};
|
|
10
11
|
}
|
|
11
12
|
interface RSToolWrapperClientOptions {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
command?: string;
|
|
14
|
+
args?: string[];
|
|
15
|
+
cwd?: string;
|
|
16
|
+
shell?: boolean;
|
|
16
17
|
}
|
|
17
18
|
declare class RSToolWrapperClient {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
private process;
|
|
20
|
+
private input;
|
|
21
|
+
private pending;
|
|
22
|
+
private requestCounter;
|
|
23
|
+
constructor(options?: RSToolWrapperClientOptions);
|
|
24
|
+
waitUntilReady(): Promise<void>;
|
|
25
|
+
call<T>(method: string, params?: unknown): Promise<T>;
|
|
26
|
+
close(): Promise<void>;
|
|
27
|
+
private readOneEvent;
|
|
28
|
+
private handleLine;
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
export { RSToolWrapperClient,
|
|
30
|
+
//#endregion
|
|
31
|
+
export { RSToolWrapperClient, RSToolWrapperClientOptions, WrapperResponse };
|
|
32
|
+
//# sourceMappingURL=client.d.ts.map
|
package/dist/wrapper/client.js
CHANGED
|
@@ -1,96 +1,93 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import readline from "node:readline";
|
|
3
|
+
//#region src/wrapper/client.ts
|
|
4
4
|
var RSToolWrapperClient = class {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
this.pending.delete(id);
|
|
90
|
-
resolver(parsed);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
export {
|
|
94
|
-
RSToolWrapperClient
|
|
5
|
+
process;
|
|
6
|
+
input;
|
|
7
|
+
pending = /* @__PURE__ */ new Map();
|
|
8
|
+
requestCounter = 1;
|
|
9
|
+
constructor(options = {}) {
|
|
10
|
+
this.process = spawn(options.command ?? "npm", options.args ?? ["run", "wrapper"], {
|
|
11
|
+
cwd: options.cwd ?? process.cwd(),
|
|
12
|
+
shell: options.shell ?? true,
|
|
13
|
+
stdio: [
|
|
14
|
+
"pipe",
|
|
15
|
+
"pipe",
|
|
16
|
+
"inherit"
|
|
17
|
+
]
|
|
18
|
+
});
|
|
19
|
+
this.input = readline.createInterface({
|
|
20
|
+
input: this.process.stdout,
|
|
21
|
+
crlfDelay: Infinity
|
|
22
|
+
});
|
|
23
|
+
this.input.on("line", (line) => this.handleLine(line));
|
|
24
|
+
}
|
|
25
|
+
async waitUntilReady() {
|
|
26
|
+
for (;;) {
|
|
27
|
+
const line = await this.readOneEvent();
|
|
28
|
+
let response = null;
|
|
29
|
+
try {
|
|
30
|
+
response = JSON.parse(line);
|
|
31
|
+
} catch {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (response.ok && response.result?.ready) return;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async call(method, params = {}) {
|
|
38
|
+
const id = String(this.requestCounter++);
|
|
39
|
+
const payload = JSON.stringify({
|
|
40
|
+
id,
|
|
41
|
+
method,
|
|
42
|
+
params
|
|
43
|
+
});
|
|
44
|
+
const responsePromise = new Promise((resolve) => {
|
|
45
|
+
this.pending.set(id, resolve);
|
|
46
|
+
});
|
|
47
|
+
this.process.stdin.write(`${payload}\n`);
|
|
48
|
+
const response = await responsePromise;
|
|
49
|
+
if (!response.ok) throw new Error(`${response.error?.code ?? "UNKNOWN"}: ${response.error?.message ?? "Request failed"}`);
|
|
50
|
+
return response.result;
|
|
51
|
+
}
|
|
52
|
+
async close() {
|
|
53
|
+
this.input.close();
|
|
54
|
+
this.process.stdin.end();
|
|
55
|
+
if (!this.process.killed) this.process.kill();
|
|
56
|
+
}
|
|
57
|
+
async readOneEvent() {
|
|
58
|
+
return new Promise((resolve, reject) => {
|
|
59
|
+
const onLine = (line) => {
|
|
60
|
+
cleanup();
|
|
61
|
+
resolve(line);
|
|
62
|
+
};
|
|
63
|
+
const onExit = () => {
|
|
64
|
+
cleanup();
|
|
65
|
+
reject(/* @__PURE__ */ new Error("Wrapper exited before ready"));
|
|
66
|
+
};
|
|
67
|
+
const cleanup = () => {
|
|
68
|
+
this.input.off("line", onLine);
|
|
69
|
+
this.process.off("exit", onExit);
|
|
70
|
+
};
|
|
71
|
+
this.input.on("line", onLine);
|
|
72
|
+
this.process.on("exit", onExit);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
handleLine(line) {
|
|
76
|
+
let parsed;
|
|
77
|
+
try {
|
|
78
|
+
parsed = JSON.parse(line);
|
|
79
|
+
} catch {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (parsed.id === null || parsed.id === void 0) return;
|
|
83
|
+
const id = String(parsed.id);
|
|
84
|
+
const resolver = this.pending.get(id);
|
|
85
|
+
if (!resolver) return;
|
|
86
|
+
this.pending.delete(id);
|
|
87
|
+
resolver(parsed);
|
|
88
|
+
}
|
|
95
89
|
};
|
|
90
|
+
//#endregion
|
|
91
|
+
export { RSToolWrapperClient };
|
|
92
|
+
|
|
96
93
|
//# sourceMappingURL=client.js.map
|