@sharpee/plugins 0.9.65-beta → 0.9.66-beta

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/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@sharpee/plugins",
3
- "version": "0.9.65-beta",
3
+ "version": "0.9.66-beta",
4
4
  "description": "Plugin contracts for Sharpee engine turn-cycle extensibility",
5
- "main": "./dist-npm/index.js",
5
+ "main": "./index.js",
6
6
  "module": "dist-npm/index.js",
7
- "types": "./dist-npm/index.d.ts",
7
+ "types": "./index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
- "types": "./dist-npm/index.d.ts",
11
- "require": "./dist-npm/index.js"
10
+ "types": "./index.d.ts",
11
+ "require": "./index.js",
12
+ "default": "./index.js"
12
13
  }
13
14
  },
14
15
  "scripts": {
@@ -16,15 +17,6 @@
16
17
  "clean": "rimraf dist",
17
18
  "build:npm": "tsc --outDir dist-npm"
18
19
  },
19
- "dependencies": {
20
- "@sharpee/core": "workspace:*",
21
- "@sharpee/world-model": "workspace:*"
22
- },
23
- "devDependencies": {
24
- "@types/node": "^20.11.19",
25
- "typescript": "^5.3.3",
26
- "rimraf": "^5.0.5"
27
- },
28
20
  "files": [
29
21
  "dist-npm"
30
22
  ],
@@ -1,4 +0,0 @@
1
- export { TurnPlugin } from './turn-plugin';
2
- export { TurnPluginContext, TurnPluginActionResult } from './turn-plugin-context';
3
- export { PluginRegistry } from './plugin-registry';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
package/dist-npm/index.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PluginRegistry = void 0;
4
- var plugin_registry_1 = require("./plugin-registry");
5
- Object.defineProperty(exports, "PluginRegistry", { enumerable: true, get: function () { return plugin_registry_1.PluginRegistry; } });
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":";;;AAEA,qDAAmD;AAA1C,iHAAA,cAAc,OAAA"}
@@ -1,11 +0,0 @@
1
- import { TurnPlugin } from './turn-plugin';
2
- export declare class PluginRegistry {
3
- private plugins;
4
- register(plugin: TurnPlugin): void;
5
- unregister(id: string): void;
6
- getAll(): TurnPlugin[];
7
- getById(id: string): TurnPlugin | undefined;
8
- getStates(): Record<string, unknown>;
9
- setStates(states: Record<string, unknown>): void;
10
- }
11
- //# sourceMappingURL=plugin-registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin-registry.d.ts","sourceRoot":"","sources":["../../../../src/plugin-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAsC;IAErD,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAOlC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAI5B,MAAM,IAAI,UAAU,EAAE;IAMtB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAI3C,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAUpC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAQjD"}
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PluginRegistry = void 0;
4
- class PluginRegistry {
5
- plugins = new Map();
6
- register(plugin) {
7
- if (this.plugins.has(plugin.id)) {
8
- throw new Error(`Plugin already registered: ${plugin.id}`);
9
- }
10
- this.plugins.set(plugin.id, plugin);
11
- }
12
- unregister(id) {
13
- this.plugins.delete(id);
14
- }
15
- getAll() {
16
- return Array.from(this.plugins.values()).sort((a, b) => b.priority - a.priority);
17
- }
18
- getById(id) {
19
- return this.plugins.get(id);
20
- }
21
- getStates() {
22
- const states = {};
23
- for (const plugin of this.plugins.values()) {
24
- if (plugin.getState) {
25
- states[plugin.id] = plugin.getState();
26
- }
27
- }
28
- return states;
29
- }
30
- setStates(states) {
31
- for (const [id, state] of Object.entries(states)) {
32
- const plugin = this.plugins.get(id);
33
- if (plugin?.setState) {
34
- plugin.setState(state);
35
- }
36
- }
37
- }
38
- }
39
- exports.PluginRegistry = PluginRegistry;
40
- //# sourceMappingURL=plugin-registry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin-registry.js","sourceRoot":"","sources":["../../../../src/plugin-registry.ts"],"names":[],"mappings":";;;AAEA,MAAa,cAAc;IACjB,OAAO,GAA4B,IAAI,GAAG,EAAE,CAAC;IAErD,QAAQ,CAAC,MAAkB;QACzB,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,8BAA8B,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;QAC7D,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC;IAED,UAAU,CAAC,EAAU;QACnB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IAED,MAAM;QACJ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAC3C,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAClC,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,EAAU;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;IAED,SAAS;QACP,MAAM,MAAM,GAA4B,EAAE,CAAC;QAC3C,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YAC3C,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACpB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;YACxC,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,SAAS,CAAC,MAA+B;QACvC,KAAK,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACjD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACpC,IAAI,MAAM,EAAE,QAAQ,EAAE,CAAC;gBACrB,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;IACH,CAAC;CACF;AA1CD,wCA0CC"}
@@ -1,18 +0,0 @@
1
- import { EntityId, SeededRandom, ISemanticEvent } from "../../core/dist-npm/src/index";
2
- import { WorldModel } from "../../world-model/dist-npm/src/index";
3
- export interface TurnPluginActionResult {
4
- actionId: string;
5
- success: boolean;
6
- targetId?: EntityId;
7
- sharedData?: Record<string, unknown>;
8
- }
9
- export interface TurnPluginContext {
10
- world: WorldModel;
11
- turn: number;
12
- playerId: EntityId;
13
- playerLocation: EntityId;
14
- random: SeededRandom;
15
- actionResult?: TurnPluginActionResult;
16
- actionEvents?: ISemanticEvent[];
17
- }
18
- //# sourceMappingURL=turn-plugin-context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"turn-plugin-context.d.ts","sourceRoot":"","sources":["../../../../src/turn-plugin-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,EAAE,QAAQ,CAAC;IACzB,MAAM,EAAE,YAAY,CAAC;IACrB,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,YAAY,CAAC,EAAE,cAAc,EAAE,CAAC;CACjC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=turn-plugin-context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"turn-plugin-context.js","sourceRoot":"","sources":["../../../../src/turn-plugin-context.ts"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
1
- import { ISemanticEvent } from "../../core/dist-npm/src/index";
2
- import { TurnPluginContext } from './turn-plugin-context';
3
- export interface TurnPlugin {
4
- id: string;
5
- priority: number;
6
- onAfterAction(context: TurnPluginContext): ISemanticEvent[];
7
- getState?(): unknown;
8
- setState?(state: unknown): void;
9
- }
10
- //# sourceMappingURL=turn-plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"turn-plugin.d.ts","sourceRoot":"","sources":["../../../../src/turn-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,OAAO,EAAE,iBAAiB,GAAG,cAAc,EAAE,CAAC;IAC5D,QAAQ,CAAC,IAAI,OAAO,CAAC;IACrB,QAAQ,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CACjC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=turn-plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"turn-plugin.js","sourceRoot":"","sources":["../../../../src/turn-plugin.ts"],"names":[],"mappings":""}