tabclaw 0.1.0 → 0.1.1

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.
@@ -5019,25 +5019,6 @@ var BaseChannel = class {
5019
5019
  sender
5020
5020
  });
5021
5021
  }
5022
- /**
5023
- * 检查发送者是否有权限
5024
- * 权限检查逻辑:
5025
- * - 如果 allowFrom 为空或未配置,拒绝所有
5026
- * - 如果 allowFrom 包含 "*",允许所有
5027
- * - 否则检查 senderId 是否在 allowFrom 列表中
5028
- * @param senderId - 发送者ID
5029
- * @returns 是否有权限
5030
- */
5031
- isAllowed(senderId) {
5032
- const allowList = this.config.allowFrom;
5033
- if (!allowList || allowList.length === 0) {
5034
- return false;
5035
- }
5036
- if (allowList.includes("*")) {
5037
- return true;
5038
- }
5039
- return allowList.includes(senderId);
5040
- }
5041
5022
  /**
5042
5023
  * 检查是否应该处理某类通知
5043
5024
  * @param eventType - 事件类型 (session_start, session_end, permission_request, finished, error)
@@ -5244,6 +5225,20 @@ var TelegramChannel = class extends (_a = BaseChannel) {
5244
5225
  this.formatter = new TelegramFormatter();
5245
5226
  this.allowedUsers = new Set(telegramConfig.allowed_users || []);
5246
5227
  }
5228
+ /**
5229
+ * 检查发送者是否有权限
5230
+ * @param senderId - 发送者ID
5231
+ * @returns 是否有权限
5232
+ */
5233
+ isAllowed(senderId) {
5234
+ if (this.allowedUsers.size === 0) {
5235
+ return false;
5236
+ }
5237
+ if (this.allowedUsers.has("*")) {
5238
+ return true;
5239
+ }
5240
+ return this.allowedUsers.has(senderId);
5241
+ }
5247
5242
  /**
5248
5243
  * 启动 Channel
5249
5244
  * 启动 Bot 并订阅权限申请事件
@@ -5519,6 +5514,12 @@ var LoggerChannel = class extends (_a2 = BaseChannel) {
5519
5514
  super(config, bus, logger4);
5520
5515
  this.messageLogger = getLogger().child({ channel: "logger" });
5521
5516
  }
5517
+ /**
5518
+ * Logger Channel 不接收消息,拒绝所有发送者
5519
+ */
5520
+ isAllowed(_senderId) {
5521
+ return false;
5522
+ }
5522
5523
  async start() {
5523
5524
  await super.start();
5524
5525
  this.logger.info("Logger channel started");
@@ -5554,6 +5555,12 @@ var FeishuChannel = class extends (_a3 = BaseChannel) {
5554
5555
  constructor(config, bus, logger4) {
5555
5556
  super(config, bus, logger4);
5556
5557
  }
5558
+ /**
5559
+ * Feishu Channel 骨架实现,暂不支持接收消息
5560
+ */
5561
+ isAllowed(_senderId) {
5562
+ return false;
5563
+ }
5557
5564
  async start() {
5558
5565
  await super.start();
5559
5566
  this.logger.info("Feishu channel started (skeleton)");
@@ -5588,6 +5595,16 @@ async function main() {
5588
5595
  process.exit(1);
5589
5596
  }
5590
5597
  logger4.info(`Loaded hook token: ${hookToken.substring(0, 8)}...`);
5598
+ if (pidFilePath) {
5599
+ writePidFile(pidFilePath, {
5600
+ pid: process.pid,
5601
+ port,
5602
+ startedAt: (/* @__PURE__ */ new Date()).toISOString(),
5603
+ version: VERSION3,
5604
+ token: hookToken
5605
+ });
5606
+ logger4.info(`PID file written to: ${pidFilePath}`);
5607
+ }
5591
5608
  const httpServer = new HttpServer(port);
5592
5609
  const wsServer = new WebSocketServer(httpServer, { path: "/ws" });
5593
5610
  const sessionManager = new SessionManager();
@@ -5654,16 +5671,6 @@ async function main() {
5654
5671
  const adapter = new ClaudeHookAdapter();
5655
5672
  setupRoutes(httpServer, sessionManager, gateway, adapter, () => wsServer.getClientCount());
5656
5673
  setupWebSocketHandlers(wsServer, sessionManager, { permissionQueue });
5657
- if (pidFilePath) {
5658
- writePidFile(pidFilePath, {
5659
- pid: process.pid,
5660
- port,
5661
- startedAt: (/* @__PURE__ */ new Date()).toISOString(),
5662
- version: VERSION3,
5663
- token: hookToken
5664
- });
5665
- logger4.info(`PID file written to: ${pidFilePath}`);
5666
- }
5667
5674
  const shutdown = async (signal) => {
5668
5675
  logger4.info(`Received ${signal}, shutting down gracefully...`);
5669
5676
  notificationHandler.stop();