chatlab-cli 0.37.2 → 0.37.3

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.
Files changed (146) hide show
  1. package/dist/{chat-command-G2EX7VHR.mjs → chat-command-RQC44FPF.mjs} +37 -9
  2. package/dist/chat-command-RQC44FPF.mjs.map +1 -0
  3. package/dist/{chunk-YI3EQYEG.mjs → chunk-4FAEB4C2.mjs} +12 -12
  4. package/dist/{chunk-HMVM7VCA.mjs → chunk-5OA4QI3Q.mjs} +3 -3
  5. package/dist/{chunk-EK5QIJLZ.mjs → chunk-E2ZFGNZQ.mjs} +11 -11
  6. package/dist/{chunk-F4HVCFZL.mjs → chunk-E6IRRNBQ.mjs} +3 -3
  7. package/dist/{chunk-FCUUAGGC.mjs → chunk-GDKQKHJT.mjs} +2 -2
  8. package/dist/{chunk-H46CLFWK.mjs → chunk-HJWBFHNR.mjs} +4 -4
  9. package/dist/{chunk-L6RJIVLS.mjs → chunk-IDDTW5JN.mjs} +313 -24
  10. package/dist/chunk-IDDTW5JN.mjs.map +1 -0
  11. package/dist/{chunk-E6LCCPIB.mjs → chunk-IMJVOODY.mjs} +2 -2
  12. package/dist/{chunk-T5H56AZV.mjs → chunk-LUENE6L7.mjs} +13 -11
  13. package/dist/chunk-LUENE6L7.mjs.map +1 -0
  14. package/dist/{chunk-XQ6Z2KNN.mjs → chunk-O57SQSCO.mjs} +2 -2
  15. package/dist/{chunk-EFX66A2O.mjs → chunk-ZGXXAPLX.mjs} +2 -2
  16. package/dist/{chunk-HBAQPF6X.mjs → chunk-ZOHSWBD2.mjs} +104 -55
  17. package/dist/chunk-ZOHSWBD2.mjs.map +1 -0
  18. package/dist/cli.mjs +9 -9
  19. package/dist/contacts-worker.mjs +2 -2
  20. package/dist/global-insight-worker.mjs +1 -1
  21. package/dist/{http-5BRVWAJR.mjs → http-QJDZKDNJ.mjs} +12 -12
  22. package/dist/{import-IAECQDKC.mjs → import-XK6YM26A.mjs} +7 -7
  23. package/dist/index.mjs +12 -12
  24. package/dist/{mcp-XXSQJBGU.mjs → mcp-DMGZFSYN.mjs} +24 -17
  25. package/dist/mcp-DMGZFSYN.mjs.map +1 -0
  26. package/dist/people-relationships-worker.mjs +2 -2
  27. package/dist/semantic-index-worker.mjs +1 -1
  28. package/dist/{src-4HLKMQ7S.mjs → src-4AHJUFCW.mjs} +6 -6
  29. package/dist/{stream-import-PUG42I36.mjs → stream-import-7VQVT5ST.mjs} +7 -7
  30. package/dist/{worker-runtime-X5563TVT.mjs → worker-runtime-PQBAV75N.mjs} +5 -5
  31. package/dist-cli-web/assets/{AISettingsTab-m_r2fFEj.js → AISettingsTab-qS3XKnvh.js} +1 -1
  32. package/dist-cli-web/assets/{AboutTab-J65UqIuk.js → AboutTab-K-i40dPv.js} +1 -1
  33. package/dist-cli-web/assets/{Alert-qBIGn_CW.js → Alert-GSvA5B7J.js} +1 -1
  34. package/dist-cli-web/assets/{ApiSettingsTab-CxWRJI9j.js → ApiSettingsTab-DIVGTR3g.js} +1 -1
  35. package/dist-cli-web/assets/{BatchManageTab-BINNVwm1.js → BatchManageTab-CJhwvYWV.js} +1 -1
  36. package/dist-cli-web/assets/{BufferResource-C-jLPrHv.js → BufferResource-Cjm0m7sF.js} +1 -1
  37. package/dist-cli-web/assets/{CanvasRenderer-kDLW8GSt.js → CanvasRenderer-C-fmrahh.js} +1 -1
  38. package/dist-cli-web/assets/{CardDecoration-CnYxleQM.js → CardDecoration-Cz54ZPyh.js} +1 -1
  39. package/dist-cli-web/assets/{ChatRecordDrawer-CMg3FEWH.js → ChatRecordDrawer-Cst8zTUv.js} +1 -1
  40. package/dist-cli-web/assets/{ChatRecordWorkspace-AfFIMUbZ.js → ChatRecordWorkspace-DKVKaimw.js} +1 -1
  41. package/dist-cli-web/assets/{Checkbox-D-hAv15R.js → Checkbox-CrlY3jiJ.js} +1 -1
  42. package/dist-cli-web/assets/{DataDirCleanupNotice-P80h2p4l.js → DataDirCleanupNotice-Cjqiub4e.js} +1 -1
  43. package/dist-cli-web/assets/{DatePicker.vue_vue_type_script_setup_true_lang-CSp691Uv.js → DatePicker.vue_vue_type_script_setup_true_lang-BYY2UmPA.js} +1 -1
  44. package/dist-cli-web/assets/{DebugToolsPanel-BK2VbKB0.js → DebugToolsPanel-I00RV_Lr.js} +1 -1
  45. package/dist-cli-web/assets/{EChart.vue_vue_type_script_setup_true_lang-BcE0mE_N.js → EChart.vue_vue_type_script_setup_true_lang-CRTZh9kh.js} +1 -1
  46. package/dist-cli-web/assets/{EChartBar.vue_vue_type_script_setup_true_lang-BypaV5wc.js → EChartBar.vue_vue_type_script_setup_true_lang-DjDFhnN9.js} +1 -1
  47. package/dist-cli-web/assets/{EChartLine.vue_vue_type_script_setup_true_lang-D8SyOfWC.js → EChartLine.vue_vue_type_script_setup_true_lang-BLqlW9E4.js} +1 -1
  48. package/dist-cli-web/assets/{EChartWordcloud-0rihhg03.js → EChartWordcloud-ChKJM8bU.js} +1 -1
  49. package/dist-cli-web/assets/{FileDropZone.vue_vue_type_script_setup_true_lang-Dyuzh7Ex.js → FileDropZone.vue_vue_type_script_setup_true_lang-CsRmQhVQ.js} +1 -1
  50. package/dist-cli-web/assets/{Filter-rD_jWpbO.js → Filter-Duzxgudo.js} +1 -1
  51. package/dist-cli-web/assets/{GlobalTaskBar-sXQuGvF-.js → GlobalTaskBar-DL0IJxlt.js} +1 -1
  52. package/dist-cli-web/assets/{GroupRelationshipGalaxyView-BN1L9DFf.js → GroupRelationshipGalaxyView-BZrB2o2g.js} +1 -1
  53. package/dist-cli-web/assets/{Label-Ce4wl_Ph.js → Label-CaVKlQnJ.js} +1 -1
  54. package/dist-cli-web/assets/{LoadingState.vue_vue_type_script_setup_true_lang-DmVfwvnD.js → LoadingState.vue_vue_type_script_setup_true_lang-uF54r-dT.js} +1 -1
  55. package/dist-cli-web/assets/{MessageExportModal-C2IUNPhg.js → MessageExportModal-JpurBsUW.js} +1 -1
  56. package/dist-cli-web/assets/{PageHeader-D5BcYKBs.js → PageHeader-BciykZ_-.js} +1 -1
  57. package/dist-cli-web/assets/{PageTabs.vue_vue_type_script_setup_true_lang-DHly2-fe.js → PageTabs.vue_vue_type_script_setup_true_lang-2Xe2iUFO.js} +1 -1
  58. package/dist-cli-web/assets/{RelationshipGalaxyCanvas-CHPqtqQz.js → RelationshipGalaxyCanvas-BO5-MowG.js} +3 -3
  59. package/dist-cli-web/assets/{RelationshipGalaxyThreeCanvas-qR4S-9n7.js → RelationshipGalaxyThreeCanvas-Dp4CcWU5.js} +1 -1
  60. package/dist-cli-web/assets/{RenderTargetSystem-BaIFulUj.js → RenderTargetSystem-CfuoUG_y.js} +1 -1
  61. package/dist-cli-web/assets/{RovingFocusItem-Bqgmzo42.js → RovingFocusItem-FpYwYEP_.js} +1 -1
  62. package/dist-cli-web/assets/{ScreenCaptureModal-sJqB_hrK.js → ScreenCaptureModal-cElYPaSj.js} +1 -1
  63. package/dist-cli-web/assets/{SectionTabs.vue_vue_type_script_setup_true_lang-BPt98e6z.js → SectionTabs.vue_vue_type_script_setup_true_lang-pVQMbTsj.js} +1 -1
  64. package/dist-cli-web/assets/{Select-BAnN4HMs.js → Select-H8Fz6RkU.js} +1 -1
  65. package/dist-cli-web/assets/{SettingsModal-C4ANMlJJ.js → SettingsModal-52Fw4fVW.js} +2 -2
  66. package/dist-cli-web/assets/{StorageTab-BgNQliz4.js → StorageTab-BnugE5BO.js} +1 -1
  67. package/dist-cli-web/assets/{Switch-DddEvDJa.js → Switch-K4aqYC4Y.js} +1 -1
  68. package/dist-cli-web/assets/{Tabs-DwjL-ueH.js → Tabs-BXjD45rO.js} +1 -1
  69. package/dist-cli-web/assets/{Tabs-xVtuBuO0.js → Tabs-DJ5p8gb6.js} +1 -1
  70. package/dist-cli-web/assets/{ThemeCard.vue_vue_type_script_setup_true_lang-CNCVa86b.js → ThemeCard.vue_vue_type_script_setup_true_lang-BLmTpx4f.js} +1 -1
  71. package/dist-cli-web/assets/{TimeSelect.vue_vue_type_script_setup_true_lang-BehUIWki.js → TimeSelect.vue_vue_type_script_setup_true_lang-geQAlopO.js} +1 -1
  72. package/dist-cli-web/assets/{VisuallyHiddenInput-ST6JNfSG.js → VisuallyHiddenInput-J2KEIQBX.js} +1 -1
  73. package/dist-cli-web/assets/{WebGLRenderer-DRraqD4Y.js → WebGLRenderer-BDFzRniS.js} +1 -1
  74. package/dist-cli-web/assets/{WebGPURenderer-CnzaYARg.js → WebGPURenderer-BKYZyUCZ.js} +1 -1
  75. package/dist-cli-web/assets/{aiChat-CeJy-gG-.js → aiChat-CdJzpNYW.js} +3 -3
  76. package/dist-cli-web/assets/{base-BHbtUviQ.js → base-129JztT1.js} +1 -1
  77. package/dist-cli-web/assets/{browserAll-DYxkitnx.js → browserAll-CZNZDK1i.js} +1 -1
  78. package/dist-cli-web/assets/{chatMessages-Dj1u-tFB.js → chatMessages-zmzHCUCy.js} +3 -3
  79. package/dist-cli-web/assets/{cli-web-BtH8nfjA.js → cli-web-_WGCg-ZY.js} +1 -1
  80. package/dist-cli-web/assets/{fetch-DNmRaRxX.js → fetch-B7Tdp7Uo.js} +1 -1
  81. package/dist-cli-web/assets/{fetch-JEEBqR_7.js → fetch-BBdyPNj3.js} +1 -1
  82. package/dist-cli-web/assets/{fetch-DogRrvT6.js → fetch-Bafz8jLM.js} +1 -1
  83. package/dist-cli-web/assets/{fetch-T5Gi1TUZ.js → fetch-C4W6tD-D.js} +1 -1
  84. package/dist-cli-web/assets/{fetch-C1Tm66i9.js → fetch-DOsmgros.js} +1 -1
  85. package/dist-cli-web/assets/{fetch-emZXHmoE.js → fetch-DTPDtL38.js} +1 -1
  86. package/dist-cli-web/assets/{fetch-ejEMWPM2.js → fetch-DaeoNUip.js} +1 -1
  87. package/dist-cli-web/assets/{fetch-CGnWNSsG.js → fetch-DgHdAlO7.js} +1 -1
  88. package/dist-cli-web/assets/{fetch-D7hfFyoG.js → fetch-Di4QpfqL.js} +1 -1
  89. package/dist-cli-web/assets/{fetch-CAEyoWQA.js → fetch-Dw33HaVP.js} +11 -13
  90. package/dist-cli-web/assets/{fetch-BJ82mWvv.js → fetch-IP6i-mtr.js} +1 -1
  91. package/dist-cli-web/assets/{fetch-U9QyidNZ.js → fetch-sbr95ipd.js} +1 -1
  92. package/dist-cli-web/assets/{host-BUvwCvZR.js → host-CMnAiJSx.js} +1 -1
  93. package/dist-cli-web/assets/{host-VTWF81F5.js → host-CuuNLUWx.js} +1 -1
  94. package/dist-cli-web/assets/{index-B3MCGDwx.js → index-BBYtZa7g.js} +1 -1
  95. package/dist-cli-web/assets/{index-DZK9Njvy.js → index-BOXh7X5Y.js} +1 -1
  96. package/dist-cli-web/assets/{index-KpnLSzzX.js → index-BepItDCQ.js} +4 -4
  97. package/dist-cli-web/assets/{index-HjrJ3DXO.js → index-BmGA3geF.js} +1 -1
  98. package/dist-cli-web/assets/{index-CVRBBnQw.js → index-C-u3l4Uh.js} +1 -1
  99. package/dist-cli-web/assets/{index-iEQnKg2R.js → index-CN9WMxb3.js} +2 -2
  100. package/dist-cli-web/assets/{index-DUBl6aBF.js → index-Chh0gCp7.js} +1 -1
  101. package/dist-cli-web/assets/index-DRFMz0cs.css +1 -0
  102. package/dist-cli-web/assets/{index-C75W1B5J.css → index-DbP9vQhR.css} +1 -1
  103. package/dist-cli-web/assets/{index-BI2Rb_L3.js → index-DgCXdbsG.js} +2 -2
  104. package/dist-cli-web/assets/{index-DQFcmWSa.js → index-DhRaZS6z.js} +1 -1
  105. package/dist-cli-web/assets/{index-DDt7Tfda.js → index-Dz4yfeg6.js} +1 -1
  106. package/dist-cli-web/assets/{index-BLYSew5C.js → index-EtteazuD.js} +1 -1
  107. package/dist-cli-web/assets/index-GNMlsoVH.js +137 -0
  108. package/dist-cli-web/assets/{index-D9C3dyV8.js → index-bQ9oj54q.js} +3 -3
  109. package/dist-cli-web/assets/{index-e6fOnhNS.js → index-fsLAooCi.js} +1 -1
  110. package/dist-cli-web/assets/{people-page-header-DWXwFJ8M.js → people-page-header-CKXRSnpl.js} +1 -1
  111. package/dist-cli-web/assets/{prompt-Cepfb-5-.js → prompt-DNxAd1Bj.js} +1 -1
  112. package/dist-cli-web/assets/{semantic-index-config-builder-hTY6QyCe.js → semantic-index-config-builder-CQ27G4TK.js} +1 -1
  113. package/dist-cli-web/assets/{service-DwCmXFtI.js → service-BwbGKwDn.js} +1 -1
  114. package/dist-cli-web/assets/service-DQjyjQZx.js +1 -0
  115. package/dist-cli-web/assets/service-Dtve_40X.js +1 -0
  116. package/dist-cli-web/assets/useFormControl-CNmp_2bd.js +1 -0
  117. package/dist-cli-web/assets/{useInsightTabAnalytics-CplGbsbe.js → useInsightTabAnalytics-DaU_ADbQ.js} +4 -4
  118. package/dist-cli-web/assets/{useTable-Dmpbk7fZ.js → useTable-BYXxnZMd.js} +1 -1
  119. package/dist-cli-web/assets/{useToast-Bmgpd3sl.js → useToast-DPkgv34s.js} +1 -1
  120. package/dist-cli-web/assets/{webworkerAll-DkPWEyVL.js → webworkerAll-Um4PrCaA.js} +1 -1
  121. package/dist-cli-web/index.html +1 -1
  122. package/package.json +1 -1
  123. package/dist/chat-command-G2EX7VHR.mjs.map +0 -1
  124. package/dist/chunk-HBAQPF6X.mjs.map +0 -1
  125. package/dist/chunk-L6RJIVLS.mjs.map +0 -1
  126. package/dist/chunk-T5H56AZV.mjs.map +0 -1
  127. package/dist/mcp-XXSQJBGU.mjs.map +0 -1
  128. package/dist-cli-web/assets/index-Bs7gk1gf.css +0 -1
  129. package/dist-cli-web/assets/index-Cza8BzZE.js +0 -137
  130. package/dist-cli-web/assets/service-BjE0YJaM.js +0 -1
  131. package/dist-cli-web/assets/service-DQxttlJp.js +0 -1
  132. package/dist-cli-web/assets/useFormControl-CJyJY8AK.js +0 -1
  133. /package/dist/{chunk-YI3EQYEG.mjs.map → chunk-4FAEB4C2.mjs.map} +0 -0
  134. /package/dist/{chunk-HMVM7VCA.mjs.map → chunk-5OA4QI3Q.mjs.map} +0 -0
  135. /package/dist/{chunk-EK5QIJLZ.mjs.map → chunk-E2ZFGNZQ.mjs.map} +0 -0
  136. /package/dist/{chunk-F4HVCFZL.mjs.map → chunk-E6IRRNBQ.mjs.map} +0 -0
  137. /package/dist/{chunk-FCUUAGGC.mjs.map → chunk-GDKQKHJT.mjs.map} +0 -0
  138. /package/dist/{chunk-H46CLFWK.mjs.map → chunk-HJWBFHNR.mjs.map} +0 -0
  139. /package/dist/{chunk-E6LCCPIB.mjs.map → chunk-IMJVOODY.mjs.map} +0 -0
  140. /package/dist/{chunk-XQ6Z2KNN.mjs.map → chunk-O57SQSCO.mjs.map} +0 -0
  141. /package/dist/{chunk-EFX66A2O.mjs.map → chunk-ZGXXAPLX.mjs.map} +0 -0
  142. /package/dist/{http-5BRVWAJR.mjs.map → http-QJDZKDNJ.mjs.map} +0 -0
  143. /package/dist/{import-IAECQDKC.mjs.map → import-XK6YM26A.mjs.map} +0 -0
  144. /package/dist/{src-4HLKMQ7S.mjs.map → src-4AHJUFCW.mjs.map} +0 -0
  145. /package/dist/{stream-import-PUG42I36.mjs.map → stream-import-7VQVT5ST.mjs.map} +0 -0
  146. /package/dist/{worker-runtime-X5563TVT.mjs.map → worker-runtime-PQBAV75N.mjs.map} +0 -0
