@rotorsoft/act-diagram 1.0.21 → 1.1.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.
package/README.md CHANGED
@@ -84,14 +84,31 @@ Interactive mode uses arrow-key navigation ([`@clack/prompts`](https://github.co
84
84
 
85
85
  | Function | Purpose |
86
86
  |---|---|
87
- | `extractModel(files)` | High-level extract: `topoSort` + `buildModel`. Returns `{ model, error? }`. |
88
- | `buildModel(files)` | Lower-level: transpile + execute per-file, returns merged inventory + per-file errors. |
87
+ | `extractModel(files)` | The whole extraction — sort, execute, build. Returns `{ model, error? }`. |
88
+ | `topoSort(files)` | Order files so imports come before importers. |
89
89
  | `validate(model)` | Check for missing emits, orphan reactions, etc. Returns `ValidationWarning[]`. |
90
- | `navigateToCode(files, name, type?)` | Pure function — find `{ file, line, col }` for a named element. |
91
- | `topoSort(files)` | Sort files by import dependency order. |
92
- | `computeLayout(model)` | Pure layout — positions nodes, edges, slice boxes. |
90
+ | `computeLayout(model)` | Pure layout — positions nodes, edges and slice boxes. Returns `Layout`. |
91
+ | `navigateToCode(files, name, type?, targetFile?)` | Pure — resolve a named element to `{ file, line, col }`, or `undefined`. |
93
92
  | `emptyModel()` | Construct an empty `DomainModel`. |
94
- | `parseMultiFileResponse(text)`, `stripFences(text)`, `deriveProjectName(files)` | AI-pipeline helpers used by `ActDiagram` when `onAiRequest` is wired. |
93
+ | `parseMultiFileResponse(raw)`, `stripFences(code)`, `deriveProjectName(prompt, code?)` | AI-pipeline helpers used by `ActDiagram` when `onAiRequest` is wired. |
94
+
95
+ `ActDiagram` runs these for you. They are exported so an IDE integration can
96
+ run them itself — cache a model across renders, extract in a worker, or
97
+ resolve click-to-source without rendering (RFC 1650). `navigateToCode` and
98
+ `computeLayout` are pure, so they are safe to call off the render path.
99
+
100
+ `buildModel` is internal: its input comes from an unexported `execute`, and
101
+ `extractModel` is the supported way in.
102
+
103
+ ### Types
104
+
105
+ `DomainModel`, `ValidationWarning`, `FileTab`, `HostMessage`,
106
+ `DiagramMessage`, `AiOptions`, `NavigateResult`, and the node types
107
+ (`ActNode`, `ActionNode`, `EventNode`, `ProjectionNode`, `ReactionNode`,
108
+ `SliceNode`, `StateNode`, `EntryPoint`).
109
+
110
+ Layout types: `Layout` and its members `LayoutNode`, `LayoutEdge`,
111
+ `LayoutBox`, `LayoutPos`.
95
112
 
96
113
  ### IDE plugin protocol (postMessage)
97
114
 
@@ -144,6 +161,7 @@ const warnings = validate(model);
144
161
 
145
162
  Use when you want to cache the extracted model, run extraction in a worker, or wire it to a non-standard file source.
146
163
 
164
+
147
165
  ### Optional AI refinement
148
166
 
149
167
  The `AiBar` component dispatches refinement prompts to a streaming endpoint. A reference SSE server lives at `src/server/server.ts` (port 4002) and forwards prompts to Anthropic's API:
@@ -176,7 +194,7 @@ Bottom-up: inventory scan → per-state validation → per-slice composition (wi
176
194
 
177
195
  ## Compatibility
178
196
 
179
- - **Node**: >=22.18.0
197
+ - **Node**: >=22.23.2
180
198
  - **Peer**: `react` ^18 || ^19, `react-dom` ^18 || ^19, `zod` ^4.4.3
181
199
  - **Bundled deps**: `lucide-react`, `sucrase`
182
200
  - **CLI**: works from any project where the package is installed; recognizes `$VISUAL` / `$EDITOR` (vim, nvim, nano, emacs, VS Code, Cursor)