@lanyingim/lanying 1.0.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/src/runtime.ts ADDED
@@ -0,0 +1,14 @@
1
+ import type { PluginRuntime } from "openclaw/plugin-sdk";
2
+
3
+ let runtime: PluginRuntime | null = null;
4
+
5
+ export function setLanyingRuntime(next: PluginRuntime) {
6
+ runtime = next;
7
+ }
8
+
9
+ export function getLanyingRuntime(): PluginRuntime {
10
+ if (!runtime) {
11
+ throw new Error("Lanying runtime not initialized");
12
+ }
13
+ return runtime;
14
+ }
package/src/types.ts ADDED
@@ -0,0 +1,44 @@
1
+ export const LANYING_CHANNEL_ID = "lanying";
2
+ export const LANYING_DEFAULT_ACCOUNT_ID = "default";
3
+
4
+ export type LanyingChannelConfig = {
5
+ enabled?: boolean;
6
+ app_id?: string;
7
+ username?: string;
8
+ password?: string;
9
+ dmPolicy?: string;
10
+ allowFrom?: Array<string | number>;
11
+ defaultTo?: string;
12
+ };
13
+
14
+ export type ResolvedLanyingAccount = {
15
+ accountId: string;
16
+ enabled: boolean;
17
+ configured: boolean;
18
+ appId: string;
19
+ username: string;
20
+ password: string;
21
+ dmPolicy: string;
22
+ allowFrom: string[];
23
+ defaultTo?: string;
24
+ };
25
+
26
+ export type LanyingMessageTarget = {
27
+ kind: "user" | "group";
28
+ id: string;
29
+ };
30
+
31
+ export type LanyingInboundEvent = {
32
+ from?: { uid?: string | number; id?: string | number } | string | number;
33
+ to?: { uid?: string | number; id?: string | number } | string | number;
34
+ gid?: string | number;
35
+ group_id?: string | number;
36
+ conversation_id?: string | number;
37
+ type?: string;
38
+ msg?: unknown;
39
+ text?: unknown;
40
+ content?: unknown;
41
+ payload?: Record<string, unknown>;
42
+ sender_id?: string | number;
43
+ [key: string]: unknown;
44
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Bundler",
6
+ "strict": true,
7
+ "noEmit": true,
8
+ "allowSyntheticDefaultImports": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true
12
+ },
13
+ "include": ["index.ts", "src/**/*.ts"],
14
+ "exclude": ["node_modules"]
15
+ }