@@ -28,7 +28,7 @@ import {
28
28
  getWeekdayActivity,
29
29
  queryMessages,
30
30
  searchMessagesByKeywords
31
- } from "./chunk-HBAQPF6X.mjs";
31
+ } from "./chunk-ZOHSWBD2.mjs";
32
32
 
33
33
  // ../../packages/tools/src/utils/limits.ts
34
34
  function resolveMessageLimit(requestedLimit, defaultLimit, maxMessagesLimit) {
@@ -951,8 +951,12 @@ var getSegmentSummariesTool = {
951
951
  var inputSchema17 = {
952
952
  type: "object",
953
953
  properties: {
954
- days: { type: "number", description: "\u5206\u6790\u6700\u8FD1\u591A\u5C11\u5929\u7684\u6570\u636E\uFF0C\u9ED8\u8BA4 30" },
955
- top_n: { type: "number", description: "\u8FD4\u56DE\u524D\u591A\u5C11\u540D\uFF0C\u9ED8\u8BA4 10" }
954
+ days: {
955
+ type: "number",
956
+ description: "Recent days to analyze when no explicit or selected time range is available; defaults to 30"
957
+ },
958
+ top_n: { type: "number", description: "\u8FD4\u56DE\u524D\u591A\u5C11\u540D\uFF0C\u9ED8\u8BA4 10" },
959
+ ...timeParamProperties
956
960
  }
957
961
  };
958
962
  async function handler17(params, context) {
@@ -960,15 +964,20 @@ async function handler17(params, context) {
960
964
  const isZh = isChineseLocale(locale);
961
965
  const days = params.days || 30;
962
966
  const topN = params.top_n || 10;
967
+ const effectiveTimeFilter = parseExtendedTimeParams(params, context.timeFilter);
968
+ const timeCondition = effectiveTimeFilter ? "msg.ts >= @startTs AND msg.ts <= @endTs" : "msg.ts > unixepoch('now', '-' || @days || ' days')";
963
969
  const sql = `
964
970
  SELECT msg.sender_id, COALESCE(m.group_nickname, m.account_name) AS name, msg.ts
965
971
  FROM message msg
966
972
  JOIN member m ON msg.sender_id = m.id
967
973
  WHERE msg.type = 0
968
- AND msg.ts > unixepoch('now', '-' || @days || ' days')
974
+ AND ${timeCondition}
969
975
  ORDER BY msg.ts ASC
970
976
  `;
971
- const rows = await context.dataProvider.executeParameterizedSql(sql, { days });
977
+ const rows = await context.dataProvider.executeParameterizedSql(
978
+ sql,
979
+ effectiveTimeFilter ? { ...effectiveTimeFilter } : { days }
980
+ );
972
981
  if (!rows || rows.length < 2) {
973
982
  const text = isZh ? "\u8BE5\u65F6\u95F4\u8303\u56F4\u5185\u6D88\u606F\u4E0D\u8DB3\uFF0C\u65E0\u6CD5\u5206\u6790\u54CD\u5E94\u65F6\u95F4" : "Not enough messages in this time range to analyze response time";
974
983
  return { content: text, data: null };
@@ -994,8 +1003,10 @@ async function handler17(params, context) {
994
1003
  avg: formatTime(s.avgSeconds),
995
1004
  count: s.responseCount
996
1005
  }));
1006
+ const formattedRange = formatTimeRange(effectiveTimeFilter, locale);
1007
+ const period = typeof formattedRange === "string" ? isZh ? `\u8FD1${days}\u5929` : `Last ${days} days` : `${formattedRange.start} \u2013 ${formattedRange.end}`;
997
1008
  const data = {
998
- period: isZh ? `\u8FD1${days}\u5929` : `Last ${days} days`,
1009
+ period,
999
1010
  totalResponders: stats.length,
1000
1011
  ranking: ranking.map(
1001
1012
  (r) => `${r.rank}. ${r.name} \u2014 ${isZh ? "\u4E2D\u4F4D\u6570" : "median"} ${r.median}, ${isZh ? "\u5E73\u5747" : "avg"} ${r.avg} (${r.count}${isZh ? "\u6B21" : " responses"})`
@@ -1015,8 +1026,12 @@ var responseTimeAnalysisTool = {
1015
1026
  var inputSchema18 = {
1016
1027
  type: "object",
1017
1028
  properties: {
1018
- days: { type: "number", description: "\u5206\u6790\u6700\u8FD1\u591A\u5C11\u5929\u7684\u6570\u636E\uFF0C\u9ED8\u8BA4 30" },
1019
- top_n: { type: "number", description: "\u8FD4\u56DE\u524D\u591A\u5C11\u4E2A\u9AD8\u9891\u8BCD\uFF0C\u9ED8\u8BA4 50" }
1029
+ days: {
1030
+ type: "number",
1031
+ description: "Recent days to analyze when no explicit or selected time range is available; defaults to 30"
1032
+ },
1033
+ top_n: { type: "number", description: "\u8FD4\u56DE\u524D\u591A\u5C11\u4E2A\u9AD8\u9891\u8BCD\uFF0C\u9ED8\u8BA4 50" },
1034
+ ...timeParamProperties
1020
1035
  }
1021
1036
  };
1022
1037
  async function handler18(params, context) {
@@ -1028,13 +1043,18 @@ async function handler18(params, context) {
1028
1043
  const text = isZh ? "\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u5206\u8BCD\u529F\u80FD" : "Text segmentation is not available in this environment";
1029
1044
  return { content: text, data: null };
1030
1045
  }
1046
+ const effectiveTimeFilter = parseExtendedTimeParams(params, context.timeFilter);
1047
+ const timeCondition = effectiveTimeFilter ? "ts >= @startTs AND ts <= @endTs" : "ts > unixepoch('now', '-' || @days || ' days')";
1031
1048
  const sql = `
1032
1049
  SELECT content FROM message
1033
1050
  WHERE type = 0 AND content IS NOT NULL AND LENGTH(content) > 1
1034
- AND ts > unixepoch('now', '-' || @days || ' days')
1051
+ AND ${timeCondition}
1035
1052
  LIMIT 50000
1036
1053
  `;
1037
- const rows = await context.dataProvider.executeParameterizedSql(sql, { days });
1054
+ const rows = await context.dataProvider.executeParameterizedSql(
1055
+ sql,
1056
+ effectiveTimeFilter ? { ...effectiveTimeFilter } : { days }
1057
+ );
1038
1058
  if (!rows || rows.length === 0) {
1039
1059
  const text = isZh ? "\u8BE5\u65F6\u95F4\u8303\u56F4\u5185\u6CA1\u6709\u6587\u672C\u6D88\u606F" : "No text messages in this time range";
1040
1060
  return { content: text, data: null };
@@ -1056,8 +1076,10 @@ async function handler18(params, context) {
1056
1076
  word,
1057
1077
  count
1058
1078
  }));
1079
+ const formattedRange = formatTimeRange(effectiveTimeFilter, locale);
1080
+ const period = typeof formattedRange === "string" ? isZh ? `\u8FD1${days}\u5929` : `Last ${days} days` : `${formattedRange.start} \u2013 ${formattedRange.end}`;
1059
1081
  const data = {
1060
- period: isZh ? `\u8FD1${days}\u5929` : `Last ${days} days`,
1082
+ period,
1061
1083
  totalMessages: rows.length,
1062
1084
  totalKeywords: ranking.length,
1063
1085
  keywords: ranking.map((r) => `${r.rank}. ${r.word} (${r.count}${isZh ? "\u6B21" : ""})`)
@@ -3514,6 +3536,269 @@ var CoreDataProvider = class {
3514
3536
  }
3515
3537
  };
3516
3538
 
3539
+ // ../../packages/tools/src/tool-metadata.ts
3540
+ var ENGLISH_TOOL_METADATA = {
3541
+ get_chat_overview: {
3542
+ description: "Get a chat overview including its name, platform, message and member counts, time range, and most active members.",
3543
+ properties: { top_n: "Number of most active members to return. Defaults to 10." }
3544
+ },
3545
+ search_messages: {
3546
+ description: "Search chat messages by keywords, with optional time-range and sender filters. Use this for topic or keyword lookup.",
3547
+ properties: {
3548
+ keywords: "Keywords to search for.",
3549
+ sender_id: "Filter by sender ID obtained from get_members.",
3550
+ limit: "Maximum number of messages to return.",
3551
+ start_time: "Start time in YYYY-MM-DD HH:mm format.",
3552
+ end_time: "End time in YYYY-MM-DD HH:mm format."
3553
+ }
3554
+ },
3555
+ deep_search_messages: {
3556
+ description: "Search messages using slower substring matching. Use this for exact phrase matches or when regular search misses results.",
3557
+ properties: {
3558
+ keywords: "Keywords to search for.",
3559
+ sender_id: "Filter by sender ID obtained from get_members.",
3560
+ limit: "Maximum number of messages to return.",
3561
+ start_time: "Start time in YYYY-MM-DD HH:mm format.",
3562
+ end_time: "End time in YYYY-MM-DD HH:mm format."
3563
+ }
3564
+ },
3565
+ get_recent_messages: {
3566
+ description: "Get messages from a specified time range. Use this for questions such as what people have discussed recently.",
3567
+ properties: {
3568
+ limit: "Maximum number of messages to return.",
3569
+ start_time: "Start time in YYYY-MM-DD HH:mm format.",
3570
+ end_time: "End time in YYYY-MM-DD HH:mm format."
3571
+ }
3572
+ },
3573
+ get_message_context: {
3574
+ description: "Get the surrounding chat messages for one or more message IDs.",
3575
+ properties: {
3576
+ message_ids: "Message IDs whose surrounding context should be returned.",
3577
+ context_size: "Number of messages to include before and after each message. Defaults to 20."
3578
+ }
3579
+ },
3580
+ get_segment_messages: {
3581
+ description: "Get the complete message list for a conversation segment found with get_segment_summaries.",
3582
+ properties: {
3583
+ segment_id: "Segment ID obtained from get_segment_summaries.",
3584
+ limit: "Maximum number of messages to return."
3585
+ }
3586
+ },
3587
+ get_members: {
3588
+ description: "Get chat members with their basic information, aliases, and message counts.",
3589
+ properties: {
3590
+ search: "Filter members by name, alias, or platform ID.",
3591
+ limit: "Maximum number of members to return."
3592
+ }
3593
+ },
3594
+ get_member_stats: {
3595
+ description: "Get the member activity ranking with message counts and percentages.",
3596
+ properties: { top: "Number of most active members to return." }
3597
+ },
3598
+ get_time_stats: {
3599
+ description: "Get chat activity grouped by hour, weekday, day, or month.",
3600
+ properties: {
3601
+ type: "Grouping type: hourly, weekday, daily, or monthly.",
3602
+ start_time: "Start time in YYYY-MM-DD HH:mm format.",
3603
+ end_time: "End time in YYYY-MM-DD HH:mm format."
3604
+ }
3605
+ },
3606
+ get_conversation_between: {
3607
+ description: "Get messages exchanged between two members. Obtain both member IDs from get_members before calling this tool.",
3608
+ properties: {
3609
+ member_id_1: "First member ID obtained from get_members.",
3610
+ member_id_2: "Second member ID obtained from get_members.",
3611
+ limit: "Maximum number of messages to return.",
3612
+ start_time: "Start time in YYYY-MM-DD HH:mm format.",
3613
+ end_time: "End time in YYYY-MM-DD HH:mm format."
3614
+ }
3615
+ },
3616
+ get_member_name_history: {
3617
+ description: "Get a member's nickname change history.",
3618
+ properties: { member_id: "Member ID obtained from get_members." }
3619
+ },
3620
+ get_schema: {
3621
+ description: "Get the chat database schema as CREATE TABLE statements."
3622
+ },
3623
+ execute_sql: {
3624
+ description: "Run a read-only SELECT query against the chat database. Use get_schema first when needed and add an explicit LIMIT.",
3625
+ properties: {
3626
+ sql: "Read-only SELECT query to execute. Add an explicit LIMIT when possible.",
3627
+ max_rows: "Maximum rows to return. Defaults to 1000 and is also capped by the execution context."
3628
+ }
3629
+ },
3630
+ get_segment_summaries: {
3631
+ description: "Get the list of segment summaries for a quick view of the topics discussed in the chat history. Topics that have been discussed can be searched by keyword.",
3632
+ properties: {
3633
+ keywords: "Filter summary content by keywords.",
3634
+ limit: "Maximum number of segments to return. Defaults to 20.",
3635
+ start_time: "Start time in YYYY-MM-DD HH:mm format.",
3636
+ end_time: "End time in YYYY-MM-DD HH:mm format."
3637
+ }
3638
+ },
3639
+ response_time_analysis: {
3640
+ description: "Analyze the response-speed ranking of chat members, based on the median and mean of their reply intervals.",
3641
+ properties: {
3642
+ days: "Number of most recent days of data to analyze. Defaults to 30.",
3643
+ top_n: "Number of top-ranked members to return. Defaults to 10."
3644
+ }
3645
+ },
3646
+ keyword_frequency: {
3647
+ description: "Count the most frequent keywords in the chat, analyzing message content through NLP word segmentation.",
3648
+ properties: {
3649
+ days: "Number of most recent days of data to analyze. Defaults to 30.",
3650
+ top_n: "Number of top frequent words to return. Defaults to 50."
3651
+ }
3652
+ },
3653
+ semantic_search_current_chat: {
3654
+ properties: {
3655
+ query: "Semantic search query. Rewrite it into a natural-language description suited to searching the current chat history (centred on the facts/people/places/events/past mentions that need to be confirmed).",
3656
+ max_results: "Expected number of relevant excerpts to return; optional. When omitted, the default configured by the user is used; it may be raised according to question complexity, with a hard limit of 20."
3657
+ }
3658
+ },
3659
+ retrieve_chat_evidence: {
3660
+ properties: {
3661
+ query: 'The question or retrieval target that has to be confirmed with chat evidence, for example "how many times have we travelled to Leshan".',
3662
+ criteria: `Judgement criteria: what counts and what does not. Counting or judgement questions should fill this in, for example "counts: evidence of an actual trip/arrival/stay; does not count: plans only, travel guides, other people's experiences, general chatter".`,
3663
+ keywords: "Keyword list, given explicitly by you (the tool does not expand synonyms). Used by the hybrid/keyword modes for exact recall.",
3664
+ mode: "auto (default)/hybrid (semantic + keyword)/semantic (semantic only)/keyword (keyword only). Counting historical facts usually uses hybrid.",
3665
+ max_results: "Expected number of excerpts returned by the semantic path, with a hard limit of 20.",
3666
+ start_time: "Start time in YYYY-MM-DD HH:mm format.",
3667
+ end_time: "End time in YYYY-MM-DD HH:mm format."
3668
+ }
3669
+ },
3670
+ message_type_breakdown: {
3671
+ description: "Break the messages of the last N days down by message type (how many text, image, voice, sticker and other messages there are). Use this to understand communication-style preferences.",
3672
+ properties: { days: "Number of most recent days of data to count." }
3673
+ },
3674
+ peak_chat_hours_by_member: {
3675
+ description: "Analyze the hourly distribution of a given member's messages over the last N days to find their most active hours. Obtain member_id from get_members before calling this tool.",
3676
+ properties: {
3677
+ member_id: "Member ID obtained from get_members.",
3678
+ days: "Number of most recent days of data to count."
3679
+ }
3680
+ },
3681
+ member_activity_trend: {
3682
+ description: "View the trend of a given member's daily message counts over the last N days. Use this to observe whether someone has become more active or more silent. Obtain member_id from get_members before calling this tool.",
3683
+ properties: {
3684
+ member_id: "Member ID obtained from get_members.",
3685
+ days: "Number of most recent days of trend to view."
3686
+ }
3687
+ },
3688
+ silent_members: {
3689
+ description: 'Detect "silent members" who have not spoken for more than N days. Use this in community management to find users at risk of churn.',
3690
+ properties: { days: "Number of days without speaking that counts as silent." }
3691
+ },
3692
+ reply_interaction_ranking: {
3693
+ description: "Analyze the ranking of reply interactions in the chat to find who replies to whom the most. Use this to discover the core interaction relationships and the opinion leaders in the community.",
3694
+ properties: {
3695
+ days: "Number of most recent days of data to count.",
3696
+ limit: "Number of top interaction pairs to return."
3697
+ }
3698
+ },
3699
+ mutual_interaction_pairs: {
3700
+ description: "Find the member pairs that interact most frequently, based on the temporal proximity of two-way messages (one interaction is counted when the other party also speaks within 5 minutes of one party speaking). Use this to discover closely connected friend pairs.",
3701
+ properties: {
3702
+ days: "Number of most recent days of data to count.",
3703
+ limit: "Number of top pairs to return."
3704
+ }
3705
+ },
3706
+ member_message_length_stats: {
3707
+ description: "Count the average message length of each member (text messages only); long messages usually mean more thoughtful communication. Use this to discover members who communicate in depth.",
3708
+ properties: {
3709
+ days: "Number of most recent days of data to count.",
3710
+ top_n: "Number of top-ranked members to return."
3711
+ }
3712
+ },
3713
+ daily_active_members: {
3714
+ description: 'Count the daily unique speakers (DAU) and message volume, used to observe how the vitality of the chat changes. Use this for questions such as "what is the chat activity trend" and "how many people have been talking recently".',
3715
+ properties: { days: "Number of most recent days of data to count." }
3716
+ },
3717
+ conversation_initiator_stats: {
3718
+ description: "Count how many times each member starts a conversation (as the sender of the conversation's first message) to find who opens topics most often.",
3719
+ properties: {
3720
+ days: "Number of most recent days of data to count.",
3721
+ limit: "Number of top-ranked members to return."
3722
+ }
3723
+ },
3724
+ activity_heatmap: {
3725
+ description: "Return a weekday \xD7 hour matrix of message counts, suitable for generating an activity heatmap. weekday: 0=Sunday, 1=Monday, ..., 6=Saturday.",
3726
+ properties: { days: "Number of most recent days of data to count." }
3727
+ },
3728
+ unanswered_messages: {
3729
+ description: "Find messages from the last N days that were never replied to; these may be unresolved customer questions. Only text messages whose content is longer than 10 characters are counted (short greetings are filtered out).",
3730
+ properties: {
3731
+ days: "Number of most recent days of data to search.",
3732
+ limit: "Maximum number of messages to return."
3733
+ }
3734
+ },
3735
+ list_sessions: {
3736
+ description: "List all available chat sessions, returning basic information such as session name, platform, and message count.",
3737
+ properties: { keyword: "Filter sessions by name (optional)." }
3738
+ },
3739
+ get_session_info: {
3740
+ description: "Get detailed information about the current session, including its name, platform, total message count, member count, and time range.",
3741
+ properties: { include_members: "Whether to include the member list (defaults to false)." }
3742
+ },
3743
+ search_messages_globally: {
3744
+ properties: {
3745
+ start_time: "Start time in YYYY-MM-DD HH:mm format.",
3746
+ end_time: "End time in YYYY-MM-DD HH:mm format."
3747
+ }
3748
+ },
3749
+ get_cross_chat_overview: {
3750
+ properties: {
3751
+ start_time: "Start time in YYYY-MM-DD HH:mm format.",
3752
+ end_time: "End time in YYYY-MM-DD HH:mm format."
3753
+ }
3754
+ },
3755
+ rank_private_contacts: {
3756
+ properties: {
3757
+ start_time: "Start time in YYYY-MM-DD HH:mm format.",
3758
+ end_time: "End time in YYYY-MM-DD HH:mm format."
3759
+ }
3760
+ },
3761
+ rank_group_sessions: {
3762
+ properties: {
3763
+ start_time: "Start time in YYYY-MM-DD HH:mm format.",
3764
+ end_time: "End time in YYYY-MM-DD HH:mm format."
3765
+ }
3766
+ },
3767
+ inspect_contact_sessions: {
3768
+ properties: {
3769
+ start_time: "Start time in YYYY-MM-DD HH:mm format.",
3770
+ end_time: "End time in YYYY-MM-DD HH:mm format."
3771
+ }
3772
+ },
3773
+ inspect_shared_interactions: {
3774
+ properties: {
3775
+ start_time: "Start time in YYYY-MM-DD HH:mm format.",
3776
+ end_time: "End time in YYYY-MM-DD HH:mm format."
3777
+ }
3778
+ }
3779
+ };
3780
+ function localizeInputSchema(schema, properties) {
3781
+ if (!properties) return schema;
3782
+ return {
3783
+ ...schema,
3784
+ properties: Object.fromEntries(
3785
+ Object.entries(schema.properties).map(([name, definition]) => [
3786
+ name,
3787
+ properties[name] ? { ...definition, description: properties[name] } : definition
3788
+ ])
3789
+ )
3790
+ };
3791
+ }
3792
+ function getLocalizedToolMetadata(tool, locale) {
3793
+ if (isChineseLocale(locale)) return { description: tool.description, inputSchema: tool.inputSchema };
3794
+ const metadata = ENGLISH_TOOL_METADATA[tool.name];
3795
+ if (!metadata) return { description: tool.description, inputSchema: tool.inputSchema };
3796
+ return {
3797
+ description: metadata.description ?? tool.description,
3798
+ inputSchema: localizeInputSchema(tool.inputSchema, metadata.properties)
3799
+ };
3800
+ }
3801
+
3517
3802
  // ../../packages/tools/src/agent-adapter.ts
3518
3803
  function toAgentToolParameters(schema) {
3519
3804
  return {
@@ -3555,18 +3840,21 @@ function createCrossChatAgentToolAdapters(context) {
3555
3840
  ...context,
3556
3841
  resolvedEntityRefs: context.resolvedEntityRefs ?? []
3557
3842
  };
3558
- return CROSS_CHAT_AGENT_TOOL_REGISTRY.map((tool) => ({
3559
- name: tool.name,
3560
- label: tool.name,
3561
- description: tool.description,
3562
- parameters: toAgentToolParameters(tool.inputSchema),
3563
- executionMode: tool.executionMode,
3564
- execute: async (_toolCallId, params, signal, onUpdate) => executeToolForAgent(tool, params, {
3565
- ...runContext,
3566
- abortSignal: signal,
3567
- reportProgress: (progress) => onUpdate?.({ content: [], details: { progress } })
3568
- })
3569
- }));
3843
+ return CROSS_CHAT_AGENT_TOOL_REGISTRY.map((tool) => {
3844
+ const { description, inputSchema: inputSchema21 } = getLocalizedToolMetadata(tool, context.locale);
3845
+ return {
3846
+ name: tool.name,
3847
+ label: tool.name,
3848
+ description,
3849
+ parameters: toAgentToolParameters(inputSchema21),
3850
+ executionMode: tool.executionMode,
3851
+ execute: async (_toolCallId, params, signal, onUpdate) => executeToolForAgent(tool, params, {
3852
+ ...runContext,
3853
+ abortSignal: signal,
3854
+ reportProgress: (progress) => onUpdate?.({ content: [], details: { progress } })
3855
+ })
3856
+ };
3857
+ });
3570
3858
  }
3571
3859
 
3572
3860
  export {
@@ -3574,8 +3862,9 @@ export {
3574
3862
  SEMANTIC_SEARCH_TOOL_NAME,
3575
3863
  MCP_TOOL_REGISTRY,
3576
3864
  CoreDataProvider,
3865
+ getLocalizedToolMetadata,
3577
3866
  toAgentToolParameters,
3578
3867
  executeToolForAgent,
3579
3868
  createCrossChatAgentToolAdapters
3580
3869
  };
3581
- //# sourceMappingURL=chunk-L6RJIVLS.mjs.map
3870
+ //# sourceMappingURL=chunk-IDDTW5JN.mjs.map