@rsconcept/rstool 0.10.2 → 1.0.0

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 (112) hide show
  1. package/README.md +41 -31
  2. package/dist/agent-workflow-D-PSIb-m.d.ts +70 -0
  3. package/dist/analysis-LLnPhmGa.d.ts +23 -0
  4. package/dist/{common-DxLg3eXX.d.ts → common-DHJalS-Q.d.ts} +6 -1
  5. package/dist/constituenta-DnGR6bnM.d.ts +54 -0
  6. package/dist/diagnostic-D9yl_mEL.d.ts +19 -0
  7. package/dist/evaluation-Cns8BFm4.d.ts +31 -0
  8. package/dist/index.d.ts +11 -11
  9. package/dist/index.js +1 -1
  10. package/dist/mappers/model-adapter.d.ts +3 -3
  11. package/dist/mappers/schema-adapter.d.ts +4 -4
  12. package/dist/mappers/types.d.ts +6 -2
  13. package/dist/mappers/types.js +2 -0
  14. package/dist/mappers/types.js.map +1 -1
  15. package/dist/{model-value-SFAVj0dw.d.ts → model-value-BbonPzMz.d.ts} +14 -3
  16. package/dist/models/agent-workflow.d.ts +2 -0
  17. package/dist/models/agent-workflow.js +1 -0
  18. package/dist/models/analysis.d.ts +1 -1
  19. package/dist/models/common.d.ts +1 -1
  20. package/dist/models/constituenta.d.ts +2 -2
  21. package/dist/models/diagnostic.d.ts +1 -1
  22. package/dist/models/evaluation.d.ts +2 -2
  23. package/dist/models/index.d.ts +11 -11
  24. package/dist/models/index.js +2 -2
  25. package/dist/models/model-value.d.ts +2 -2
  26. package/dist/models/rstool-agent.d.ts +1 -1
  27. package/dist/models/rstool-agent.js +1 -1
  28. package/dist/models/session.d.ts +1 -1
  29. package/dist/models/tool-contract.d.ts +2 -2
  30. package/dist/models/tool-contract.js +2 -1
  31. package/dist/models/tool-contract.js.map +1 -1
  32. package/dist/rstool-agent-_8bplZnb.d.ts +71 -0
  33. package/dist/rstool-agent-kijHA9ML.js +476 -0
  34. package/dist/rstool-agent-kijHA9ML.js.map +1 -0
  35. package/dist/session/session-store.d.ts +18 -5
  36. package/dist/session/session-store.js +1 -64
  37. package/dist/{session-BPgsE80c.d.ts → session-ChexW8i7.d.ts} +11 -8
  38. package/dist/session-store-C3jyOSqI.js +142 -0
  39. package/dist/session-store-C3jyOSqI.js.map +1 -0
  40. package/dist/tool-contract-5_Q44DGE.d.ts +164 -0
  41. package/dist/wrapper/client.d.ts +23 -0
  42. package/dist/wrapper/client.js +17 -0
  43. package/dist/wrapper/client.js.map +1 -1
  44. package/dist/wrapper/stdio-wrapper.js +62 -52
  45. package/dist/wrapper/stdio-wrapper.js.map +1 -1
  46. package/docs/CONSTITUENTA.md +2 -2
  47. package/docs/DIAGNOSTICS.md +20 -18
  48. package/docs/MODEL-TESTING.md +3 -3
  49. package/docs/PORTAL-API.md +24 -18
  50. package/examples/README.md +1 -1
  51. package/examples/agent-client.ts +11 -41
  52. package/examples/build-chocolate-nim-rsform.ts +23 -18
  53. package/examples/chocolate-nim/build-rsform.ts +23 -18
  54. package/examples/chocolate-nim/build-rsmodel.ts +10 -12
  55. package/examples/chocolate-nim/rsform-session.json +290 -290
  56. package/examples/chocolate-nim/rsmodel-session.json +291 -291
  57. package/examples/expression-bank/bank-constituents.ts +304 -53
  58. package/examples/expression-bank/build-rsform.ts +19 -16
  59. package/examples/expression-bank/rsform-session.json +1551 -1551
  60. package/examples/kinship/build-rsform.ts +23 -18
  61. package/examples/kinship/build-rsmodel.ts +13 -15
  62. package/examples/kinship/rsform-session.json +219 -219
  63. package/examples/kinship/rsmodel-session.json +221 -221
  64. package/examples/kinship/session.ts +19 -21
  65. package/examples/movd/build-rsform.ts +23 -18
  66. package/examples/movd/build-rsmodel.ts +18 -20
  67. package/examples/movd/rsform-session.json +262 -262
  68. package/examples/movd/rsmodel-session.json +264 -264
  69. package/examples/sample/build-rsform.ts +19 -50
  70. package/examples/sample/build-rsmodel.ts +25 -44
  71. package/examples/sample/rsform-session.json +36 -33
  72. package/examples/sample/rsmodel-session.json +36 -33
  73. package/examples/template-apply/build-rsform.ts +27 -24
  74. package/examples/template-apply/rsform-session.json +48 -48
  75. package/package.json +3 -3
  76. package/skills/rstool-helper/EXAMPLES.md +44 -116
  77. package/skills/rstool-helper/GUIDE.md +40 -25
  78. package/skills/rstool-helper/REFERENCE.md +40 -177
  79. package/src/index.ts +24 -17
  80. package/src/mappers/portal-adapter.ts +43 -0
  81. package/src/mappers/types.ts +4 -0
  82. package/src/models/agent-workflow.ts +78 -0
  83. package/src/models/analysis.ts +7 -0
  84. package/src/models/common.ts +7 -0
  85. package/src/models/constituenta.ts +24 -6
  86. package/src/models/diagnostic.ts +4 -0
  87. package/src/models/evaluation.ts +11 -0
  88. package/src/models/import-detect.ts +39 -0
  89. package/src/models/import-export.ts +24 -0
  90. package/src/models/index.ts +22 -14
  91. package/src/models/model-value.ts +12 -0
  92. package/src/models/portal-json.ts +44 -0
  93. package/src/models/rstool-agent.test.ts +300 -147
  94. package/src/models/rstool-agent.ts +350 -93
  95. package/src/models/session.ts +8 -5
  96. package/src/models/tool-contract.ts +81 -42
  97. package/src/session/batch-apply.test.ts +28 -0
  98. package/src/session/batch-apply.ts +47 -0
  99. package/src/session/persistence.ts +56 -0
  100. package/src/session/session-store.ts +67 -4
  101. package/src/wrapper/client.ts +23 -0
  102. package/src/wrapper/stdio-wrapper.ts +59 -49
  103. package/dist/analysis-JiwOYDKx.d.ts +0 -16
  104. package/dist/constituenta-Dnd6iToB.d.ts +0 -36
  105. package/dist/diagnostic-BMYvciz8.d.ts +0 -15
  106. package/dist/evaluation-CCVYH0wA.d.ts +0 -21
  107. package/dist/index-uhkmwruf.d.ts +0 -46
  108. package/dist/rstool-agent-BZi5jO1y.js +0 -158
  109. package/dist/rstool-agent-BZi5jO1y.js.map +0 -1
  110. package/dist/rstool-agent-pRaPnZay.d.ts +0 -35
  111. package/dist/session/session-store.js.map +0 -1
  112. package/dist/tool-contract-n1ghUOrK.d.ts +0 -32
