@core-workspace/infoflow-openclaw-plugin 2026.3.8
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/README.md +989 -0
- package/docs/architecture-data-flow.md +429 -0
- package/docs/architecture.md +423 -0
- package/docs/dev-guide.md +611 -0
- package/index.ts +29 -0
- package/openclaw.plugin.json +138 -0
- package/package.json +40 -0
- package/scripts/deploy.sh +34 -0
- package/skills/infoflow-dev/SKILL.md +88 -0
- package/skills/infoflow-dev/references/api.md +413 -0
- package/src/adapter/inbound/webhook-parser.ts +433 -0
- package/src/adapter/inbound/ws-receiver.ts +226 -0
- package/src/adapter/outbound/reply-dispatcher.ts +281 -0
- package/src/adapter/outbound/target-resolver.ts +109 -0
- package/src/channel/accounts.ts +164 -0
- package/src/channel/channel.ts +364 -0
- package/src/channel/media.ts +365 -0
- package/src/channel/monitor.ts +184 -0
- package/src/channel/outbound.ts +934 -0
- package/src/events.ts +62 -0
- package/src/handler/message-handler.ts +801 -0
- package/src/logging.ts +123 -0
- package/src/runtime.ts +14 -0
- package/src/security/dm-policy.ts +80 -0
- package/src/security/group-policy.ts +271 -0
- package/src/tools/actions/index.ts +456 -0
- package/src/tools/hooks/index.ts +82 -0
- package/src/tools/index.ts +277 -0
- package/src/types.ts +277 -0
- package/src/utils/store/message-store.ts +295 -0
- package/src/utils/token-adapter.ts +90 -0
package/src/events.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core event bus — decouples send/media from extensions (store, etc.).
|
|
3
|
+
*
|
|
4
|
+
* Core modules emit events after completing actions;
|
|
5
|
+
* extensions subscribe to react (e.g. record sent messages in store).
|
|
6
|
+
*
|
|
7
|
+
* Uses a simple typed EventEmitter so there are zero external dependencies.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { EventEmitter } from "node:events";
|
|
11
|
+
import type { InfoflowMessageContentItem } from "./types.js";
|
|
12
|
+
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// Event type definitions
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
export type SentMessageEvent = {
|
|
18
|
+
accountId: string;
|
|
19
|
+
target: string;
|
|
20
|
+
from: string;
|
|
21
|
+
messageid: string;
|
|
22
|
+
msgseqid: string;
|
|
23
|
+
contents: InfoflowMessageContentItem[];
|
|
24
|
+
sentAt: number;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type MessageRecalledEvent = {
|
|
28
|
+
accountId: string;
|
|
29
|
+
messageids: string[];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export interface CoreEventMap {
|
|
33
|
+
"message:sent": SentMessageEvent;
|
|
34
|
+
"message:recalled": MessageRecalledEvent;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
// Typed emitter
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
|
|
41
|
+
class CoreEventBus {
|
|
42
|
+
private emitter = new EventEmitter();
|
|
43
|
+
|
|
44
|
+
emit<K extends keyof CoreEventMap>(event: K, data: CoreEventMap[K]): void {
|
|
45
|
+
this.emitter.emit(event, data);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
on<K extends keyof CoreEventMap>(event: K, handler: (data: CoreEventMap[K]) => void): void {
|
|
49
|
+
this.emitter.on(event, handler as (...args: unknown[]) => void);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
off<K extends keyof CoreEventMap>(event: K, handler: (data: CoreEventMap[K]) => void): void {
|
|
53
|
+
this.emitter.off(event, handler as (...args: unknown[]) => void);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
removeAllListeners(): void {
|
|
57
|
+
this.emitter.removeAllListeners();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Singleton core event bus. */
|
|
62
|
+
export const coreEvents = new CoreEventBus();
|