@elizaos/plugin-line 2.0.3-beta.6 → 2.0.3-beta.7
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/accounts.d.ts +152 -0
- package/dist/accounts.d.ts.map +1 -0
- package/dist/accounts.js +258 -0
- package/dist/accounts.js.map +1 -0
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +3 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/connector-account-provider.d.ts +16 -0
- package/dist/connector-account-provider.d.ts.map +1 -0
- package/dist/connector-account-provider.js +82 -0
- package/dist/connector-account-provider.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +66 -0
- package/dist/index.js.map +1 -0
- package/dist/messaging.d.ts +142 -0
- package/dist/messaging.d.ts.map +1 -0
- package/dist/messaging.js +357 -0
- package/dist/messaging.js.map +1 -0
- package/dist/providers/index.d.ts +7 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +8 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/service.d.ts +110 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +861 -0
- package/dist/service.js.map +1 -0
- package/dist/types.d.ts +279 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +106 -0
- package/dist/types.js.map +1 -0
- package/dist/workflow-credential-provider.d.ts +21 -0
- package/dist/workflow-credential-provider.d.ts.map +1 -0
- package/dist/workflow-credential-provider.js +38 -0
- package/dist/workflow-credential-provider.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { IAgentRuntime } from "@elizaos/core";
|
|
2
|
+
/**
|
|
3
|
+
* Default account identifier used when no specific account is configured
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEFAULT_ACCOUNT_ID = "default";
|
|
6
|
+
/**
|
|
7
|
+
* Token source indicator
|
|
8
|
+
*/
|
|
9
|
+
export type LineTokenSource = "config" | "env" | "character" | "none";
|
|
10
|
+
/**
|
|
11
|
+
* Group-specific configuration
|
|
12
|
+
*/
|
|
13
|
+
export interface LineGroupConfig {
|
|
14
|
+
/** If false, ignore messages from this group */
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
/** Allowlist for users in this group */
|
|
17
|
+
allowFrom?: Array<string | number>;
|
|
18
|
+
/** Require bot mention to respond */
|
|
19
|
+
requireMention?: boolean;
|
|
20
|
+
/** Custom system prompt for this group */
|
|
21
|
+
systemPrompt?: string;
|
|
22
|
+
/** Skills enabled for this group */
|
|
23
|
+
skills?: string[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Configuration for a single LINE account
|
|
27
|
+
*/
|
|
28
|
+
export interface LineAccountConfig {
|
|
29
|
+
/** Optional display name for this account */
|
|
30
|
+
name?: string;
|
|
31
|
+
/** If false, do not start this LINE account */
|
|
32
|
+
enabled?: boolean;
|
|
33
|
+
/** Channel access token */
|
|
34
|
+
channelAccessToken?: string;
|
|
35
|
+
/** Channel secret */
|
|
36
|
+
channelSecret?: string;
|
|
37
|
+
/** Path to file containing channel access token */
|
|
38
|
+
tokenFile?: string;
|
|
39
|
+
/** Path to file containing channel secret */
|
|
40
|
+
secretFile?: string;
|
|
41
|
+
/** Allowlist for DM senders */
|
|
42
|
+
allowFrom?: Array<string | number>;
|
|
43
|
+
/** Allowlist for groups */
|
|
44
|
+
groupAllowFrom?: Array<string | number>;
|
|
45
|
+
/** DM access policy */
|
|
46
|
+
dmPolicy?: "open" | "allowlist" | "pairing" | "disabled";
|
|
47
|
+
/** Group message access policy */
|
|
48
|
+
groupPolicy?: "open" | "allowlist" | "disabled";
|
|
49
|
+
/** Max media size in MB */
|
|
50
|
+
mediaMaxMb?: number;
|
|
51
|
+
/** Custom webhook path */
|
|
52
|
+
webhookPath?: string;
|
|
53
|
+
/** Group-specific configurations */
|
|
54
|
+
groups?: Record<string, LineGroupConfig>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Multi-account LINE configuration structure
|
|
58
|
+
*/
|
|
59
|
+
export interface LineMultiAccountConfig {
|
|
60
|
+
/** Default/base configuration applied to all accounts */
|
|
61
|
+
enabled?: boolean;
|
|
62
|
+
channelAccessToken?: string;
|
|
63
|
+
channelSecret?: string;
|
|
64
|
+
tokenFile?: string;
|
|
65
|
+
secretFile?: string;
|
|
66
|
+
dmPolicy?: "open" | "allowlist" | "pairing" | "disabled";
|
|
67
|
+
groupPolicy?: "open" | "allowlist" | "disabled";
|
|
68
|
+
mediaMaxMb?: number;
|
|
69
|
+
webhookPath?: string;
|
|
70
|
+
/** Per-account configuration overrides */
|
|
71
|
+
accounts?: Record<string, LineAccountConfig>;
|
|
72
|
+
/** Group configurations at base level */
|
|
73
|
+
groups?: Record<string, LineGroupConfig>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Token resolution result
|
|
77
|
+
*/
|
|
78
|
+
export interface LineTokenResolution {
|
|
79
|
+
token: string;
|
|
80
|
+
source: LineTokenSource;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Resolved LINE account with all configuration merged
|
|
84
|
+
*/
|
|
85
|
+
export interface ResolvedLineAccount {
|
|
86
|
+
accountId: string;
|
|
87
|
+
enabled: boolean;
|
|
88
|
+
name?: string;
|
|
89
|
+
channelAccessToken: string;
|
|
90
|
+
channelSecret: string;
|
|
91
|
+
tokenSource: LineTokenSource;
|
|
92
|
+
configured: boolean;
|
|
93
|
+
config: LineAccountConfig;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Normalizes an account ID, returning the default if not provided
|
|
97
|
+
*/
|
|
98
|
+
export declare function normalizeAccountId(accountId?: string | null): string;
|
|
99
|
+
/**
|
|
100
|
+
* Gets the account configuration records from runtime settings
|
|
101
|
+
*/
|
|
102
|
+
export declare function getMultiAccountConfig(runtime: IAgentRuntime): LineMultiAccountConfig;
|
|
103
|
+
/**
|
|
104
|
+
* Lists all configured account IDs
|
|
105
|
+
*/
|
|
106
|
+
export declare function listLineAccountIds(runtime: IAgentRuntime): string[];
|
|
107
|
+
/**
|
|
108
|
+
* Resolves the default account ID to use
|
|
109
|
+
*/
|
|
110
|
+
export declare function resolveDefaultLineAccountId(runtime: IAgentRuntime): string;
|
|
111
|
+
/**
|
|
112
|
+
* Resolves the channel access token for a LINE account
|
|
113
|
+
*/
|
|
114
|
+
export declare function resolveLineToken(runtime: IAgentRuntime, accountId: string): LineTokenResolution;
|
|
115
|
+
/**
|
|
116
|
+
* Resolves the channel secret for a LINE account
|
|
117
|
+
*/
|
|
118
|
+
export declare function resolveLineSecret(runtime: IAgentRuntime, accountId: string): string;
|
|
119
|
+
/**
|
|
120
|
+
* Resolves a complete LINE account configuration
|
|
121
|
+
*/
|
|
122
|
+
export declare function resolveLineAccount(runtime: IAgentRuntime, accountId?: string | null): ResolvedLineAccount;
|
|
123
|
+
/**
|
|
124
|
+
* Lists all enabled LINE accounts
|
|
125
|
+
*/
|
|
126
|
+
export declare function listEnabledLineAccounts(runtime: IAgentRuntime): ResolvedLineAccount[];
|
|
127
|
+
/**
|
|
128
|
+
* Checks whether more than one enabled account is configured
|
|
129
|
+
*/
|
|
130
|
+
export declare function isMultiAccountEnabled(runtime: IAgentRuntime): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Resolves group configuration for a specific group
|
|
133
|
+
*/
|
|
134
|
+
export declare function resolveLineGroupConfig(runtime: IAgentRuntime, accountId: string, groupId: string): LineGroupConfig | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* Checks if a user is allowed based on policy and allowlist
|
|
137
|
+
*/
|
|
138
|
+
export declare function isLineUserAllowed(params: {
|
|
139
|
+
userId: string;
|
|
140
|
+
accountConfig: LineAccountConfig;
|
|
141
|
+
isGroup: boolean;
|
|
142
|
+
groupId?: string;
|
|
143
|
+
groupConfig?: LineGroupConfig;
|
|
144
|
+
}): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Checks if mention is required in a group
|
|
147
|
+
*/
|
|
148
|
+
export declare function isLineMentionRequired(params: {
|
|
149
|
+
accountConfig: LineAccountConfig;
|
|
150
|
+
groupConfig?: LineGroupConfig;
|
|
151
|
+
}): boolean;
|
|
152
|
+
//# sourceMappingURL=accounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,KAAK,GAAG,WAAW,GAAG,MAAM,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,gDAAgD;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wCAAwC;IACxC,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACnC,qCAAqC;IACrC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2BAA2B;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qBAAqB;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,G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gB,iBAAiB,CAAC,MAAM,EAAE;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,iBAAiB,CAAC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B,GAAG,OAAO,CA8CV;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAC5C,aAAa,EAAE,iBAAiB,CAAC;IACjC,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B,GAAG,OAAO,CAGV"}
|
package/dist/accounts.js
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default account identifier used when no specific account is configured
|
|
3
|
+
*/
|
|
4
|
+
export const DEFAULT_ACCOUNT_ID = "default";
|
|
5
|
+
/**
|
|
6
|
+
* Normalizes an account ID, returning the default if not provided
|
|
7
|
+
*/
|
|
8
|
+
export function normalizeAccountId(accountId) {
|
|
9
|
+
if (!accountId || typeof accountId !== "string") {
|
|
10
|
+
return DEFAULT_ACCOUNT_ID;
|
|
11
|
+
}
|
|
12
|
+
const trimmed = accountId.trim().toLowerCase();
|
|
13
|
+
if (!trimmed || trimmed === "default") {
|
|
14
|
+
return DEFAULT_ACCOUNT_ID;
|
|
15
|
+
}
|
|
16
|
+
return trimmed;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Gets the account configuration records from runtime settings
|
|
20
|
+
*/
|
|
21
|
+
export function getMultiAccountConfig(runtime) {
|
|
22
|
+
const characterLine = runtime.character.settings?.line;
|
|
23
|
+
return {
|
|
24
|
+
enabled: characterLine?.enabled,
|
|
25
|
+
channelAccessToken: characterLine?.channelAccessToken,
|
|
26
|
+
channelSecret: characterLine?.channelSecret,
|
|
27
|
+
tokenFile: characterLine?.tokenFile,
|
|
28
|
+
secretFile: characterLine?.secretFile,
|
|
29
|
+
dmPolicy: characterLine?.dmPolicy,
|
|
30
|
+
groupPolicy: characterLine?.groupPolicy,
|
|
31
|
+
mediaMaxMb: characterLine?.mediaMaxMb,
|
|
32
|
+
webhookPath: characterLine?.webhookPath,
|
|
33
|
+
accounts: characterLine?.accounts,
|
|
34
|
+
groups: characterLine?.groups,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Lists all configured account IDs
|
|
39
|
+
*/
|
|
40
|
+
export function listLineAccountIds(runtime) {
|
|
41
|
+
const config = getMultiAccountConfig(runtime);
|
|
42
|
+
const accounts = config.accounts;
|
|
43
|
+
const ids = new Set();
|
|
44
|
+
// Add default account if configured at base level
|
|
45
|
+
const envToken = runtime.getSetting("LINE_CHANNEL_ACCESS_TOKEN");
|
|
46
|
+
if (config.channelAccessToken?.trim() || config.tokenFile || envToken?.trim()) {
|
|
47
|
+
ids.add(DEFAULT_ACCOUNT_ID);
|
|
48
|
+
}
|
|
49
|
+
// Add named accounts
|
|
50
|
+
if (accounts && typeof accounts === "object") {
|
|
51
|
+
for (const id of Object.keys(accounts)) {
|
|
52
|
+
if (id) {
|
|
53
|
+
ids.add(id);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const result = Array.from(ids);
|
|
58
|
+
if (result.length === 0) {
|
|
59
|
+
return [DEFAULT_ACCOUNT_ID];
|
|
60
|
+
}
|
|
61
|
+
return result.slice().sort((a, b) => a.localeCompare(b));
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Resolves the default account ID to use
|
|
65
|
+
*/
|
|
66
|
+
export function resolveDefaultLineAccountId(runtime) {
|
|
67
|
+
const ids = listLineAccountIds(runtime);
|
|
68
|
+
if (ids.includes(DEFAULT_ACCOUNT_ID)) {
|
|
69
|
+
return DEFAULT_ACCOUNT_ID;
|
|
70
|
+
}
|
|
71
|
+
return ids[0] ?? DEFAULT_ACCOUNT_ID;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Gets the account-specific configuration
|
|
75
|
+
*/
|
|
76
|
+
function getAccountConfig(runtime, accountId) {
|
|
77
|
+
const config = getMultiAccountConfig(runtime);
|
|
78
|
+
const accounts = config.accounts;
|
|
79
|
+
if (!accounts || typeof accounts !== "object") {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
return accounts[accountId];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Resolves the channel access token for a LINE account
|
|
86
|
+
*/
|
|
87
|
+
export function resolveLineToken(runtime, accountId) {
|
|
88
|
+
const multiConfig = getMultiAccountConfig(runtime);
|
|
89
|
+
const accountConfig = getAccountConfig(runtime, accountId);
|
|
90
|
+
// Check account-level config first
|
|
91
|
+
if (accountConfig?.channelAccessToken?.trim()) {
|
|
92
|
+
return { token: accountConfig.channelAccessToken.trim(), source: "config" };
|
|
93
|
+
}
|
|
94
|
+
// For default account, check base config
|
|
95
|
+
if (accountId === DEFAULT_ACCOUNT_ID) {
|
|
96
|
+
if (multiConfig.channelAccessToken?.trim()) {
|
|
97
|
+
return { token: multiConfig.channelAccessToken.trim(), source: "config" };
|
|
98
|
+
}
|
|
99
|
+
// Check environment/runtime settings
|
|
100
|
+
const envToken = runtime.getSetting("LINE_CHANNEL_ACCESS_TOKEN");
|
|
101
|
+
if (envToken?.trim()) {
|
|
102
|
+
return { token: envToken.trim(), source: "env" };
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return { token: "", source: "none" };
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Resolves the channel secret for a LINE account
|
|
109
|
+
*/
|
|
110
|
+
export function resolveLineSecret(runtime, accountId) {
|
|
111
|
+
const multiConfig = getMultiAccountConfig(runtime);
|
|
112
|
+
const accountConfig = getAccountConfig(runtime, accountId);
|
|
113
|
+
// Check account-level config first
|
|
114
|
+
if (accountConfig?.channelSecret?.trim()) {
|
|
115
|
+
return accountConfig.channelSecret.trim();
|
|
116
|
+
}
|
|
117
|
+
// For default account, check base config and env
|
|
118
|
+
if (accountId === DEFAULT_ACCOUNT_ID) {
|
|
119
|
+
if (multiConfig.channelSecret?.trim()) {
|
|
120
|
+
return multiConfig.channelSecret.trim();
|
|
121
|
+
}
|
|
122
|
+
const envSecret = runtime.getSetting("LINE_CHANNEL_SECRET");
|
|
123
|
+
if (envSecret?.trim()) {
|
|
124
|
+
return envSecret.trim();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return "";
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Merges base configuration with account-specific overrides
|
|
131
|
+
*/
|
|
132
|
+
/**
|
|
133
|
+
* Removes undefined values from an object to prevent them from overwriting during spread
|
|
134
|
+
*/
|
|
135
|
+
function filterDefined(obj) {
|
|
136
|
+
return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined));
|
|
137
|
+
}
|
|
138
|
+
function mergeLineAccountConfig(runtime, accountId) {
|
|
139
|
+
const multiConfig = getMultiAccountConfig(runtime);
|
|
140
|
+
const { accounts: _ignored, ...baseConfig } = multiConfig;
|
|
141
|
+
const accountConfig = getAccountConfig(runtime, accountId) ?? {};
|
|
142
|
+
// Get environment/runtime settings for the base config
|
|
143
|
+
const envDmPolicy = runtime.getSetting("LINE_DM_POLICY");
|
|
144
|
+
const envGroupPolicy = runtime.getSetting("LINE_GROUP_POLICY");
|
|
145
|
+
const envConfig = {
|
|
146
|
+
dmPolicy: envDmPolicy,
|
|
147
|
+
groupPolicy: envGroupPolicy,
|
|
148
|
+
};
|
|
149
|
+
// Merge order: env defaults < base config < account config
|
|
150
|
+
// Filter undefined values to prevent them from overwriting defined values
|
|
151
|
+
return {
|
|
152
|
+
...filterDefined(envConfig),
|
|
153
|
+
...filterDefined(baseConfig),
|
|
154
|
+
...filterDefined(accountConfig),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Resolves a complete LINE account configuration
|
|
159
|
+
*/
|
|
160
|
+
export function resolveLineAccount(runtime, accountId) {
|
|
161
|
+
const normalizedAccountId = normalizeAccountId(accountId);
|
|
162
|
+
const multiConfig = getMultiAccountConfig(runtime);
|
|
163
|
+
const baseEnabled = multiConfig.enabled !== false;
|
|
164
|
+
const merged = mergeLineAccountConfig(runtime, normalizedAccountId);
|
|
165
|
+
const accountEnabled = merged.enabled !== false;
|
|
166
|
+
const enabled = baseEnabled && accountEnabled;
|
|
167
|
+
const { token, source: tokenSource } = resolveLineToken(runtime, normalizedAccountId);
|
|
168
|
+
const secret = resolveLineSecret(runtime, normalizedAccountId);
|
|
169
|
+
// Determine if this account is actually configured
|
|
170
|
+
const configured = Boolean(token || secret);
|
|
171
|
+
return {
|
|
172
|
+
accountId: normalizedAccountId,
|
|
173
|
+
enabled,
|
|
174
|
+
name: merged.name?.trim() || undefined,
|
|
175
|
+
channelAccessToken: token,
|
|
176
|
+
channelSecret: secret,
|
|
177
|
+
tokenSource,
|
|
178
|
+
configured,
|
|
179
|
+
config: merged,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Lists all enabled LINE accounts
|
|
184
|
+
*/
|
|
185
|
+
export function listEnabledLineAccounts(runtime) {
|
|
186
|
+
return listLineAccountIds(runtime)
|
|
187
|
+
.map((accountId) => resolveLineAccount(runtime, accountId))
|
|
188
|
+
.filter((account) => account.enabled && account.configured);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Checks whether more than one enabled account is configured
|
|
192
|
+
*/
|
|
193
|
+
export function isMultiAccountEnabled(runtime) {
|
|
194
|
+
const accounts = listEnabledLineAccounts(runtime);
|
|
195
|
+
return accounts.length > 1;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Resolves group configuration for a specific group
|
|
199
|
+
*/
|
|
200
|
+
export function resolveLineGroupConfig(runtime, accountId, groupId) {
|
|
201
|
+
const multiConfig = getMultiAccountConfig(runtime);
|
|
202
|
+
const accountConfig = getAccountConfig(runtime, accountId);
|
|
203
|
+
// Check account-level groups first
|
|
204
|
+
const accountGroup = accountConfig?.groups?.[groupId];
|
|
205
|
+
if (accountGroup) {
|
|
206
|
+
return accountGroup;
|
|
207
|
+
}
|
|
208
|
+
// Fall back to base-level groups
|
|
209
|
+
return multiConfig.groups?.[groupId];
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Checks if a user is allowed based on policy and allowlist
|
|
213
|
+
*/
|
|
214
|
+
export function isLineUserAllowed(params) {
|
|
215
|
+
const { userId, accountConfig, isGroup, groupConfig } = params;
|
|
216
|
+
if (isGroup) {
|
|
217
|
+
const policy = accountConfig.groupPolicy ?? "allowlist";
|
|
218
|
+
if (policy === "disabled") {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
if (policy === "open") {
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
// Check group-specific allowlist first
|
|
225
|
+
if (groupConfig?.allowFrom?.length) {
|
|
226
|
+
return groupConfig.allowFrom.some((allowed) => String(allowed) === userId);
|
|
227
|
+
}
|
|
228
|
+
// Check account-level group allowlist
|
|
229
|
+
if (accountConfig.groupAllowFrom?.length) {
|
|
230
|
+
return accountConfig.groupAllowFrom.some((allowed) => String(allowed) === userId);
|
|
231
|
+
}
|
|
232
|
+
return policy !== "allowlist";
|
|
233
|
+
}
|
|
234
|
+
// DM handling
|
|
235
|
+
const policy = accountConfig.dmPolicy ?? "pairing";
|
|
236
|
+
if (policy === "disabled") {
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
if (policy === "open") {
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
if (policy === "pairing") {
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
// Allowlist policy
|
|
246
|
+
if (accountConfig.allowFrom?.length) {
|
|
247
|
+
return accountConfig.allowFrom.some((allowed) => String(allowed) === userId);
|
|
248
|
+
}
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Checks if mention is required in a group
|
|
253
|
+
*/
|
|
254
|
+
export function isLineMentionRequired(params) {
|
|
255
|
+
const { groupConfig } = params;
|
|
256
|
+
return groupConfig?.requireMention ?? false;
|
|
257
|
+
}
|
|
258
|
+
//# sourceMappingURL=accounts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.js","sourceRoot":"","sources":["../src/accounts.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAiG5C;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAAyB;IAC1D,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IACD,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC/C,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QACtC,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAsB;IAC1D,MAAM,aAAa,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,EAAE,IAA0C,CAAC;IAE7F,OAAO;QACL,OAAO,EAAE,aAAa,EAAE,OAAO;QAC/B,kBAAkB,EAAE,aAAa,EAAE,kBAAkB;QACrD,aAAa,EAAE,aAAa,EAAE,aAAa;QAC3C,SAAS,EAAE,aAAa,EAAE,SAAS;QACnC,UAAU,EAAE,aAAa,EAAE,UAAU;QACrC,QAAQ,EAAE,aAAa,EAAE,QAAQ;QACjC,WAAW,EAAE,aAAa,EAAE,WAAW;QACvC,UAAU,EAAE,aAAa,EAAE,UAAU;QACrC,WAAW,EAAE,aAAa,EAAE,WAAW;QACvC,QAAQ,EAAE,aAAa,EAAE,QAAQ;QACjC,MAAM,EAAE,aAAa,EAAE,MAAM;KAC9B,CAAC;AACJ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,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,MAAM,CAAC,CAAC;IAC/E,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAGrC;IACC,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IAC/B,OAAO,WAAW,EAAE,cAAc,IAAI,KAAK,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":";AAAA,yDAAyD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LINE ConnectorAccountManager provider.
|
|
3
|
+
*
|
|
4
|
+
* Adapts the account resolution helpers in `accounts.ts` to the
|
|
5
|
+
* `ConnectorAccountProvider` contract from
|
|
6
|
+
* `@elizaos/core/connectors/account-manager`.
|
|
7
|
+
*
|
|
8
|
+
* Source of truth for accounts is character settings (`character.settings.line`)
|
|
9
|
+
* plus env-var fallbacks (LINE_CHANNEL_ACCESS_TOKEN, LINE_CHANNEL_SECRET).
|
|
10
|
+
* `listAccounts` enumerates all configured/enabled accounts; single-account
|
|
11
|
+
* env-only deployments still surface as a `default` account.
|
|
12
|
+
*/
|
|
13
|
+
import type { ConnectorAccountProvider, IAgentRuntime } from "@elizaos/core";
|
|
14
|
+
export declare const LINE_PROVIDER_ID = "line";
|
|
15
|
+
export declare function createLineConnectorAccountProvider(runtime: IAgentRuntime): ConnectorAccountProvider;
|
|
16
|
+
//# sourceMappingURL=connector-account-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector-account-provider.d.ts","sourceRoot":"","sources":["../src/connector-account-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAIV,wBAAwB,EACxB,aAAa,EACd,MAAM,eAAe,CAAC;AASvB,eAAO,MAAM,gBAAgB,SAAS,CAAC;AAsCvC,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,aAAa,GACrB,wBAAwB,CAoC1B"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LINE ConnectorAccountManager provider.
|
|
3
|
+
*
|
|
4
|
+
* Adapts the account resolution helpers in `accounts.ts` to the
|
|
5
|
+
* `ConnectorAccountProvider` contract from
|
|
6
|
+
* `@elizaos/core/connectors/account-manager`.
|
|
7
|
+
*
|
|
8
|
+
* Source of truth for accounts is character settings (`character.settings.line`)
|
|
9
|
+
* plus env-var fallbacks (LINE_CHANNEL_ACCESS_TOKEN, LINE_CHANNEL_SECRET).
|
|
10
|
+
* `listAccounts` enumerates all configured/enabled accounts; single-account
|
|
11
|
+
* env-only deployments still surface as a `default` account.
|
|
12
|
+
*/
|
|
13
|
+
import { DEFAULT_ACCOUNT_ID, listEnabledLineAccounts, normalizeAccountId, resolveLineAccount, } from "./accounts.js";
|
|
14
|
+
export const LINE_PROVIDER_ID = "line";
|
|
15
|
+
function purposeForAccount(_account) {
|
|
16
|
+
return ["messaging"];
|
|
17
|
+
}
|
|
18
|
+
function accessGateForAccount(account) {
|
|
19
|
+
const dmPolicy = account.config.dmPolicy;
|
|
20
|
+
if (dmPolicy === "pairing")
|
|
21
|
+
return "pairing";
|
|
22
|
+
if (dmPolicy === "disabled")
|
|
23
|
+
return "disabled";
|
|
24
|
+
return "open";
|
|
25
|
+
}
|
|
26
|
+
function roleForAccount(_account) {
|
|
27
|
+
// LINE channel access tokens are bot tokens, not user-OAuth.
|
|
28
|
+
return "AGENT";
|
|
29
|
+
}
|
|
30
|
+
function toConnectorAccount(account) {
|
|
31
|
+
const now = Date.now();
|
|
32
|
+
return {
|
|
33
|
+
id: normalizeAccountId(account.accountId),
|
|
34
|
+
provider: LINE_PROVIDER_ID,
|
|
35
|
+
label: account.name ?? account.accountId,
|
|
36
|
+
role: roleForAccount(account),
|
|
37
|
+
purpose: purposeForAccount(account),
|
|
38
|
+
accessGate: accessGateForAccount(account),
|
|
39
|
+
status: account.enabled && account.configured ? "connected" : "disabled",
|
|
40
|
+
createdAt: now,
|
|
41
|
+
updatedAt: now,
|
|
42
|
+
metadata: {
|
|
43
|
+
tokenSource: account.tokenSource,
|
|
44
|
+
dmPolicy: account.config.dmPolicy ?? "open",
|
|
45
|
+
groupPolicy: account.config.groupPolicy ?? "allowlist",
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export function createLineConnectorAccountProvider(runtime) {
|
|
50
|
+
return {
|
|
51
|
+
provider: LINE_PROVIDER_ID,
|
|
52
|
+
label: "LINE",
|
|
53
|
+
listAccounts: async (_manager) => {
|
|
54
|
+
const enabled = listEnabledLineAccounts(runtime);
|
|
55
|
+
if (enabled.length > 0) {
|
|
56
|
+
return enabled.map(toConnectorAccount);
|
|
57
|
+
}
|
|
58
|
+
// Fall back to default account so single-account env-only deployments
|
|
59
|
+
// still surface in the manager. Status reflects token configuration.
|
|
60
|
+
const fallback = resolveLineAccount(runtime, DEFAULT_ACCOUNT_ID);
|
|
61
|
+
return [toConnectorAccount(fallback)];
|
|
62
|
+
},
|
|
63
|
+
createAccount: async (input, _manager) => {
|
|
64
|
+
return {
|
|
65
|
+
...input,
|
|
66
|
+
provider: LINE_PROVIDER_ID,
|
|
67
|
+
role: input.role ?? "AGENT",
|
|
68
|
+
purpose: input.purpose ?? ["messaging"],
|
|
69
|
+
accessGate: input.accessGate ?? "open",
|
|
70
|
+
status: input.status ?? "pending",
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
patchAccount: async (_accountId, patch, _manager) => {
|
|
74
|
+
return { ...patch, provider: LINE_PROVIDER_ID };
|
|
75
|
+
},
|
|
76
|
+
deleteAccount: async (_accountId, _manager) => {
|
|
77
|
+
// Provider-layer deletion returns cleanly; runtime credentials live in character
|
|
78
|
+
// settings; deletion of those is out of band.
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=connector-account-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector-account-provider.js","sourceRoot":"","sources":["../src/connector-account-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAElB,kBAAkB,GACnB,MAAM,eAAe,CAAC;AAEvB,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEvC,SAAS,iBAAiB,CAAC,QAA6B;IACtD,OAAO,CAAC,WAAW,CAAC,CAAC;AACvB,CAAC;AAED,SAAS,oBAAoB,CAAC,OAA4B;IACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;IACzC,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC7C,IAAI,QAAQ,KAAK,UAAU;QAAE,OAAO,UAAU,CAAC;IAC/C,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,cAAc,CAAC,QAA6B;IACnD,6DAA6D;IAC7D,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,kBAAkB,CAAC,OAA4B;IACtD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,OAAO;QACL,EAAE,EAAE,kBAAkB,CAAC,OAAO,CAAC,SAAS,CAAC;QACzC,QAAQ,EAAE,gBAAgB;QAC1B,KAAK,EAAE,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,SAAS;QACxC,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC;QAC7B,OAAO,EAAE,iBAAiB,CA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AAC,MAAM,IAAI,SAAS;aAClC,CAAC;QACJ,CAAC;QACD,YAAY,EAAE,KAAK,EACjB,UAAkB,EAClB,KAA4B,EAC5B,QAAiC,EACjC,EAAE;YACF,OAAO,EAAE,GAAG,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;QAClD,CAAC;QACD,aAAa,EAAE,KAAK,EAAE,UAAkB,EAAE,QAAiC,EAAE,EAAE;YAC7E,iFAAiF;YACjF,8CAA8C;QAChD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LINE Plugin for ElizaOS
|
|
3
|
+
*
|
|
4
|
+
* Provides LINE Messaging API integration for ElizaOS agents,
|
|
5
|
+
* supporting text, flex messages, locations, and more.
|
|
6
|
+
*/
|
|
7
|
+
import type { Plugin } from "@elizaos/core";
|
|
8
|
+
import { LineService } from "./service.js";
|
|
9
|
+
export { DEFAULT_ACCOUNT_ID, isLineMentionRequired, isLineUserAllowed, isMultiAccountEnabled, type LineAccountConfig, type LineGroupConfig, type LineMultiAccountConfig, type LineTokenResolution, type LineTokenSource, listEnabledLineAccounts, listLineAccountIds, normalizeAccountId, type ResolvedLineAccount, resolveDefaultLineAccountId, resolveLineAccount, resolveLineGroupConfig, resolveLineSecret, resolveLineToken, } from "./accounts.js";
|
|
10
|
+
export { buildLineDeepLink, type ChunkLineTextOpts, type CodeBlock, chunkLineText, extractCodeBlocks, extractLinks, extractMarkdownTables, formatCodeBlockAsText, formatLineUser, formatTableAsText, getChatId, getChatType, hasMarkdownContent, isGroupChat, LINE_MAX_REPLY_MESSAGES, LINE_TEXT_CHUNK_LIMIT, type MarkdownLink, type MarkdownTable, markdownToLineChunks, type ProcessedLineMessage, processLineMessage, resolveLineSystemLocation, stripMarkdown, truncateText, } from "./messaging.js";
|
|
11
|
+
export * from "./types.js";
|
|
12
|
+
export { LineService };
|
|
13
|
+
/**
|
|
14
|
+
* LINE plugin for ElizaOS agents.
|
|
15
|
+
*/
|
|
16
|
+
declare const linePlugin: Plugin;
|
|
17
|
+
export default linePlugin;
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAiB,MAAM,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAI3C,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,2BAA2B,EAC3B,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,uBAAuB,EACvB,qBAAqB,EACrB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,oBAAoB,EACpB,KAAK,oBAAoB,EACzB,kBAAkB,EAClB,yBAAyB,EACzB,aAAa,EACb,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB;;GAEG;AACH,QAAA,MAAM,UAAU,EAAE,MA4DjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LINE Plugin for ElizaOS
|
|
3
|
+
*
|
|
4
|
+
* Provides LINE Messaging API integration for ElizaOS agents,
|
|
5
|
+
* supporting text, flex messages, locations, and more.
|
|
6
|
+
*/
|
|
7
|
+
import { getConnectorAccountManager, logger } from "@elizaos/core";
|
|
8
|
+
import { createLineConnectorAccountProvider } from "./connector-account-provider.js";
|
|
9
|
+
import { LineService } from "./service.js";
|
|
10
|
+
import { LineWorkflowCredentialProvider } from "./workflow-credential-provider.js";
|
|
11
|
+
// Account management exports
|
|
12
|
+
export { DEFAULT_ACCOUNT_ID, isLineMentionRequired, isLineUserAllowed, isMultiAccountEnabled, listEnabledLineAccounts, listLineAccountIds, normalizeAccountId, resolveDefaultLineAccountId, resolveLineAccount, resolveLineGroupConfig, resolveLineSecret, resolveLineToken, } from "./accounts.js";
|
|
13
|
+
// Messaging utilities exports
|
|
14
|
+
export { buildLineDeepLink, chunkLineText, extractCodeBlocks, extractLinks, extractMarkdownTables, formatCodeBlockAsText, formatLineUser, formatTableAsText, getChatId, getChatType, hasMarkdownContent, isGroupChat, LINE_MAX_REPLY_MESSAGES, LINE_TEXT_CHUNK_LIMIT, markdownToLineChunks, processLineMessage, resolveLineSystemLocation, stripMarkdown, truncateText, } from "./messaging.js";
|
|
15
|
+
// Re-export types and service
|
|
16
|
+
export * from "./types.js";
|
|
17
|
+
export { LineService };
|
|
18
|
+
/**
|
|
19
|
+
* LINE plugin for ElizaOS agents.
|
|
20
|
+
*/
|
|
21
|
+
const linePlugin = {
|
|
22
|
+
name: "line",
|
|
23
|
+
description: "LINE Messaging API plugin for ElizaOS agents",
|
|
24
|
+
services: [LineService, LineWorkflowCredentialProvider],
|
|
25
|
+
actions: [],
|
|
26
|
+
providers: [],
|
|
27
|
+
tests: [],
|
|
28
|
+
async dispose(runtime) {
|
|
29
|
+
await runtime.getService(LineService.serviceType)?.stop();
|
|
30
|
+
await runtime
|
|
31
|
+
.getService(LineWorkflowCredentialProvider.serviceType)
|
|
32
|
+
?.stop();
|
|
33
|
+
},
|
|
34
|
+
init: async (config, runtime) => {
|
|
35
|
+
logger.info("Initializing LINE plugin...");
|
|
36
|
+
// Register the LINE provider with the ConnectorAccountManager so the HTTP
|
|
37
|
+
// CRUD surface (packages/agent/src/api/connector-account-routes.ts) can
|
|
38
|
+
// list, create, patch, and delete LINE accounts.
|
|
39
|
+
try {
|
|
40
|
+
const manager = getConnectorAccountManager(runtime);
|
|
41
|
+
manager.registerProvider(createLineConnectorAccountProvider(runtime));
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
logger.warn({
|
|
45
|
+
src: "plugin:line",
|
|
46
|
+
err: err instanceof Error ? err.message : String(err),
|
|
47
|
+
}, "Failed to register LINE provider with ConnectorAccountManager");
|
|
48
|
+
}
|
|
49
|
+
const hasAccessToken = Boolean(config.LINE_CHANNEL_ACCESS_TOKEN || process.env.LINE_CHANNEL_ACCESS_TOKEN);
|
|
50
|
+
const hasSecret = Boolean(config.LINE_CHANNEL_SECRET || process.env.LINE_CHANNEL_SECRET);
|
|
51
|
+
logger.info("LINE plugin configuration:");
|
|
52
|
+
logger.info(` - Access token configured: ${hasAccessToken ? "Yes" : "No"}`);
|
|
53
|
+
logger.info(` - Channel secret configured: ${hasSecret ? "Yes" : "No"}`);
|
|
54
|
+
logger.info(` - DM policy: ${config.LINE_DM_POLICY || process.env.LINE_DM_POLICY || "pairing"}`);
|
|
55
|
+
logger.info(` - Group policy: ${config.LINE_GROUP_POLICY || process.env.LINE_GROUP_POLICY || "allowlist"}`);
|
|
56
|
+
if (!hasAccessToken) {
|
|
57
|
+
logger.warn("LINE channel access token not configured. Set LINE_CHANNEL_ACCESS_TOKEN.");
|
|
58
|
+
}
|
|
59
|
+
if (!hasSecret) {
|
|
60
|
+
logger.warn("LINE channel secret not configured. Set LINE_CHANNEL_SECRET.");
|
|
61
|
+
}
|
|
62
|
+
logger.info("LINE plugin initialized");
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
export default linePlugin;
|
|
66
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,0BAA0B,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,kCAAkC,EAAE,MAAM,iCAAiC,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAEnF,6BAA6B;AAC7B,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EAMrB,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAElB,2BAA2B,EAC3B,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,8BAA8B;AAC9B,OAAO,EACL,iBAAiB,EAGjB,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,uBAAuB,EACvB,qBAAqB,EAGrB,oBAAoB,EAEpB,kBAAkB,EAClB,yBAAyB,EACzB,aAAa,EACb,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,8BAA8B;AAC9B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB;;GAEG;AACH,MAAM,UAAU,GAAW;IACzB,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,8CAA8C;IAE3D,QAAQ,EAAE,CAAC,WAAW,EAAE,8BAA8B,CAAC;IACvD,OAAO,EAAE,EAAE;IACX,SAAS,EAAE,EAAE;IACb,KAAK,EAAE,EAAE;IAET,KAAK,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