@@ -0,0 +1,24 @@
1
+ import { type PortalModelImportData, type PortalSchemaImportData } from './portal-json';
2
+
3
+ /** Portal export target: conceptual schema or model values. */
4
+ export type PortalExportKind = 'schema' | 'model';
5
+
6
+ /** Serialized JSON string or parsed object for export helpers. */
7
+ export type ExportFormat = 'json' | 'object';
8
+
9
+ /** Input for {@link RSToolAgent.exportPortal}. */
10
+ export interface ExportPortalInput {
11
+ kind: PortalExportKind;
12
+ /** Default: `json` (string). Use `object` for structured data. */
13
+ format?: ExportFormat;
14
+ }
15
+
16
+ /**
17
+ * Import payload discriminator.
18
+ *
19
+ * Use `'auto'` to detect from JSON shape, or pass an explicit kind when ambiguous.
20
+ */
21
+ export type ImportDataKind = 'auto' | 'session' | 'portal-schema' | 'portal-details';
22
+
23
+ /** JSON string or Portal import object, depending on {@link ExportFormat}. */
24
+ export type ExportPortalResult = string | PortalSchemaImportData | PortalModelImportData;
@@ -1,3 +1,12 @@
1
+ export {
2
+ type AgentConstituentaPatch,
3
+ type ApplySchemaPatchInput,
4
+ type ApplySchemaPatchResult,
5
+ type SessionStateDetail,
6
+ type SessionStateResult,
7
+ type SessionSummary,
8
+ type SessionSummaryItem
9
+ } from './agent-workflow';
1
10
  export { type AnalysisResult, type AnalyzeExpressionInput } from './analysis';
