dsh-line-bot 0.9.3 → 0.9.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.4
4
+
5
+ - 修正主動訊息(排程傳訊、餘額提醒、核准通知)只更新計數、沒有真的呼叫 LINE push API 的問題;現在會實際送出,失敗時不再累加次數。
6
+ - 主動訊息送出後記錄 LINE 回應的訊息數,方便日後從日誌確認。
7
+
3
8
  ## 0.9.3
4
9
 
5
10
  - 身分門控改為預設關閉:白名單為空時,任何人都不能觸發 Agent;未授權的 LINE 使用者只會進入「待審核」佇列,不會建立 session、不會呼叫工具。
package/lib/host.mjs CHANGED
@@ -47,7 +47,7 @@ const { createStickerImages } = stickerImageMod
47
47
  const { createVision } = visionMod
48
48
  const { chunkText, clip, inQuietWindow, jsonFail, jsonOk, maskSecret, readJsonBody, safeArray, sleep, readJsonSafe } = utilMod
49
49
 
50
- export const VERSION = '0.9.3'
50
+ export const VERSION = '0.9.4'
51
51
 
52
52
  // 環境變數提供的 Cloudflare API Token(方便用 shell 注入、不用把 token 寫進設定檔)。
53
53
  // 設定檔裡的 token 優先;兩者都沒有時才用環境變數。
@@ -1858,9 +1858,11 @@ export async function create({ ctx, config: pluginConfig, logger: upstream }) {
1858
1858
 
1859
1859
  async function sendPush(userId, text) {
1860
1860
  const { messages } = await buildOutgoingMessages(text)
1861
- if (messages.length === 0) return
1861
+ if (messages.length === 0) return { sent: false, reason: 'empty' }
1862
1862
  const imageCount = messages.filter((item) => typeof item !== 'string' && item.type === 'image').length
1863
1863
  if (imageCount > 0) logger.info(`主動訊息含 ${imageCount} 張圖片`)
1864
+ const response = await withToken((token) => lineApi.pushMessage(token, userId, messages))
1865
+ logger.info(`主動訊息已送出(${messages.length} 則,LINE 回報 ${Array.isArray(response?.sentMessages) ? response.sentMessages.length : '未知'} 則)`)
1864
1866
  store.updateState((state) => ({
1865
1867
  ...state,
1866
1868
  users: {
@@ -1868,6 +1870,7 @@ export async function create({ ctx, config: pluginConfig, logger: upstream }) {
1868
1870
  [userId]: { ...(state.users[userId] || {}), lastAt: Date.now(), lastPushAt: Date.now() },
1869
1871
  },
1870
1872
  }))
1873
+ return { sent: true, count: messages.length, requestId: response?.requestId || '' }
1871
1874
  }
1872
1875
 
1873
1876
  const nudge = createNudgeScheduler({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-line-bot",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "description": "把 LINE 官方帳號(Messaging API)接進 DeepSeek Harness 的插件:內建 Cloudflare Tunnel、人設選擇(大肥魚或插件自訂)、主動傳訊與完整設定面板。",
5
5
  "type": "module",
6
6
  "main": "index.js",