@kawaijs/runtime 0.1.0 → 0.1.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 (2) hide show
  1. package/README.md +42 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # @kawaijs/runtime
2
+
3
+ **Headless Story VM, State Machine, Snapshot Rollback, and Persistence Engine for Kawaijs.**
4
+
5
+ Part of the [Kawaijs](https://github.com/biagio-scaglia/KawaiJS) visual novel engine.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @kawaijs/runtime
11
+ ```
12
+
13
+ ## Quick Example
14
+
15
+ ```typescript
16
+ import { compileScript } from '@kawaijs/parser';
17
+ import { StoryVM } from '@kawaijs/runtime';
18
+
19
+ const story = compileScript(`
20
+ label start:
21
+ "Welcome to the story!"
22
+ "Step 2"
23
+ `);
24
+
25
+ const vm = new StoryVM(story);
26
+ vm.onStateChange((state) => {
27
+ console.log('Dialogue:', state.dialogue?.text);
28
+ });
29
+
30
+ vm.start();
31
+ vm.next(); // Advances to Step 2
32
+ vm.rollback(); // Rolls back to Welcome
33
+ ```
34
+
35
+ ## Features
36
+ - **Deterministic Virtual Machine**: Headless execution loop.
37
+ - **Time-Travel Rollback**: Deep state snapshots for backwards navigation.
38
+ - **Save & Load**: Pluggable storage adapters (LocalStorage, Memory).
39
+ - **Dialogue History**: Built-in history logging for spoken lines.
40
+
41
+ ## License
42
+ MIT © Biagio Scaglia
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kawaijs/runtime",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Headless state machine, execution engine, save/load, and rollback system for Kawaijs",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",