2
11
  export {
3
12
  CstType,
@@ -8,34 +17,33 @@ export {
8
17
  type RSToolErrorDescription,
9
18
  type RSToolValue
10
19
  } from './common';
11
- export {
12
- type AddOrUpdateConstituentaInput,
13
- type AddOrUpdateConstituentaResult,
14
- type ConstituentaDraft,
15
- type ConstituentaState
16
- } from './constituenta';
20
+ export { type ApplyConstituentsMode, type ConstituentaDraft, type ConstituentaState } from './constituenta';
17
21
  export { type DiagnosticRecord, type ListDiagnosticsFilters } from './diagnostic';
22
+ export { type EvaluateInput, type EvaluationResult } from './evaluation';
18
23
  export {
19
- type EvaluateConstituentaInput,
20
- type EvaluateExpressionInput,
21
- type EvaluationResult
22
- } from './evaluation';
24
+ type ExportFormat,
25
+ type ExportPortalInput,
26
+ type ExportPortalResult,
27
+ type ImportDataKind,
28
+ type PortalExportKind
29
+ } from './import-export';
23
30
  export {
24
- type ClearConstituentaValuesInput,
25
31
  type ModelValueState,
26
32
  type RecalculateModelResult,
27
33
  type SessionModelState,
28
34
  type SetConstituentaValueInput,
29
- type SetConstituentaValuesInput
35
+ type SetModelValuesInput
30
36
  } from './model-value';
31
37
  export {
32
38
  PORTAL_JSON_CONTRACT_VERSION,
33
39
  type PortalImportMetadata,
34
40
  type PortalModelImportData,
41
+ type PortalRsformDetails,
35
42
  type PortalSchemaConstituenta,
36
43
  type PortalSchemaImportData,
37
- type PortalTermForm
44
+ type PortalTermForm,
45
+ portalItemToDraft
38
46
  } from './portal-json';
39
47
  export { RSToolAgent } from './rstool-agent';
40
48
  export { type SessionHandle, type SessionRevision, type SessionState } from './session';
41
- export { CONTRACT_VERSION, type RSToolAgentContract } from './tool-contract';
49
+ export { CONTRACT_VERSION, type RSToolAgentContract, type RSToolAgentOptions } from './tool-contract';
@@ -1,5 +1,6 @@
1
1
  import { type BasicBinding, type EvalStatus, type RSToolValue } from './common';
2
2
 
