@sadhaka/loom-engine 0.13.0 → 0.14.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/dist/director/ai/ai-plugin-registry.d.ts +20 -0
- package/dist/director/ai/ai-plugin-registry.d.ts.map +1 -0
- package/dist/director/ai/ai-plugin-registry.js +232 -0
- package/dist/director/ai/ai-plugin-registry.js.map +1 -0
- package/dist/director/ai/mock-ai-plugin.d.ts +24 -0
- package/dist/director/ai/mock-ai-plugin.d.ts.map +1 -0
- package/dist/director/ai/mock-ai-plugin.js +83 -0
- package/dist/director/ai/mock-ai-plugin.js.map +1 -0
- package/dist/director/ai/plugin-context.d.ts +27 -0
- package/dist/director/ai/plugin-context.d.ts.map +1 -0
- package/dist/director/ai/plugin-context.js +152 -0
- package/dist/director/ai/plugin-context.js.map +1 -0
- package/dist/director/ai/plugin.d.ts +57 -0
- package/dist/director/ai/plugin.d.ts.map +1 -0
- package/dist/director/ai/plugin.js +32 -0
- package/dist/director/ai/plugin.js.map +1 -0
- package/dist/director/index.d.ts +27 -0
- package/dist/director/index.d.ts.map +1 -0
- package/dist/director/index.js +26 -0
- package/dist/director/index.js.map +1 -0
- package/dist/director/zone/mock-zone-bridge.d.ts +22 -0
- package/dist/director/zone/mock-zone-bridge.d.ts.map +1 -0
- package/dist/director/zone/mock-zone-bridge.js +107 -0
- package/dist/director/zone/mock-zone-bridge.js.map +1 -0
- package/dist/director/zone/sse-zone-bridge.d.ts +40 -0
- package/dist/director/zone/sse-zone-bridge.d.ts.map +1 -0
- package/dist/director/zone/sse-zone-bridge.js +164 -0
- package/dist/director/zone/sse-zone-bridge.js.map +1 -0
- package/dist/director/zone/zone-event-bridge.d.ts +21 -0
- package/dist/director/zone/zone-event-bridge.d.ts.map +1 -0
- package/dist/director/zone/zone-event-bridge.js +24 -0
- package/dist/director/zone/zone-event-bridge.js.map +1 -0
- package/dist/director/zone/zone-event-envelope.d.ts +90 -0
- package/dist/director/zone/zone-event-envelope.d.ts.map +1 -0
- package/dist/director/zone/zone-event-envelope.js +104 -0
- package/dist/director/zone/zone-event-envelope.js.map +1 -0
- package/dist/director/zone/zone-event-log.d.ts +17 -0
- package/dist/director/zone/zone-event-log.d.ts.map +1 -0
- package/dist/director/zone/zone-event-log.js +46 -0
- package/dist/director/zone/zone-event-log.js.map +1 -0
- package/dist/director/zone/zone-event-system.d.ts +14 -0
- package/dist/director/zone/zone-event-system.d.ts.map +1 -0
- package/dist/director/zone/zone-event-system.js +179 -0
- package/dist/director/zone/zone-event-system.js.map +1 -0
- package/dist/director/zone/zone-state-resource.d.ts +15 -0
- package/dist/director/zone/zone-state-resource.d.ts.map +1 -0
- package/dist/director/zone/zone-state-resource.js +60 -0
- package/dist/director/zone/zone-state-resource.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +33 -0
- package/dist/server/index.js.map +1 -0
- package/package.json +6 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { IAIPlugin, EmittedEvents, PluginContext, PeerInfo, PlayerAction } from './plugin.js';
|
|
2
|
+
export declare class AIPluginDuplicateError extends Error {
|
|
3
|
+
readonly pluginName: string;
|
|
4
|
+
constructor(pluginName: string);
|
|
5
|
+
}
|
|
6
|
+
export declare class AIPluginRegistry {
|
|
7
|
+
private plugins;
|
|
8
|
+
register(plugin: IAIPlugin): void;
|
|
9
|
+
unregister(name: string): Promise<boolean>;
|
|
10
|
+
list(): ReadonlyArray<IAIPlugin>;
|
|
11
|
+
get(name: string): IAIPlugin | undefined;
|
|
12
|
+
dispatchTick(ctx: PluginContext): Promise<EmittedEvents>;
|
|
13
|
+
dispatchPeerJoin(ctx: PluginContext, peer: PeerInfo): Promise<EmittedEvents>;
|
|
14
|
+
dispatchPeerLeave(ctx: PluginContext, peer: PeerInfo): Promise<EmittedEvents>;
|
|
15
|
+
dispatchZoneEnter(ctx: PluginContext, peer: PeerInfo, fromZone: string | null): Promise<EmittedEvents>;
|
|
16
|
+
dispatchPlayerAction(ctx: PluginContext, peer: PeerInfo, action: PlayerAction): Promise<EmittedEvents>;
|
|
17
|
+
private dispatch;
|
|
18
|
+
private errorMeta;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=ai-plugin-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-plugin-registry.d.ts","sourceRoot":"","sources":["../../../src/director/ai/ai-plugin-registry.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,aAAa,EACb,QAAQ,EACR,YAAY,EACb,MAAM,aAAa,CAAC;AAErB,qBAAa,sBAAuB,SAAQ,KAAK;aACnB,UAAU,EAAE,MAAM;gBAAlB,UAAU,EAAE,MAAM;CAI/C;AAED,qBAAa,gBAAgB;IAK3B,OAAO,CAAC,OAAO,CAAmB;IAOlC,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IA0B3B,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA8BhD,IAAI,IAAI,aAAa,CAAC,SAAS,CAAC;IAMhC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAgBlC,YAAY,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAMxD,gBAAgB,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC;IAM5E,iBAAiB,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC;IAM7E,iBAAiB,CACrB,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,MAAM,GAAG,IAAI,GACtB,OAAO,CAAC,aAAa,CAAC;IAMnB,oBAAoB,CACxB,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,aAAa,CAAC;YAYX,QAAQ;IAiEtB,OAAO,CAAC,SAAS;CAgBlB"}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
// AIPluginRegistry - dispatches lifecycle hooks across registered plugins.
|
|
2
|
+
//
|
|
3
|
+
// Per LOOM-DIRECTOR-PROTOCOL-V2 Section 5.3: the registry holds N
|
|
4
|
+
// plugins, dispatches each hook in priority order (lower runs first),
|
|
5
|
+
// and concatenates the EmittedEvents from every plugin into a single
|
|
6
|
+
// merged result. The caller (the engine's emit path / TWT's loom_director
|
|
7
|
+
// orchestrator) takes the merged events and routes them - character
|
|
8
|
+
// events to the v1 stream, zone events to the v2 zone log + presence
|
|
9
|
+
// fanout.
|
|
10
|
+
//
|
|
11
|
+
// Error isolation guarantee (open question 8.3): if a plugin's hook
|
|
12
|
+
// throws synchronously OR the returned Promise rejects, the registry
|
|
13
|
+
// logs the failure via that plugin's logger, drops that plugin's
|
|
14
|
+
// contribution for THIS dispatch only, and continues with the next
|
|
15
|
+
// plugin. The dispatch never throws to the caller. Plugin authors
|
|
16
|
+
// remain responsible for their own internal try/catch; the registry
|
|
17
|
+
// is the safety net of last resort.
|
|
18
|
+
//
|
|
19
|
+
// Implementation notes:
|
|
20
|
+
// - Plugins are kept in a sorted array; register/unregister keep
|
|
21
|
+
// it sorted so the dispatch hot path is a simple iteration.
|
|
22
|
+
// - The registry never instantiates a PluginContext; the caller
|
|
23
|
+
// supplies one per dispatch (or reuses one and refreshes views).
|
|
24
|
+
// This keeps the registry decoupled from world-state plumbing.
|
|
25
|
+
// - dispose() is awaited inside unregister() so plugins can flush
|
|
26
|
+
// pending work; if dispose throws we log and continue (drop
|
|
27
|
+
// guarantee extends to dispose so the caller never sees plugin
|
|
28
|
+
// errors leak).
|
|
29
|
+
export class AIPluginDuplicateError extends Error {
|
|
30
|
+
pluginName;
|
|
31
|
+
constructor(pluginName) {
|
|
32
|
+
super('AIPluginDuplicateError: plugin already registered: ' + pluginName);
|
|
33
|
+
this.pluginName = pluginName;
|
|
34
|
+
this.name = 'AIPluginDuplicateError';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class AIPluginRegistry {
|
|
38
|
+
// Sorted by priority ascending, then by registration order. The
|
|
39
|
+
// registration index is encoded by inserting at the right position
|
|
40
|
+
// on register() rather than re-sorting, which preserves stable
|
|
41
|
+
// ordering for equal priorities.
|
|
42
|
+
plugins = [];
|
|
43
|
+
// ----- Lifecycle -----
|
|
44
|
+
// Register a plugin. Throws AIPluginDuplicateError if a plugin with
|
|
45
|
+
// the same name is already registered (names are the registry key).
|
|
46
|
+
// Insertion is O(n) but n is small (typically 1-10 plugins).
|
|
47
|
+
register(plugin) {
|
|
48
|
+
for (var i = 0; i < this.plugins.length; i++) {
|
|
49
|
+
var existing = this.plugins[i];
|
|
50
|
+
if (existing && existing.name === plugin.name) {
|
|
51
|
+
throw new AIPluginDuplicateError(plugin.name);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// Find the first plugin with strictly higher priority and insert
|
|
55
|
+
// before it. This preserves stable ordering for equal priorities
|
|
56
|
+
// (a later-registered plugin runs after an earlier one with the
|
|
57
|
+
// same priority).
|
|
58
|
+
var insertAt = this.plugins.length;
|
|
59
|
+
for (var j = 0; j < this.plugins.length; j++) {
|
|
60
|
+
var p = this.plugins[j];
|
|
61
|
+
if (p && p.priority > plugin.priority) {
|
|
62
|
+
insertAt = j;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
this.plugins.splice(insertAt, 0, plugin);
|
|
67
|
+
}
|
|
68
|
+
// Unregister a plugin by name. Awaits the plugin's dispose() if
|
|
69
|
+
// present; logs and drops if dispose throws. Returns true if a
|
|
70
|
+
// plugin was removed, false if no plugin with that name was
|
|
71
|
+
// registered.
|
|
72
|
+
async unregister(name) {
|
|
73
|
+
var idx = -1;
|
|
74
|
+
for (var i = 0; i < this.plugins.length; i++) {
|
|
75
|
+
var p = this.plugins[i];
|
|
76
|
+
if (p && p.name === name) {
|
|
77
|
+
idx = i;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (idx === -1)
|
|
82
|
+
return false;
|
|
83
|
+
var plugin = this.plugins[idx];
|
|
84
|
+
this.plugins.splice(idx, 1);
|
|
85
|
+
if (plugin && typeof plugin.dispose === 'function') {
|
|
86
|
+
try {
|
|
87
|
+
await plugin.dispose();
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
// Drop guarantee extends to dispose. We can't log via the
|
|
91
|
+
// plugin's logger because we have no PluginContext here;
|
|
92
|
+
// fall back to console with the plugin name tag.
|
|
93
|
+
console.error('[plugin: ' + plugin.name + '] dispose() threw', this.errorMeta(err));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
// Read-only snapshot of the plugin list, in dispatch order. Returns
|
|
99
|
+
// a fresh array; mutating it does not affect the registry.
|
|
100
|
+
list() {
|
|
101
|
+
return this.plugins.slice();
|
|
102
|
+
}
|
|
103
|
+
// Look up a plugin by name. Returns undefined if no plugin with
|
|
104
|
+
// that name is registered.
|
|
105
|
+
get(name) {
|
|
106
|
+
for (var i = 0; i < this.plugins.length; i++) {
|
|
107
|
+
var p = this.plugins[i];
|
|
108
|
+
if (p && p.name === name)
|
|
109
|
+
return p;
|
|
110
|
+
}
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
// ----- Dispatchers -----
|
|
114
|
+
// All five dispatchers share the same shape: iterate plugins in
|
|
115
|
+
// priority order, call the hook if defined, await the result, merge
|
|
116
|
+
// into the running EmittedEvents. Errors are caught per-plugin and
|
|
117
|
+
// logged via the plugin's logger if reachable through ctx; never
|
|
118
|
+
// thrown to the caller.
|
|
119
|
+
async dispatchTick(ctx) {
|
|
120
|
+
return this.dispatch(ctx, 'onTick', function (plugin, ctx) {
|
|
121
|
+
return plugin.onTick(ctx);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
async dispatchPeerJoin(ctx, peer) {
|
|
125
|
+
return this.dispatch(ctx, 'onPeerJoin', function (plugin, ctx) {
|
|
126
|
+
return plugin.onPeerJoin(ctx, peer);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
async dispatchPeerLeave(ctx, peer) {
|
|
130
|
+
return this.dispatch(ctx, 'onPeerLeave', function (plugin, ctx) {
|
|
131
|
+
return plugin.onPeerLeave(ctx, peer);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
async dispatchZoneEnter(ctx, peer, fromZone) {
|
|
135
|
+
return this.dispatch(ctx, 'onZoneEnter', function (plugin, ctx) {
|
|
136
|
+
return plugin.onZoneEnter(ctx, peer, fromZone);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
async dispatchPlayerAction(ctx, peer, action) {
|
|
140
|
+
return this.dispatch(ctx, 'onPlayerAction', function (plugin, ctx) {
|
|
141
|
+
return plugin.onPlayerAction(ctx, peer, action);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
// ----- Internals -----
|
|
145
|
+
// Generic dispatch helper. `hookName` is the property name we check
|
|
146
|
+
// for definition on each plugin; `invoke` calls the actual hook
|
|
147
|
+
// (the spread of args differs per dispatcher). Per-plugin try/catch
|
|
148
|
+
// around the await isolates failures.
|
|
149
|
+
async dispatch(ctx, hookName, invoke) {
|
|
150
|
+
var merged = {};
|
|
151
|
+
var characterEvents = undefined;
|
|
152
|
+
var zoneEvents = undefined;
|
|
153
|
+
// Snapshot the plugin list at dispatch start so a mutation during
|
|
154
|
+
// the dispatch (a hook calls registry.register/unregister) cannot
|
|
155
|
+
// change which plugins run for THIS dispatch. Spec doesn't forbid
|
|
156
|
+
// mutation but the predictable behavior is "this dispatch sees
|
|
157
|
+
// the registry as it was at start".
|
|
158
|
+
var snapshot = this.plugins.slice();
|
|
159
|
+
for (var i = 0; i < snapshot.length; i++) {
|
|
160
|
+
var plugin = snapshot[i];
|
|
161
|
+
if (!plugin)
|
|
162
|
+
continue;
|
|
163
|
+
// Hook not implemented by this plugin? Skip without allocating
|
|
164
|
+
// anything. Use bracket access so the keyof typing carries through.
|
|
165
|
+
var hook = plugin[hookName];
|
|
166
|
+
if (typeof hook !== 'function')
|
|
167
|
+
continue;
|
|
168
|
+
var emitted;
|
|
169
|
+
try {
|
|
170
|
+
emitted = await invoke(plugin, ctx);
|
|
171
|
+
}
|
|
172
|
+
catch (err) {
|
|
173
|
+
// Log via the plugin's logger so the failure is tagged with
|
|
174
|
+
// the plugin name. ctx.logger may itself throw; if so, fall
|
|
175
|
+
// back to console (cannot let logger errors break dispatch).
|
|
176
|
+
try {
|
|
177
|
+
ctx.logger.error('plugin hook ' + String(hookName) + ' threw', this.errorMeta(err));
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
console.error('[plugin: ' + plugin.name + '] hook ' + String(hookName) + ' threw', this.errorMeta(err));
|
|
181
|
+
}
|
|
182
|
+
// Drop this plugin's contribution for this dispatch.
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
if (!emitted)
|
|
186
|
+
continue;
|
|
187
|
+
if (emitted.characterEvents && emitted.characterEvents.length > 0) {
|
|
188
|
+
if (!characterEvents)
|
|
189
|
+
characterEvents = [];
|
|
190
|
+
for (var ci = 0; ci < emitted.characterEvents.length; ci++) {
|
|
191
|
+
var ce = emitted.characterEvents[ci];
|
|
192
|
+
if (ce)
|
|
193
|
+
characterEvents.push(ce);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (emitted.zoneEvents && emitted.zoneEvents.length > 0) {
|
|
197
|
+
if (!zoneEvents)
|
|
198
|
+
zoneEvents = [];
|
|
199
|
+
for (var zi = 0; zi < emitted.zoneEvents.length; zi++) {
|
|
200
|
+
var ze = emitted.zoneEvents[zi];
|
|
201
|
+
if (ze)
|
|
202
|
+
zoneEvents.push(ze);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if (characterEvents)
|
|
207
|
+
merged.characterEvents = characterEvents;
|
|
208
|
+
if (zoneEvents)
|
|
209
|
+
merged.zoneEvents = zoneEvents;
|
|
210
|
+
return merged;
|
|
211
|
+
}
|
|
212
|
+
// Pull useful fields out of an unknown error for log meta. Avoids
|
|
213
|
+
// throwing on non-Error throws (strings, objects, undefined).
|
|
214
|
+
errorMeta(err) {
|
|
215
|
+
if (err instanceof Error) {
|
|
216
|
+
return {
|
|
217
|
+
error_name: err.name,
|
|
218
|
+
error_message: err.message,
|
|
219
|
+
error_stack: err.stack ?? null,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
var safe;
|
|
223
|
+
try {
|
|
224
|
+
safe = JSON.stringify(err);
|
|
225
|
+
}
|
|
226
|
+
catch {
|
|
227
|
+
safe = String(err);
|
|
228
|
+
}
|
|
229
|
+
return { error: safe };
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=ai-plugin-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-plugin-registry.js","sourceRoot":"","sources":["../../../src/director/ai/ai-plugin-registry.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,EAAE;AACF,kEAAkE;AAClE,sEAAsE;AACtE,qEAAqE;AACrE,0EAA0E;AAC1E,oEAAoE;AACpE,qEAAqE;AACrE,UAAU;AACV,EAAE;AACF,oEAAoE;AACpE,qEAAqE;AACrE,iEAAiE;AACjE,mEAAmE;AACnE,kEAAkE;AAClE,oEAAoE;AACpE,oCAAoC;AACpC,EAAE;AACF,wBAAwB;AACxB,mEAAmE;AACnE,gEAAgE;AAChE,kEAAkE;AAClE,qEAAqE;AACrE,mEAAmE;AACnE,oEAAoE;AACpE,gEAAgE;AAChE,mEAAmE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GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC;oBACtD,IAAI,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;oBAChC,IAAI,EAAE;wBAAE,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAC9B,CAAC;YACH,CAAC;QACH,CAAC;QACD,IAAI,eAAe;YAAE,MAAM,CAAC,eAAe,GAAG,eAAe,CAAC;QAC9D,IAAI,UAAU;YAAE,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC;QAC/C,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,kEAAkE;IAClE,8DAA8D;IACtD,SAAS,CAAC,GAAY;QAC5B,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;YACzB,OAAO;gBACL,UAAU,EAAE,GAAG,CAAC,IAAI;gBACpB,aAAa,EAAE,GAAG,CAAC,OAAO;gBAC1B,WAAW,EAAE,GAAG,CAAC,KAAK,IAAI,IAAI;aAC/B,CAAC;QACJ,CAAC;QACD,IAAI,IAAY,CAAC;QACjB,IAAI,CAAC;YACH,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;QAAC,MAAM,CAAC;YACP,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DirectorEvent } from '../event-envelope.js';
|
|
2
|
+
import type { IAIPlugin, EmittedEvents, PluginContext, ZoneEvent } from './plugin.js';
|
|
3
|
+
export interface MockAIPluginScriptEntry {
|
|
4
|
+
atTick: number;
|
|
5
|
+
characterEvents?: DirectorEvent[];
|
|
6
|
+
zoneEvents?: ZoneEvent[];
|
|
7
|
+
}
|
|
8
|
+
export interface MockAIPluginOptions {
|
|
9
|
+
name?: string;
|
|
10
|
+
script: ReadonlyArray<MockAIPluginScriptEntry>;
|
|
11
|
+
priority?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class MockAIPlugin implements IAIPlugin {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly version = "0.0.1";
|
|
16
|
+
readonly priority: number;
|
|
17
|
+
private readonly script;
|
|
18
|
+
private tick;
|
|
19
|
+
constructor(opts: MockAIPluginOptions);
|
|
20
|
+
onTick(_ctx: PluginContext): Promise<EmittedEvents>;
|
|
21
|
+
currentTick(): number;
|
|
22
|
+
resetTick(): void;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=mock-ai-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-ai-plugin.d.ts","sourceRoot":"","sources":["../../../src/director/ai/mock-ai-plugin.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,aAAa,EACb,SAAS,EACV,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,uBAAuB;IAGtC,MAAM,EAAE,MAAM,CAAC;IAEf,eAAe,CAAC,EAAE,aAAa,EAAE,CAAC;IAElC,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAIlC,IAAI,CAAC,EAAE,MAAM,CAAC;IAId,MAAM,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;IAE/C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,YAAa,YAAW,SAAS;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyC;IAIhE,OAAO,CAAC,IAAI,CAAK;gBAEL,IAAI,EAAE,mBAAmB;IAM/B,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IA+BzD,WAAW,IAAI,MAAM;IAOrB,SAAS,IAAI,IAAI;CAGlB"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// MockAIPlugin - deterministic synthetic events for tests + offline demo.
|
|
2
|
+
//
|
|
3
|
+
// Per LOOM-DIRECTOR-PROTOCOL-V2 Section 5.4: replaces real LLM
|
|
4
|
+
// dispatch with a scripted sequence of events keyed by tick number.
|
|
5
|
+
// Engine tests can wire this in place of an Anthropic-backed plugin
|
|
6
|
+
// to verify registry behavior, dispatch order, and downstream emit
|
|
7
|
+
// paths without burning API budget. The offline demo can use it to
|
|
8
|
+
// drive a showcase loop with predictable events.
|
|
9
|
+
//
|
|
10
|
+
// Determinism: the script is consulted on each onTick() call. The
|
|
11
|
+
// plugin keeps an internal tick counter that increments every call;
|
|
12
|
+
// the constructor's `tickKey` option lets the caller provide a
|
|
13
|
+
// counter source instead (e.g. tying it to the engine's frame index
|
|
14
|
+
// for cross-process consistency).
|
|
15
|
+
//
|
|
16
|
+
// Multiple instances: the constructor accepts an optional `name`
|
|
17
|
+
// override so a test can register two MockAIPlugins with different
|
|
18
|
+
// scripts. Without override, the name is 'mock' and registering two
|
|
19
|
+
// instances throws AIPluginDuplicateError (intentional - the spec
|
|
20
|
+
// keys plugins by name).
|
|
21
|
+
export class MockAIPlugin {
|
|
22
|
+
name;
|
|
23
|
+
version = '0.0.1';
|
|
24
|
+
priority;
|
|
25
|
+
script;
|
|
26
|
+
// Current tick count; increments every onTick() call. The first
|
|
27
|
+
// tick observed is 1 (matches the typical engine convention where
|
|
28
|
+
// tick 0 is "before-first-update").
|
|
29
|
+
tick = 0;
|
|
30
|
+
constructor(opts) {
|
|
31
|
+
this.name = opts.name ?? 'mock';
|
|
32
|
+
this.priority = opts.priority ?? 999;
|
|
33
|
+
this.script = opts.script;
|
|
34
|
+
}
|
|
35
|
+
async onTick(_ctx) {
|
|
36
|
+
this.tick++;
|
|
37
|
+
var characterEvents;
|
|
38
|
+
var zoneEvents;
|
|
39
|
+
for (var i = 0; i < this.script.length; i++) {
|
|
40
|
+
var entry = this.script[i];
|
|
41
|
+
if (!entry)
|
|
42
|
+
continue;
|
|
43
|
+
if (entry.atTick !== this.tick)
|
|
44
|
+
continue;
|
|
45
|
+
if (entry.characterEvents && entry.characterEvents.length > 0) {
|
|
46
|
+
if (!characterEvents)
|
|
47
|
+
characterEvents = [];
|
|
48
|
+
for (var ci = 0; ci < entry.characterEvents.length; ci++) {
|
|
49
|
+
var ce = entry.characterEvents[ci];
|
|
50
|
+
if (ce)
|
|
51
|
+
characterEvents.push(ce);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (entry.zoneEvents && entry.zoneEvents.length > 0) {
|
|
55
|
+
if (!zoneEvents)
|
|
56
|
+
zoneEvents = [];
|
|
57
|
+
for (var zi = 0; zi < entry.zoneEvents.length; zi++) {
|
|
58
|
+
var ze = entry.zoneEvents[zi];
|
|
59
|
+
if (ze)
|
|
60
|
+
zoneEvents.push(ze);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
var emitted = {};
|
|
65
|
+
if (characterEvents)
|
|
66
|
+
emitted.characterEvents = characterEvents;
|
|
67
|
+
if (zoneEvents)
|
|
68
|
+
emitted.zoneEvents = zoneEvents;
|
|
69
|
+
return emitted;
|
|
70
|
+
}
|
|
71
|
+
// Inspect-only: current tick count. Useful in tests to assert the
|
|
72
|
+
// plugin saw the expected number of dispatches.
|
|
73
|
+
currentTick() {
|
|
74
|
+
return this.tick;
|
|
75
|
+
}
|
|
76
|
+
// Reset the tick counter to 0 so the script can replay from the
|
|
77
|
+
// start. Tests that re-use a single plugin across multiple cases
|
|
78
|
+
// call this between cases.
|
|
79
|
+
resetTick() {
|
|
80
|
+
this.tick = 0;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=mock-ai-pl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IAChB,CAAC;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { PluginContext, PluginLogger, PluginStorage, PeerInfo, CharacterState } from './plugin.js';
|
|
2
|
+
export declare class MapPluginStorage {
|
|
3
|
+
private readonly store;
|
|
4
|
+
forPlugin(pluginName: string): PluginStorage;
|
|
5
|
+
clearPlugin(pluginName: string): void;
|
|
6
|
+
size(): number;
|
|
7
|
+
private composeKey;
|
|
8
|
+
}
|
|
9
|
+
export declare class ConsolePluginLogger implements PluginLogger {
|
|
10
|
+
private readonly pluginName;
|
|
11
|
+
constructor(pluginName: string);
|
|
12
|
+
info(msg: string, meta?: Record<string, unknown>): void;
|
|
13
|
+
warn(msg: string, meta?: Record<string, unknown>): void;
|
|
14
|
+
error(msg: string, meta?: Record<string, unknown>): void;
|
|
15
|
+
private write;
|
|
16
|
+
}
|
|
17
|
+
export interface BuildPluginContextOptions {
|
|
18
|
+
pluginName: string;
|
|
19
|
+
storage: MapPluginStorage;
|
|
20
|
+
logger?: PluginLogger;
|
|
21
|
+
getZonePeers?: (zoneId: string) => ReadonlyArray<PeerInfo>;
|
|
22
|
+
getCharacterState?: (characterId: string) => Readonly<CharacterState>;
|
|
23
|
+
getZoneState?: (zoneId: string) => ReadonlyMap<string, unknown>;
|
|
24
|
+
now?: () => number;
|
|
25
|
+
}
|
|
26
|
+
export declare function buildPluginContext(opts: BuildPluginContextOptions): PluginContext;
|
|
27
|
+
//# sourceMappingURL=plugin-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-context.d.ts","sourceRoot":"","sources":["../../../src/director/ai/plugin-context.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,cAAc,EACf,MAAM,aAAa,CAAC;AAQrB,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA8B;IAKpD,SAAS,CAAC,UAAU,EAA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
// per (pluginName, key). Survives across ticks;
|
|
5
|
+
// cleared when the registry calls clearPlugin().
|
|
6
|
+
// ConsolePluginLogger - tags every line with the plugin name and
|
|
7
|
+
// writes to console.{info,warn,error}. Suitable
|
|
8
|
+
// for tests + dev; production consumers can
|
|
9
|
+
// drop in a structured-log impl.
|
|
10
|
+
//
|
|
11
|
+
// These are reference implementations. Consumers wiring against
|
|
12
|
+
// `@sadhaka/loom-engine/server` may substitute their own
|
|
13
|
+
// PluginStorage / PluginLogger impls (e.g. Redis-backed storage,
|
|
14
|
+
// pino-backed logger) without changing the SPI surface.
|
|
15
|
+
//
|
|
16
|
+
// The registry does not assume MapPluginStorage; the SPI is
|
|
17
|
+
// the only contract. These exist so a consumer can stand a plugin
|
|
18
|
+
// up in five lines without writing a storage adapter first.
|
|
19
|
+
// ----- MapPluginStorage -----
|
|
20
|
+
//
|
|
21
|
+
// In-memory storage shared across all plugins; per-plugin namespace
|
|
22
|
+
// is enforced by composing the storage key as `${pluginName}::${key}`.
|
|
23
|
+
// `clearPlugin(name)` wipes every entry tagged with that plugin so
|
|
24
|
+
// unregister + re-register starts clean.
|
|
25
|
+
export class MapPluginStorage {
|
|
26
|
+
store = new Map();
|
|
27
|
+
// Build a per-plugin facade that satisfies the PluginStorage
|
|
28
|
+
// interface; the facade scopes get/set/delete to the plugin's
|
|
29
|
+
// namespace so plugin authors never see the composite key.
|
|
30
|
+
forPlugin(pluginName) {
|
|
31
|
+
var self = this;
|
|
32
|
+
return {
|
|
33
|
+
async get(key) {
|
|
34
|
+
return self.store.get(self.composeKey(pluginName, key));
|
|
35
|
+
},
|
|
36
|
+
async set(key, value) {
|
|
37
|
+
self.store.set(self.composeKey(pluginName, key), value);
|
|
38
|
+
},
|
|
39
|
+
async delete(key) {
|
|
40
|
+
self.store.delete(self.composeKey(pluginName, key));
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
// Wipe all entries belonging to a plugin. Called by the registry
|
|
45
|
+
// on unregister(). Iterates once; cost is O(total entries) but
|
|
46
|
+
// unregister is rare.
|
|
47
|
+
clearPlugin(pluginName) {
|
|
48
|
+
var prefix = pluginName + '::';
|
|
49
|
+
var keysToDelete = [];
|
|
50
|
+
var iter = this.store.keys();
|
|
51
|
+
var next = iter.next();
|
|
52
|
+
while (!next.done) {
|
|
53
|
+
var k = next.value;
|
|
54
|
+
if (k.startsWith(prefix)) {
|
|
55
|
+
keysToDelete.push(k);
|
|
56
|
+
}
|
|
57
|
+
next = iter.next();
|
|
58
|
+
}
|
|
59
|
+
for (var i = 0; i < keysToDelete.length; i++) {
|
|
60
|
+
var key = keysToDelete[i];
|
|
61
|
+
if (key !== undefined) {
|
|
62
|
+
this.store.delete(key);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Inspect-only: total number of entries across all plugins. Useful
|
|
67
|
+
// in tests when asserting clearPlugin shrinks the store.
|
|
68
|
+
size() {
|
|
69
|
+
return this.store.size;
|
|
70
|
+
}
|
|
71
|
+
composeKey(pluginName, key) {
|
|
72
|
+
return pluginName + '::' + key;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// ----- ConsolePluginLogger -----
|
|
76
|
+
//
|
|
77
|
+
// Tags every line with `[plugin: <name>]` and forwards to the
|
|
78
|
+
// matching console method. Meta is JSON-stringified and appended;
|
|
79
|
+
// circular refs fall back to a short description so logging never
|
|
80
|
+
// throws at the boundary.
|
|
81
|
+
export class ConsolePluginLogger {
|
|
82
|
+
pluginName;
|
|
83
|
+
constructor(pluginName) {
|
|
84
|
+
this.pluginName = pluginName;
|
|
85
|
+
}
|
|
86
|
+
info(msg, meta) {
|
|
87
|
+
this.write('info', msg, meta);
|
|
88
|
+
}
|
|
89
|
+
warn(msg, meta) {
|
|
90
|
+
this.write('warn', msg, meta);
|
|
91
|
+
}
|
|
92
|
+
error(msg, meta) {
|
|
93
|
+
this.write('error', msg, meta);
|
|
94
|
+
}
|
|
95
|
+
write(level, msg, meta) {
|
|
96
|
+
var tag = '[plugin: ' + this.pluginName + ']';
|
|
97
|
+
var line = tag + ' ' + msg;
|
|
98
|
+
var metaStr = '';
|
|
99
|
+
if (meta) {
|
|
100
|
+
try {
|
|
101
|
+
metaStr = ' ' + JSON.stringify(meta);
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
metaStr = ' [meta-not-serializable]';
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
var out = line + metaStr;
|
|
108
|
+
if (level === 'info') {
|
|
109
|
+
console.info(out);
|
|
110
|
+
}
|
|
111
|
+
else if (level === 'warn') {
|
|
112
|
+
console.warn(out);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
console.error(out);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
export function buildPluginContext(opts) {
|
|
120
|
+
var pluginName = opts.pluginName;
|
|
121
|
+
var logger = opts.logger ?? new ConsolePluginLogger(pluginName);
|
|
122
|
+
var storage = opts.storage.forPlugin(pluginName);
|
|
123
|
+
var getZonePeers = opts.getZonePeers ??
|
|
124
|
+
function () {
|
|
125
|
+
return [];
|
|
126
|
+
};
|
|
127
|
+
var getCharacterState = opts.getCharacterState ??
|
|
128
|
+
function (characterId) {
|
|
129
|
+
return {
|
|
130
|
+
characterId,
|
|
131
|
+
zone: '',
|
|
132
|
+
x: 0,
|
|
133
|
+
y: 0,
|
|
134
|
+
hp_current: 0,
|
|
135
|
+
hp_max: 0,
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
var getZoneState = opts.getZoneState ??
|
|
139
|
+
function () {
|
|
140
|
+
return new Map();
|
|
141
|
+
};
|
|
142
|
+
var now = opts.now ?? Date.now;
|
|
143
|
+
return {
|
|
144
|
+
getZonePeers,
|
|
145
|
+
getCharacterState,
|
|
146
|
+
getZoneState,
|
|
147
|
+
storage,
|
|
148
|
+
logger,
|
|
149
|
+
now,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=plugin-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-context.js","sourceRoot":"","sources":["../../../src/director/ai/plugin-context.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,qEAAqE;AACrE,iEAAiE;AACjE,sEAAsE;AACtE,kEAAkE;AAClE,uDAAuD;AACvD,EAAE;AACF,gEAAgE;AAChE,yDAAyD;AACzD,iEAAiE;AACjE,wDAAwD;AACxD,EAAE;AACF,4DAA4D;AAC5D,kEAAkE;AAClE,4DAA4D;AAU5D,+BAA+B;AAC/B,EAAE;AACF,oEAAoE;AACpE,uEAAuE;AACvE,mEAAmE;AACnE,yCAAyC;AACzC,MAAM,OAAO,gBAAgB;IACV,KAAK,GAAG,IAAI,GAAG,EAAmB,CAAC;IAEpD,6DAA6D;IAC7D,8DAA8D;IAC9D,2DAA2D;IAC3D,SAAS,CAAC,UAAkB;QAC1B,IAAI,IAAI,GAAG,IAAI,CAAC;QAChB,OAAO;YACL,KAAK,CAAC,GAAG,CAAC,GAAW;gBACnB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;YAC1D,CAAC;YACD,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAc;gBACnC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;YAC1D,CAAC;YACD,KAAK,CAAC,MAAM,CAAC,GAAW;gBACtB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;YACtD,CAAC;SACF,CAAC;IACJ,CAAC;IAED,iEAAiE;IACjE,+DAA+D;IAC/D,sBAAsB;IACtB,WAAW,CAA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U,CAAC,CAAC;IAChE,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACjD,IAAI,YAAY,GACd,IAAI,CAAC,YAAY;QACjB;YACE,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;IACJ,IAAI,iBAAiB,GACnB,IAAI,CAAC,iBAAiB;QACtB,UAAU,WAAmB;YAC3B,OAAO;gBACL,WAAW;gBACX,IAAI,EAAE,EAAE;gBACR,CAAC,EAAE,CAAC;gBACJ,CAAC,EAAE,CAAC;gBACJ,UAAU,EAAE,CAAC;gBACb,MAAM,EAAE,CAAC;aACV,CAAC;QACJ,CAAC,CAAC;IACJ,IAAI,YAAY,GACd,IAAI,CAAC,YAAY;QACjB;YACE,OAAO,IAAI,GAAG,EAAmB,CAAC;QACpC,CAAC,CAAC;IACJ,IAAI,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC;IAC/B,OAAO;QACL,YAAY;QACZ,iBAAiB;QACjB,YAAY;QACZ,OAAO;QACP,MAAM;QACN,GAAG;KACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { DirectorEvent } from '../event-envelope.js';
|
|
2
|
+
import type { ZoneEvent } from '../zone/zone-event-envelope.js';
|
|
3
|
+
export type { ZoneEvent };
|
|
4
|
+
export interface EmittedEvents {
|
|
5
|
+
characterEvents?: DirectorEvent[];
|
|
6
|
+
zoneEvents?: ZoneEvent[];
|
|
7
|
+
}
|
|
8
|
+
export interface PeerInfo {
|
|
9
|
+
characterId: string;
|
|
10
|
+
userId: string;
|
|
11
|
+
zone: string;
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
name: string | null;
|
|
15
|
+
}
|
|
16
|
+
export interface PlayerAction {
|
|
17
|
+
kind: 'damage' | 'interact' | 'speak' | 'use_item' | (string & {});
|
|
18
|
+
payload: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
export interface CharacterState {
|
|
21
|
+
characterId: string;
|
|
22
|
+
zone: string;
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
hp_current: number;
|
|
26
|
+
hp_max: number;
|
|
27
|
+
}
|
|
28
|
+
export interface PluginStorage {
|
|
29
|
+
get(key: string): Promise<unknown | undefined>;
|
|
30
|
+
set(key: string, value: unknown): Promise<void>;
|
|
31
|
+
delete(key: string): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
export interface PluginLogger {
|
|
34
|
+
info(msg: string, meta?: Record<string, unknown>): void;
|
|
35
|
+
warn(msg: string, meta?: Record<string, unknown>): void;
|
|
36
|
+
error(msg: string, meta?: Record<string, unknown>): void;
|
|
37
|
+
}
|
|
38
|
+
export interface PluginContext {
|
|
39
|
+
getZonePeers(zoneId: string): ReadonlyArray<PeerInfo>;
|
|
40
|
+
getCharacterState(characterId: string): Readonly<CharacterState>;
|
|
41
|
+
getZoneState(zoneId: string): ReadonlyMap<string, unknown>;
|
|
42
|
+
storage: PluginStorage;
|
|
43
|
+
logger: PluginLogger;
|
|
44
|
+
now: () => number;
|
|
45
|
+
}
|
|
46
|
+
export interface IAIPlugin {
|
|
47
|
+
readonly name: string;
|
|
48
|
+
readonly version: string;
|
|
49
|
+
readonly priority: number;
|
|
50
|
+
onTick?(ctx: PluginContext): Promise<EmittedEvents>;
|
|
51
|
+
onPeerJoin?(ctx: PluginContext, peer: PeerInfo): Promise<EmittedEvents>;
|
|
52
|
+
onPeerLeave?(ctx: PluginContext, peer: PeerInfo): Promise<EmittedEvents>;
|
|
53
|
+
onZoneEnter?(ctx: PluginContext, peer: PeerInfo, fromZone: string | null): Promise<EmittedEvents>;
|
|
54
|
+
onPlayerAction?(ctx: PluginContext, peer: PeerInfo, action: PlayerAction): Promise<EmittedEvents>;
|
|
55
|
+
dispose?(): Promise<void>;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@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