@sharpee/plugin-scheduler 1.0.8 → 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.
Files changed (2) hide show
  1. package/README.md +55 -0
  2. package/package.json +4 -4
package/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # @sharpee/plugin-scheduler
2
+
3
+ Scheduler plugin for the Sharpee engine: background temporal events via daemons and fuses (ADR-071, ADR-120).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @sharpee/plugin-scheduler
9
+ ```
10
+
11
+ ## Overview
12
+
13
+ This package implements the `TurnPlugin` contract from `@sharpee/plugins` for scheduled, time-based events:
14
+
15
+ - **`SchedulerPlugin`** - Runs at priority 50, after NPCs (100) and state machines (75), so temporal events resolve at the end of the turn (ADR-071, ADR-120).
16
+ - **Daemons** - Processes that run every turn (optionally conditional, prioritized, or `runOnce`).
17
+ - **Fuses** - Countdown timers that trigger after N turns; support `repeat`, pause/resume, adjustment, and entity-bound cleanup.
18
+ - **`SchedulerService` / `createSchedulerService`** - The registration API behind the plugin, reachable via `getScheduler()`.
19
+ - **Deterministic RNG** - A seeded random source so scheduled events stay replayable; scheduler state is serialized for save/load.
20
+
21
+ ## Usage
22
+
23
+ ```typescript
24
+ import { SchedulerPlugin } from '@sharpee/plugin-scheduler';
25
+
26
+ const schedulerPlugin = new SchedulerPlugin(/* seed */ 12345);
27
+ engine.plugins.register(schedulerPlugin);
28
+
29
+ const scheduler = schedulerPlugin.getScheduler();
30
+
31
+ // A daemon that runs every turn
32
+ scheduler.registerDaemon({
33
+ id: 'wind',
34
+ name: 'howling wind',
35
+ run: (ctx) => [/* ...semantic events... */]
36
+ });
37
+
38
+ // A fuse that triggers in 3 turns
39
+ scheduler.setFuse({
40
+ id: 'bomb',
41
+ name: 'ticking bomb',
42
+ turns: 3,
43
+ trigger: (ctx) => [/* ...semantic events... */]
44
+ });
45
+ ```
46
+
47
+ ## Related Packages
48
+
49
+ - [@sharpee/plugins](https://www.npmjs.com/package/@sharpee/plugins) - Turn-plugin contracts
50
+ - [@sharpee/world-model](https://www.npmjs.com/package/@sharpee/world-model) - Entity system the scheduler mutates
51
+ - [@sharpee/sharpee](https://www.npmjs.com/package/@sharpee/sharpee) - Full platform bundle
52
+
53
+ ## License
54
+
55
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sharpee/plugin-scheduler",
3
- "version": "1.0.8",
3
+ "version": "1.1.0",
4
4
  "description": "Scheduler plugin for Sharpee engine - daemons and fuses (ADR-071, ADR-120)",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -12,9 +12,9 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "@sharpee/core": "^1.0.8",
16
- "@sharpee/world-model": "^1.0.8",
17
- "@sharpee/plugins": "^1.0.8"
15
+ "@sharpee/core": "^1.1.0",
16
+ "@sharpee/world-model": "^1.1.0",
17
+ "@sharpee/plugins": "^1.1.0"
18
18
  },
19
19
  "keywords": [
20
20
  "interactive-fiction",