3
+ /** Model value for one constituent. */
3
4
  export interface ModelValueState {
4
5
  id: number;
5
6
  /** Frontend type string: `basic` or normalized effective typification. */
@@ -7,11 +8,14 @@ export interface ModelValueState {
7
8
  value: RSToolValue | BasicBinding;
8
9
  }
9
10
 
11
+ /** All model values in a session. */
10
12
  export interface SessionModelState {
11
13
  items: ModelValueState[];
12
14
  }
13
15
 
16
+ /** Set or replace the model value for one constituent. */
14
17
  export interface SetConstituentaValueInput {
18
+ /** Target constituent id. */
15
19
  target: number;
16
20
  /** Optional type override; inferred from schema when omitted. */
17
21
  type?: string;
@@ -26,6 +30,14 @@ export interface ClearConstituentaValuesInput {
26
30
  items: number[];
27
31
  }
28
32
 
33
+ /** Input for {@link RSToolAgent.setModelValues}. */
34
+ export interface SetModelValuesInput {
35
+ set?: SetConstituentaValueInput[];
36
+ /** Constituent ids whose model values should be cleared. */
37
+ clear?: number[];
38
+ }
39
+
40
+ /** Per-constituent outcome after {@link RSToolAgent.recalculateModel}. */
29
41
  export interface RecalculateModelResult {
30
42
  items: Array<{ id: number; alias: string; value: RSToolValue | null; status: EvalStatus }>;
31
43
  }
@@ -1,8 +1,10 @@
1
1
  import { type BasicBinding, type RSToolValue } from './common';
2
+ import { type ConstituentaDraft } from './constituenta';
2
3
 
3
4
  /** Portal JSON import/export format version (schema and model files). */
4
5
  export const PORTAL_JSON_CONTRACT_VERSION = '1.0.0';
5
6
 
7
+ /** Shared metadata block in Portal schema and model JSON files. */
6
8
  export interface PortalImportMetadata {
7
9
  contract_version: string;
8
10
  title: string;
@@ -10,11 +12,13 @@ export interface PortalImportMetadata {
10
12
  description: string;
11
13
  }
12
14
 
15
+ /** Inflected or tagged surface form of a term. */
13
16
  export interface PortalTermForm {
14
17
  text: string;
15
18
  tags: string;
16
19
  }
17
20
 
21
+ /** One constituent in Portal schema JSON (`cst_type`, snake_case fields). */
18
22
  export interface PortalSchemaConstituenta {
19
23
  id: number;
20
24
  alias: string;
@@ -31,11 +35,30 @@ export interface PortalSchemaConstituenta {
31
35
  term_forms: PortalTermForm[];
32
36
  }
33
37
 
38
+ /** Full Portal conceptual schema import/export document. */
34
39
  export interface PortalSchemaImportData extends PortalImportMetadata {
35
40
  items: PortalSchemaConstituenta[];
36
41
  attribution: Array<{ container: number; attribute: number }>;
37
42
  }
38
43
 
44
+ /** `GET /api/rsforms/:id/details` response (schema payload only). */
45
+ export interface PortalRsformDetails {
46
+ id?: number;
47
+ title?: string;
48
+ alias?: string;
49
+ description?: string;
50
+ items: Array<{
51
+ id: number;
52
+ alias: string;
53
+ cst_type: string;
54
+ definition_formal?: string;
55
+ term_raw?: string;
56
+ definition_raw?: string;
57
+ convention?: string;
58
+ }>;
59
+ }
60
+
61
+ /** Full Portal conceptual model import/export document. */
39
62
  export interface PortalModelImportData extends PortalImportMetadata {
40
63
  items: Array<{
41
64
  id: number;
@@ -43,3 +66,24 @@ export interface PortalModelImportData extends PortalImportMetadata {
43
66
  value: RSToolValue | BasicBinding;
44
67
  }>;
45
68
  }
69
+
70
+ /** Map a Portal API or JSON schema item to an agent {@link ConstituentaDraft}. */
71
+ export function portalItemToDraft(item: {
72
+ id: number;
73
+ alias: string;
74
+ cst_type: string;
75
+ definition_formal?: string;
76
+ term_raw?: string;
77
+ definition_raw?: string;
78
+ convention?: string;
79
+ }): ConstituentaDraft {
80
+ return {
81
+ id: item.id,
82
+ alias: item.alias,
83
+ cstType: item.cst_type as ConstituentaDraft['cstType'],
84
+ definitionFormal: item.definition_formal ?? '',
85
+ term: item.term_raw ?? '',
86
+ definitionText: item.definition_raw ?? '',
87
+ convention: item.convention ?? ''
88
+ };
89
+ }