@sharpee/plugins 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 +50 -0
  2. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # @sharpee/plugins
2
+
3
+ Plugin contracts for Sharpee engine turn-cycle extensibility.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @sharpee/plugins
9
+ ```
10
+
11
+ ## Overview
12
+
13
+ This package defines the turn-plugin contract the engine uses to extend each turn (ADR-120):
14
+
15
+ - **`TurnPlugin`** - The interface a plugin implements: an `id`, a `priority`, and an `onAfterAction` hook called once after each successful player action.
16
+ - **`TurnPluginContext`** - The read-only per-turn context (world, turn, player, seeded RNG, action result and events) passed to every plugin.
17
+ - **`TurnPluginActionResult`** - Summary of the player action that just completed.
18
+ - **`PluginRegistry`** - Holds a game's plugins, hands them to the engine in descending priority order, and aggregates plugin save/restore state.
19
+
20
+ The engine owns a single `PluginRegistry`. Stories add behaviour by registering the implementing packages — NPC (priority 100), state machine (75), scheduler (50) — rather than implementing `TurnPlugin` directly.
21
+
22
+ ## Usage
23
+
24
+ This package is contracts-only. The engine consumes `TurnPlugin`/`PluginRegistry`; the plugin packages implement them. A minimal plugin looks like:
25
+
26
+ ```typescript
27
+ import { TurnPlugin, TurnPluginContext } from '@sharpee/plugins';
28
+ import { ISemanticEvent } from '@sharpee/core';
29
+
30
+ class HeartbeatPlugin implements TurnPlugin {
31
+ id = 'example.heartbeat';
32
+ priority = 10;
33
+
34
+ onAfterAction(ctx: TurnPluginContext): ISemanticEvent[] {
35
+ // Contribute additional events on turn `ctx.turn`; return [] for nothing.
36
+ return [];
37
+ }
38
+ }
39
+ ```
40
+
41
+ ## Related Packages
42
+
43
+ - [@sharpee/plugin-npc](https://www.npmjs.com/package/@sharpee/plugin-npc) - NPC behaviours and turn processing
44
+ - [@sharpee/plugin-scheduler](https://www.npmjs.com/package/@sharpee/plugin-scheduler) - Daemons and fuses
45
+ - [@sharpee/plugin-state-machine](https://www.npmjs.com/package/@sharpee/plugin-state-machine) - Declarative puzzle/narrative orchestration
46
+ - [@sharpee/sharpee](https://www.npmjs.com/package/@sharpee/sharpee) - Full platform bundle
47
+
48
+ ## License
49
+
50
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sharpee/plugins",
3
- "version": "1.0.8",
3
+ "version": "1.1.0",
4
4
  "description": "Plugin contracts for Sharpee engine turn-cycle extensibility",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -12,8 +12,8 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "@sharpee/core": "^1.0.8",
16
- "@sharpee/world-model": "^1.0.8"
15
+ "@sharpee/core": "^1.1.0",
16
+ "@sharpee/world-model": "^1.1.0"
17
17
  },
18
18
  "keywords": [
19
19
  "interactive-fiction",