@0xmaxma/claude-gateway 1.3.16 → 1.3.18
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/config.template.json +8 -4
- package/dist/agent/builtin-commands.d.ts +1 -1
- package/dist/agent/builtin-commands.d.ts.map +1 -1
- package/dist/agent/builtin-commands.js +5 -0
- package/dist/agent/builtin-commands.js.map +1 -1
- package/dist/agent/line-pure.d.ts +31 -0
- package/dist/agent/line-pure.d.ts.map +1 -0
- package/dist/agent/line-pure.js +99 -0
- package/dist/agent/line-pure.js.map +1 -0
- package/dist/agent/line-reply-manager.d.ts +68 -0
- package/dist/agent/line-reply-manager.d.ts.map +1 -0
- package/dist/agent/line-reply-manager.js +383 -0
- package/dist/agent/line-reply-manager.js.map +1 -0
- package/dist/agent/runner.d.ts +11 -2
- package/dist/agent/runner.d.ts.map +1 -1
- package/dist/agent/runner.js +106 -8
- package/dist/agent/runner.js.map +1 -1
- package/dist/api/gateway-router.d.ts.map +1 -1
- package/dist/api/gateway-router.js +4 -0
- package/dist/api/gateway-router.js.map +1 -1
- package/dist/api/line-access.d.ts +60 -0
- package/dist/api/line-access.d.ts.map +1 -0
- package/dist/api/line-access.js +69 -0
- package/dist/api/line-access.js.map +1 -0
- package/dist/api/line-mention.d.ts +35 -0
- package/dist/api/line-mention.d.ts.map +1 -0
- package/dist/api/line-mention.js +33 -0
- package/dist/api/line-mention.js.map +1 -0
- package/dist/api/line-pending-senders.d.ts +40 -0
- package/dist/api/line-pending-senders.d.ts.map +1 -0
- package/dist/api/line-pending-senders.js +107 -0
- package/dist/api/line-pending-senders.js.map +1 -0
- package/dist/api/line-webhook-router.d.ts +51 -0
- package/dist/api/line-webhook-router.d.ts.map +1 -0
- package/dist/api/line-webhook-router.js +416 -0
- package/dist/api/line-webhook-router.js.map +1 -0
- package/dist/api/router.d.ts.map +1 -1
- package/dist/api/router.js +244 -7
- package/dist/api/router.js.map +1 -1
- package/dist/history/types.d.ts +1 -1
- package/dist/history/types.d.ts.map +1 -1
- package/dist/session/compactor.d.ts +1 -1
- package/dist/session/compactor.d.ts.map +1 -1
- package/dist/session/compactor.js.map +1 -1
- package/dist/session/process.d.ts +2 -2
- package/dist/session/process.d.ts.map +1 -1
- package/dist/session/process.js +14 -3
- package/dist/session/process.js.map +1 -1
- package/dist/session/store.d.ts +13 -13
- package/dist/session/store.d.ts.map +1 -1
- package/dist/session/store.js.map +1 -1
- package/dist/shell/claude-pty-shell.js +12 -0
- package/dist/shell/claude-pty-shell.js.map +1 -1
- package/dist/types.d.ts +60 -0
- package/dist/types.d.ts.map +1 -1
- package/mcp/bun.lock +9 -2
- package/mcp/package.json +1 -0
- package/mcp/server.ts +2 -0
- package/mcp/tools/line/module.ts +127 -0
- package/mcp/tools/line/pure.ts +62 -0
- package/mcp/tools/telegram/receiver-server.ts +8 -5
- package/package.json +2 -1
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.normalizeLineEvent = normalizeLineEvent;
|
|
37
|
+
exports.normalizeLinePostback = normalizeLinePostback;
|
|
38
|
+
exports.createLineWebhookRouter = createLineWebhookRouter;
|
|
39
|
+
/**
|
|
40
|
+
* LINE inbound webhook route (openclaw-style: LINE is webhook-only, no polling).
|
|
41
|
+
*
|
|
42
|
+
* Mounted on the gateway's Express app BEFORE express.json() so the raw request
|
|
43
|
+
* bytes are available for signature validation (LINE signs the raw body; a
|
|
44
|
+
* re-serialized parsed body would not match).
|
|
45
|
+
*
|
|
46
|
+
* Flow: verify x-line-signature → 200 → for each text message from a 1:1 user,
|
|
47
|
+
* show a loading animation and forward a normalized {content, meta} to the
|
|
48
|
+
* target agent's existing /channel callback (the same intake Telegram uses).
|
|
49
|
+
*/
|
|
50
|
+
const express_1 = __importStar(require("express"));
|
|
51
|
+
const fs = __importStar(require("fs"));
|
|
52
|
+
const os = __importStar(require("os"));
|
|
53
|
+
const path = __importStar(require("path"));
|
|
54
|
+
const bot_sdk_1 = require("@line/bot-sdk");
|
|
55
|
+
const logger_1 = require("../logger");
|
|
56
|
+
const line_access_1 = require("./line-access");
|
|
57
|
+
const line_pending_senders_1 = require("./line-pending-senders");
|
|
58
|
+
const line_mention_1 = require("./line-mention");
|
|
59
|
+
const DEFAULT_WEBHOOK_PATH = '/line/webhook';
|
|
60
|
+
const MAX_BODY_BYTES = 256 * 1024; // pre-auth body cap
|
|
61
|
+
const LOADING_SECONDS = 20; // 5..60, multiple of 5; 1:1 chats only
|
|
62
|
+
const MAX_IMAGE_BYTES = 20 * 1024 * 1024; // matches MediaStore.maxUploadBytes
|
|
63
|
+
/** Pick a file extension from an image's magic bytes; default jpg (LINE photos). */
|
|
64
|
+
function sniffImageExt(buf) {
|
|
65
|
+
if (buf.length >= 3 && buf[0] === 0xff && buf[1] === 0xd8 && buf[2] === 0xff)
|
|
66
|
+
return 'jpg';
|
|
67
|
+
if (buf.length >= 4 && buf[0] === 0x89 && buf[1] === 0x50 && buf[2] === 0x4e && buf[3] === 0x47)
|
|
68
|
+
return 'png';
|
|
69
|
+
if (buf.length >= 3 && buf[0] === 0x47 && buf[1] === 0x49 && buf[2] === 0x46)
|
|
70
|
+
return 'gif';
|
|
71
|
+
if (buf.length >= 12 &&
|
|
72
|
+
buf[8] === 0x57 && buf[9] === 0x45 && buf[10] === 0x42 && buf[11] === 0x50)
|
|
73
|
+
return 'webp';
|
|
74
|
+
return 'jpg';
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Fetch an inbound LINE image's bytes via the blob (data) API and write them to
|
|
78
|
+
* a temp file, returning its absolute path. The runner copies this into the
|
|
79
|
+
* agent's permanent MediaStore and tells the agent to Read it (meta.image_path).
|
|
80
|
+
* Returns null on failure; the turn still forwards (agent sees the text/empty).
|
|
81
|
+
*/
|
|
82
|
+
async function downloadLineImage(blobClient, messageId) {
|
|
83
|
+
const stream = await blobClient.getMessageContent(messageId);
|
|
84
|
+
const dest = path.join(os.tmpdir(), `line-img-${messageId}-${Date.now()}.tmp`);
|
|
85
|
+
const fileStream = fs.createWriteStream(dest);
|
|
86
|
+
let total = 0;
|
|
87
|
+
let ext = 'jpg';
|
|
88
|
+
let firstChunk = true;
|
|
89
|
+
for await (const chunk of stream) {
|
|
90
|
+
const b = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
91
|
+
total += b.length;
|
|
92
|
+
if (total > MAX_IMAGE_BYTES) {
|
|
93
|
+
stream.destroy?.();
|
|
94
|
+
fileStream.destroy();
|
|
95
|
+
fs.rmSync(dest, { force: true });
|
|
96
|
+
throw new Error(`image exceeds ${MAX_IMAGE_BYTES} byte cap`);
|
|
97
|
+
}
|
|
98
|
+
if (firstChunk) {
|
|
99
|
+
ext = sniffImageExt(b);
|
|
100
|
+
firstChunk = false;
|
|
101
|
+
}
|
|
102
|
+
fileStream.write(b);
|
|
103
|
+
}
|
|
104
|
+
await new Promise((resolve, reject) => fileStream.end((err) => err ? reject(err) : resolve()));
|
|
105
|
+
if (total === 0) {
|
|
106
|
+
fs.rmSync(dest, { force: true });
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
const finalDest = dest.replace(/\.tmp$/, `.${ext}`);
|
|
110
|
+
fs.renameSync(dest, finalDest);
|
|
111
|
+
return finalDest;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* One-time pairing-code message. The code is a VISUAL-MATCH token: the sender
|
|
115
|
+
* reports it to the admin, who matches it against the UI before adding them to
|
|
116
|
+
* the allowlist. The sender does NOT reply with it — say so explicitly so they
|
|
117
|
+
* don't paste it back expecting an automated unlock. Bilingual TH/EN.
|
|
118
|
+
*/
|
|
119
|
+
function pairingMessage(code, kind) {
|
|
120
|
+
const inGroup = kind === 'group' || kind === 'room';
|
|
121
|
+
const thWhere = inGroup ? 'ในกลุ่มนี้' : '';
|
|
122
|
+
const enWhere = inGroup ? ' in this group' : '';
|
|
123
|
+
return (`รหัสจับคู่ (pairing code) ของคุณคือ: ${code}\n` +
|
|
124
|
+
`กรุณาแจ้งรหัสนี้ให้แอดมินเพื่อขอเปิดใช้งานบอท${thWhere} (ไม่ต้องพิมพ์รหัสตอบกลับ)\n\n` +
|
|
125
|
+
`Your pairing code: ${code}\n` +
|
|
126
|
+
`Share this code with the admin to get access${enWhere}. (No need to reply with it.)`);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Normalize a LINE webhook event into the gateway's {content, meta} intake shape.
|
|
130
|
+
* Returns null for anything we don't handle in the POC (non-text, non-user source).
|
|
131
|
+
*
|
|
132
|
+
* `resolved` lets the caller pass the source it already resolved for the access
|
|
133
|
+
* gate, so a single event isn't re-parsed; omitted, it resolves here.
|
|
134
|
+
*/
|
|
135
|
+
function normalizeLineEvent(event, resolved) {
|
|
136
|
+
if (event.type !== 'message')
|
|
137
|
+
return null;
|
|
138
|
+
const msg = event.message;
|
|
139
|
+
// Text and image are handled; image bytes are fetched separately in handlePost
|
|
140
|
+
// (via the LINE blob API) and surfaced to the agent through meta.image_path.
|
|
141
|
+
if (!msg || (msg.type !== 'text' && msg.type !== 'image'))
|
|
142
|
+
return null;
|
|
143
|
+
// Accept 1:1 user, group, and room sources. chat_id is the conversation key
|
|
144
|
+
// (userId / groupId / roomId — the reply/push target); user_id is the human
|
|
145
|
+
// who sent it (may be absent in groups → falls back to the conversation id).
|
|
146
|
+
const { conversationId, senderId, kind } = resolved ?? (0, line_access_1.resolveLineSource)(event.source);
|
|
147
|
+
if (kind === 'other' || !conversationId)
|
|
148
|
+
return null;
|
|
149
|
+
const sender = senderId || conversationId;
|
|
150
|
+
const text = msg.type === 'text' ? (msg.text ?? '') : '';
|
|
151
|
+
const meta = {
|
|
152
|
+
source: 'line',
|
|
153
|
+
chat_id: conversationId,
|
|
154
|
+
user_id: sender,
|
|
155
|
+
user: sender,
|
|
156
|
+
message_id: String(msg.id ?? ''),
|
|
157
|
+
ts: new Date(event.timestamp ?? Date.now()).toISOString(),
|
|
158
|
+
line_chat_type: kind, // 'user' | 'group' | 'room'
|
|
159
|
+
};
|
|
160
|
+
if (msg.type === 'image')
|
|
161
|
+
meta.media_type = 'image';
|
|
162
|
+
if (typeof event.replyToken === 'string') {
|
|
163
|
+
meta.reply_token = event.replyToken;
|
|
164
|
+
}
|
|
165
|
+
return { content: text, meta };
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Normalize a LINE postback event (the slow-LLM "Get answer" button tap) into
|
|
169
|
+
* {chatId, replyToken, data}. Returns null for non-postback / non-user / tokenless
|
|
170
|
+
* events. `normalizeLineEvent` still drops postbacks; this is handled separately.
|
|
171
|
+
*/
|
|
172
|
+
function normalizeLinePostback(event) {
|
|
173
|
+
if (event.type !== 'postback')
|
|
174
|
+
return null;
|
|
175
|
+
const source = event.source;
|
|
176
|
+
if (!source)
|
|
177
|
+
return null;
|
|
178
|
+
const pe = event;
|
|
179
|
+
const data = pe.postback?.data ?? '';
|
|
180
|
+
const replyToken = typeof pe.replyToken === 'string' ? pe.replyToken : '';
|
|
181
|
+
if (!data || !replyToken)
|
|
182
|
+
return null;
|
|
183
|
+
let chatId;
|
|
184
|
+
if (source.type === 'user') {
|
|
185
|
+
if (!source.userId)
|
|
186
|
+
return null;
|
|
187
|
+
chatId = source.userId;
|
|
188
|
+
}
|
|
189
|
+
else if (source.type === 'group') {
|
|
190
|
+
if (!source.groupId)
|
|
191
|
+
return null;
|
|
192
|
+
chatId = source.groupId;
|
|
193
|
+
}
|
|
194
|
+
else if (source.type === 'room') {
|
|
195
|
+
if (!source.roomId)
|
|
196
|
+
return null;
|
|
197
|
+
chatId = source.roomId;
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
return { chatId, replyToken, data };
|
|
203
|
+
}
|
|
204
|
+
/** Find the agent that has LINE configured (POC: single line-enabled agent, or by id). */
|
|
205
|
+
function resolveLineAgent(agents, agentId) {
|
|
206
|
+
if (agentId) {
|
|
207
|
+
const r = agents.get(agentId);
|
|
208
|
+
return r && r.getAgentConfig().line?.channelSecret ? r : null;
|
|
209
|
+
}
|
|
210
|
+
for (const runner of agents.values()) {
|
|
211
|
+
if (runner.getAgentConfig().line?.channelSecret)
|
|
212
|
+
return runner;
|
|
213
|
+
}
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
function createLineWebhookRouter(agents, logDir, opts = {}) {
|
|
217
|
+
const router = (0, express_1.Router)();
|
|
218
|
+
const logger = (0, logger_1.createLogger)('line-webhook', logDir);
|
|
219
|
+
const rawBody = express_1.default.raw({ type: '*/*', limit: MAX_BODY_BYTES });
|
|
220
|
+
// LINE webhook URL verification (Console "Verify" sends a GET / empty POST).
|
|
221
|
+
const handleGet = (_req, res) => {
|
|
222
|
+
res.status(200).json({ ok: true });
|
|
223
|
+
};
|
|
224
|
+
const handlePost = async (req, res) => {
|
|
225
|
+
const agentId = req.params.agentId;
|
|
226
|
+
const runner = resolveLineAgent(agents, agentId);
|
|
227
|
+
if (!runner) {
|
|
228
|
+
res.status(404).json({ error: 'no LINE-enabled agent' });
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
const cfg = runner.getAgentConfig().line;
|
|
232
|
+
const secret = cfg?.channelSecret ?? '';
|
|
233
|
+
const signature = req.header('x-line-signature') ?? '';
|
|
234
|
+
const buf = Buffer.isBuffer(req.body) ? req.body : Buffer.from('');
|
|
235
|
+
if (!secret || !signature || !(0, bot_sdk_1.validateSignature)(buf, secret, signature)) {
|
|
236
|
+
logger.warn('LINE webhook rejected: bad signature', { agentId: runner.getAgentConfig().id });
|
|
237
|
+
res.status(401).json({ error: 'invalid signature' });
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
// Acknowledge immediately; process events after responding.
|
|
241
|
+
res.status(200).json({ ok: true });
|
|
242
|
+
let events = [];
|
|
243
|
+
try {
|
|
244
|
+
events = JSON.parse(buf.toString('utf8')).events ?? [];
|
|
245
|
+
}
|
|
246
|
+
catch (err) {
|
|
247
|
+
logger.warn('LINE webhook: bad JSON', { error: err.message });
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
const token = cfg?.channelAccessToken ?? '';
|
|
251
|
+
const client = token
|
|
252
|
+
? new bot_sdk_1.messagingApi.MessagingApiClient({
|
|
253
|
+
channelAccessToken: token,
|
|
254
|
+
...(opts.apiBase ? { baseURL: opts.apiBase } : {}),
|
|
255
|
+
})
|
|
256
|
+
: null;
|
|
257
|
+
// Blob/data API lives on a different host (api-data.line.me) than the
|
|
258
|
+
// messaging API, so it takes its own base override (used by tests).
|
|
259
|
+
const blobClient = token
|
|
260
|
+
? new bot_sdk_1.messagingApi.MessagingApiBlobClient({
|
|
261
|
+
channelAccessToken: token,
|
|
262
|
+
...(opts.dataApiBase ? { baseURL: opts.dataApiBase } : {}),
|
|
263
|
+
})
|
|
264
|
+
: null;
|
|
265
|
+
for (const event of events) {
|
|
266
|
+
// Postback BEFORE access gate: a tap on our slow-LLM button must reach the
|
|
267
|
+
// cache even if the user's allowlist status changed since the button was sent.
|
|
268
|
+
// The postback data is opaque (request_id we issued), so bypassing the gate here
|
|
269
|
+
// is safe — only users who received the button can tap it.
|
|
270
|
+
const pb = normalizeLinePostback(event);
|
|
271
|
+
if (pb) {
|
|
272
|
+
try {
|
|
273
|
+
await runner.handleLinePostback(pb.chatId, pb.replyToken, pb.data);
|
|
274
|
+
}
|
|
275
|
+
catch (err) {
|
|
276
|
+
logger.error('LINE webhook: postback handling failed', {
|
|
277
|
+
error: err.message,
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
// Access gate (single choke point — mirrors hermes _dispatch_event):
|
|
283
|
+
// resolve the source once and gate before any message handling.
|
|
284
|
+
// Closed by default for both DMs (dmPolicy/dmAllowlist) and groups/rooms
|
|
285
|
+
// (groupPolicy/groupAllowlist). `'open'` restores answer-to-anyone.
|
|
286
|
+
const resolved = (0, line_access_1.resolveLineSource)(event.source);
|
|
287
|
+
if (!(0, line_access_1.isResolvedSourceAllowed)(cfg, resolved)) {
|
|
288
|
+
logger.debug('LINE webhook: source not allowed', {
|
|
289
|
+
agentId: runner.getAgentConfig().id,
|
|
290
|
+
kind: resolved.kind,
|
|
291
|
+
policy: (resolved.kind === 'user' ? cfg?.dmPolicy : cfg?.groupPolicy) ?? '(closed)',
|
|
292
|
+
conversationId: resolved.conversationId,
|
|
293
|
+
});
|
|
294
|
+
// Remember the knock so an admin can find + add it from the UI without
|
|
295
|
+
// grepping logs, and (pairing mode) reply a one-time code the admin can
|
|
296
|
+
// visually match before +Add. The id we track is the sender (DM) or the
|
|
297
|
+
// conversation (group/room). Names are backfilled best-effort without
|
|
298
|
+
// bumping the knock count.
|
|
299
|
+
const deniedAgentId = runner.getAgentConfig().id;
|
|
300
|
+
const knockId = resolved.kind === 'user' ? resolved.senderId : resolved.conversationId;
|
|
301
|
+
if (knockId) {
|
|
302
|
+
// Pairing applies only under allowlist/closed-default (open never
|
|
303
|
+
// denies; disabled is hard-off) and unless explicitly turned off.
|
|
304
|
+
const sourcePolicy = resolved.kind === 'user' ? cfg?.dmPolicy : cfg?.groupPolicy;
|
|
305
|
+
const isPairing = cfg?.pairing !== false && sourcePolicy !== 'open' && sourcePolicy !== 'disabled';
|
|
306
|
+
const prev = (0, line_pending_senders_1.getPendingSender)(deniedAgentId, knockId);
|
|
307
|
+
const code = prev?.code ?? (isPairing ? (0, line_pending_senders_1.generatePairingCode)() : undefined);
|
|
308
|
+
let wasNew = false;
|
|
309
|
+
if (resolved.kind === 'user') {
|
|
310
|
+
wasNew = (0, line_pending_senders_1.recordDeniedSender)(deniedAgentId, knockId, undefined, Date.now(), code);
|
|
311
|
+
if (client) {
|
|
312
|
+
void client
|
|
313
|
+
.getProfile(knockId)
|
|
314
|
+
.then((p) => {
|
|
315
|
+
const e = (0, line_pending_senders_1.getPendingSender)(deniedAgentId, knockId);
|
|
316
|
+
if (e && p?.displayName && !e.displayName)
|
|
317
|
+
e.displayName = p.displayName;
|
|
318
|
+
})
|
|
319
|
+
.catch(() => { });
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
else if (resolved.kind === 'group') {
|
|
323
|
+
wasNew = (0, line_pending_senders_1.recordDeniedConversation)(deniedAgentId, knockId, 'group', undefined, Date.now(), code);
|
|
324
|
+
if (client) {
|
|
325
|
+
void client
|
|
326
|
+
.getGroupSummary(knockId)
|
|
327
|
+
.then((s) => {
|
|
328
|
+
const e = (0, line_pending_senders_1.getPendingSender)(deniedAgentId, knockId);
|
|
329
|
+
if (e && s?.groupName && !e.displayName)
|
|
330
|
+
e.displayName = s.groupName;
|
|
331
|
+
})
|
|
332
|
+
.catch(() => { });
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
else if (resolved.kind === 'room') {
|
|
336
|
+
wasNew = (0, line_pending_senders_1.recordDeniedConversation)(deniedAgentId, knockId, 'room', undefined, Date.now(), code);
|
|
337
|
+
}
|
|
338
|
+
// Send the pairing code exactly once — on first contact only — via the
|
|
339
|
+
// free reply token (never push; don't spend quota on strangers).
|
|
340
|
+
const replyToken = event.replyToken;
|
|
341
|
+
if (isPairing && wasNew && code && client && typeof replyToken === 'string' && replyToken) {
|
|
342
|
+
void client
|
|
343
|
+
.replyMessage({
|
|
344
|
+
replyToken,
|
|
345
|
+
messages: [{ type: 'text', text: pairingMessage(code, resolved.kind) }],
|
|
346
|
+
})
|
|
347
|
+
.catch((err) => logger.debug('LINE pairing code reply failed', { error: err.message }));
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
// Normalize the event into our /channel intake format.
|
|
353
|
+
const norm = normalizeLineEvent(event, resolved);
|
|
354
|
+
if (!norm)
|
|
355
|
+
continue;
|
|
356
|
+
const userId = norm.meta.chat_id;
|
|
357
|
+
// Group/room activation gate: unless requireMention is explicitly false,
|
|
358
|
+
// only respond when the bot is @mentioned (native isSelf or its name).
|
|
359
|
+
// DMs (line_chat_type === 'user') always pass. This runs after normalize
|
|
360
|
+
// so non-message / non-text-image events are already filtered out.
|
|
361
|
+
if (norm.meta.line_chat_type !== 'user' && cfg?.requireMention !== false) {
|
|
362
|
+
const msg = event.message;
|
|
363
|
+
if (!(0, line_mention_1.wasBotMentioned)(msg)) {
|
|
364
|
+
logger.debug('LINE webhook: group/room message without bot mention, ignoring', {
|
|
365
|
+
agentId: runner.getAgentConfig().id,
|
|
366
|
+
chatType: norm.meta.line_chat_type,
|
|
367
|
+
conversationId: userId,
|
|
368
|
+
});
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
// Inbound image: fetch the bytes via the blob API and hand the agent an
|
|
373
|
+
// absolute path (meta.image_path). The runner persists it to MediaStore
|
|
374
|
+
// and instructs the agent to Read it, same as Telegram attachments.
|
|
375
|
+
if (norm.meta.media_type === 'image' && blobClient && norm.meta.message_id) {
|
|
376
|
+
try {
|
|
377
|
+
const imgPath = await downloadLineImage(blobClient, norm.meta.message_id);
|
|
378
|
+
if (imgPath)
|
|
379
|
+
norm.meta.image_path = imgPath;
|
|
380
|
+
}
|
|
381
|
+
catch (err) {
|
|
382
|
+
logger.warn('LINE webhook: image download failed', {
|
|
383
|
+
messageId: norm.meta.message_id,
|
|
384
|
+
error: err.message,
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
// Loading animation (best-effort, 1:1 only — LINE rejects it for
|
|
389
|
+
// groups/rooms, where chat_id is a groupId/roomId).
|
|
390
|
+
if (client && norm.meta.line_chat_type === 'user') {
|
|
391
|
+
client
|
|
392
|
+
.showLoadingAnimation({ chatId: userId, loadingSeconds: LOADING_SECONDS })
|
|
393
|
+
.catch((err) => logger.debug('showLoadingAnimation failed', { error: err.message }));
|
|
394
|
+
}
|
|
395
|
+
// Forward to the agent's existing /channel intake (same path Telegram uses).
|
|
396
|
+
try {
|
|
397
|
+
await fetch(`http://127.0.0.1:${runner.getCallbackPort()}/channel`, {
|
|
398
|
+
method: 'POST',
|
|
399
|
+
headers: { 'Content-Type': 'application/json' },
|
|
400
|
+
body: JSON.stringify(norm),
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
catch (err) {
|
|
404
|
+
logger.error('LINE webhook: failed to forward to callback', {
|
|
405
|
+
error: err.message,
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
router.get(DEFAULT_WEBHOOK_PATH, handleGet);
|
|
411
|
+
router.get(`${DEFAULT_WEBHOOK_PATH}/:agentId`, handleGet);
|
|
412
|
+
router.post(DEFAULT_WEBHOOK_PATH, rawBody, (req, res) => void handlePost(req, res));
|
|
413
|
+
router.post(`${DEFAULT_WEBHOOK_PATH}/:agentId`, rawBody, (req, res) => void handlePost(req, res));
|
|
414
|
+
return router;
|
|
415
|
+
}
|
|
416
|
+
//# sourceMappingURL=line-webhook-router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line-webhook-router.js","sourceRoot":"","sources":["../../src/api/line-webhook-router.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiHA,gDA+BC;AASD,sDAwBC;AA6BD,0DAuNC;AAraD;;;;;;;;;;GAUG;AACH,mDAAuE;AACvE,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,2CAA8E;AAE9E,sCAAyC;AACzC,+CAIuB;AACvB,iEAKgC;AAChC,iDAAuE;AAEvE,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAC7C,MAAM,cAAc,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,oBAAoB;AACvD,MAAM,eAAe,GAAG,EAAE,CAAC,CAAC,uCAAuC;AACnE,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,oCAAoC;AAE9E,oFAAoF;AACpF,SAAS,aAAa,CAAC,GAAW;IAChC,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;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AAE,SAAS,CAAC,CAAC;IAC1D,MAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,KAAK,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IACpF,MAAM,CAAC,IAAI,CAAC,GAAG,oBAAoB,WAAW,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,KAAK,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IAElG,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/api/router.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/api/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,SAAS,CAAC;AAOpD,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/api/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,SAAS,CAAC;AAOpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAe,MAAM,UAAU,CAAC;AAyLzE,wBAAgB,eAAe,CAC7B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,EACtC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,EACtC,OAAO,EAAE,MAAM,EAAE,EACjB,UAAU,CAAC,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,WAAW,EAAE,GACrB,MAAM,CAkxER"}
|